From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756972AbcGZSF5 (ORCPT ); Tue, 26 Jul 2016 14:05:57 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:33438 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757668AbcGZSEL (ORCPT ); Tue, 26 Jul 2016 14:04:11 -0400 From: Mathieu OTHACEHE To: johan@kernel.org, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Mathieu OTHACEHE Subject: [PATCH v2 19/22] usb: serial: ti_usb_3410_5052: Use variables for vendor and product Date: Tue, 26 Jul 2016 19:59:59 +0200 Message-Id: <20160726180002.2398-20-m.othacehe@gmail.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160726180002.2398-1-m.othacehe@gmail.com> References: <20160726180002.2398-1-m.othacehe@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use variables for vendor and product in download_firmware to improve readability. Signed-off-by: Mathieu OTHACEHE --- drivers/usb/serial/ti_usb_3410_5052.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index e59b3c1..24e1d52 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c @@ -1692,7 +1692,10 @@ static int ti_download_firmware(struct usb_serial *serial) struct ti_device *tdev = usb_get_serial_data(serial); const struct firmware *fw_p; char buf[32]; + __le16 vendor, product; + vendor = le16_to_cpu(dev->descriptor.idVendor); + product = le16_to_cpu(dev->descriptor.idProduct); if (le16_to_cpu(dev->descriptor.idVendor) == MXU1_VENDOR_ID) { snprintf(buf, @@ -1705,15 +1708,13 @@ static int ti_download_firmware(struct usb_serial *serial) } /* try ID specific firmware first, then try generic firmware */ - sprintf(buf, "ti_usb-v%04x-p%04x.fw", - le16_to_cpu(dev->descriptor.idVendor), - le16_to_cpu(dev->descriptor.idProduct)); + sprintf(buf, "ti_usb-v%04x-p%04x.fw", vendor, product); status = request_firmware(&fw_p, buf, &dev->dev); if (status != 0) { buf[0] = '\0'; - if (le16_to_cpu(dev->descriptor.idVendor) == MTS_VENDOR_ID) { - switch (le16_to_cpu(dev->descriptor.idProduct)) { + if (vendor == MTS_VENDOR_ID) { + switch (product) { case MTS_CDMA_PRODUCT_ID: strcpy(buf, "mts_cdma.fw"); break; @@ -1733,6 +1734,7 @@ static int ti_download_firmware(struct usb_serial *serial) strcpy(buf, "mts_mt9234zba.fw"); break; } } + if (buf[0] == '\0') { if (tdev->td_is_3410) strcpy(buf, "ti_3410.fw"); -- 2.9.0