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

From: Alan Stern
Date: Tue May 20 2014 - 10:21:41 EST


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

--
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/