On Tue, Sep 01, 2015 at 05:54:18PM -0500, Peter E. Berger wrote:
> From: "Peter E. Berger" <pber...@brimson.com>
> 
> Move request_firmware from edge_startup to download_fw
> 
> Signed-off-by: Peter E. Berger <pber...@brimson.com>
> ---
>  drivers/usb/serial/io_ti.c | 56 
> ++++++++++++++++++++++++----------------------
>  1 file changed, 29 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
> index a226424..9fe12cc 100644
> --- a/drivers/usb/serial/io_ti.c
> +++ b/drivers/usb/serial/io_ti.c
> @@ -991,18 +991,29 @@ static int check_fw_sanity(struct edgeport_serial 
> *serial,
>   * This routine downloads the main operating code into the TI5052, using the
>   * boot code already burned into E2PROM or ROM.
>   */
> -static int download_fw(struct edgeport_serial *serial,
> -             const struct firmware *fw)
> +static int download_fw(struct edgeport_serial *serial)
>  {
>       struct device *dev = &serial->serial->interface->dev;
>       int status = 0;
>       struct usb_interface_descriptor *interface;
> -     struct edgeport_fw_hdr *fw_hdr = (struct edgeport_fw_hdr *)fw->data;
> +     const struct firmware *fw;
> +     const char *fw_name = "edgeport/down3.bin";
> +     struct edgeport_fw_hdr *fw_hdr;
>  
> -     if (check_fw_sanity(serial, fw))
> -             return -EINVAL;
> +     status = request_firmware(&fw, fw_name, dev);
> +     if (status) {
> +             dev_err(dev, "Failed to load image \"%s\" err %d\n",
> +                             fw_name, status);
> +             return status;
> +     }
> +     fw_hdr = (struct edgeport_fw_hdr *)fw->data;

Move this after check_fw_sanity below.

> +
> +     if (check_fw_sanity(serial, fw)) {
> +             status = -EINVAL;
> +             goto out;
> +     }
>  
> -     /* If on-board version is newer, "fw_version" will be updated below. */
> +     /* If on-board version is newer, "fw_version" will be updated later. */
>       serial->fw_version = (fw_hdr->major_version << 8) +
>                       fw_hdr->minor_version;

Thanks,
Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to