Re: [PATCH 2/9] usb: gadget: net2280: Dont use magic numbers

From: Ricardo Ribalda Delgado
Date: Tue May 20 2014 - 10:38:26 EST


Hello Alan

In this case, there are only two family of devices supported by the
driver. Maybe quirks are too much.

At the end:

ep->dev->pdev->vendor == PCI_VENDOR_ID_PLX_LEGACY

is not much bigger than

ep->dev->quirk_flag & PLX_NET2280_QUIRK

But if you prefer the quirk I dont mind implementing it, but please as
a follow-up patch, since there are 8 patches depending on this :)

Regards!


On Tue, May 20, 2014 at 4:21 PM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> On Mon, 19 May 2014, Ricardo Ribalda Delgado wrote:
>
>> Instead of using magic numbers use #defines
>>
>> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@xxxxxxxxx>
>> ---
>> drivers/usb/gadget/net2280.c | 68 +++++++++++++++++++++++---------------------
>> drivers/usb/gadget/net2280.h | 1 +
>> 2 files changed, 36 insertions(+), 33 deletions(-)
>>
>> diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c
>> index 8112d91..ba1fdd8 100644
>> --- a/drivers/usb/gadget/net2280.c
>> +++ b/drivers/usb/gadget/net2280.c
>> @@ -152,7 +152,7 @@ static inline void enable_pciirqenb(struct net2280_ep *ep)
>> {
>> u32 tmp = readl(&ep->dev->regs->pciirqenb0);
>>
>> - if (ep->dev->pdev->vendor == 0x17cc)
>> + if (ep->dev->pdev->vendor == PCI_VENDOR_ID_PLX_LEGACY)
>
> You ought to be able to make this considerably smaller by using a
> quirk flag in ep->dev. The flag can indicate whether or not the
> controller uses the LEGACY interface.
>
> Alan Stern
>



--
Ricardo Ribalda
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/