[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201202241503.27406.arnd@arndb.de>
Date: Fri, 24 Feb 2012 15:03:27 +0000
From: Arnd Bergmann <arnd@...db.de>
To: linux-arm-kernel@...ts.infradead.org
Cc: Wolfram Sang <w.sang@...gutronix.de>,
Roland Stigge <stigge@...com.de>,
"Greg Kroah-Hartman" <gregkh@...uxfoundation.org>,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
kevin.wells@....com, Alan Stern <stern@...land.harvard.edu>
Subject: Re: [PATCH v2] USB: Support for LPC32xx SoC
On Friday 24 February 2012, Wolfram Sang wrote:
> > To get rid of the remaining #ifdefs, I could as well create a new
> > ohci-lpc32xx.c instead of abusing ohci-pnx4008.c. Would this be the way
> > to go or are there any other suggestions?
>
> If you could tell the difference between pnx4008 and lpc32xx, then you could
> simply do something like:
>
> if (machine_is_pnx4008)
> pnx4008_configure();
> else
> lpc32xx_configure();
>
> or
>
> if (machine_is_pnx4008)
> pnx4008_(un)set_usb_bits
I would recomment telling this from the device itself rather than from the
platform. You can add a platform_device_id list and put information like this
into the driver_data, then do
switch (pdev->id.driver_data) {
case OHCI_PNX4008:
pnx4008_configure();
break;
case
lpc32xx_configure();
break;
};
if (pdev->id.driver_data == OHCI_PNX4008)
pnx4008_(un)set_usb_bits()
Alternatively, you can put the common code into one file, and use separate
files for the parts that are different between pnx4008 and lpc32xx.
Unfortunately, the way that ohci handles the abstraction between the
various implementations is backwards, it would be much easier if the
main driver was following that model to start with.
Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists