Re: [PATCH v2] USB: Support for LPC32xx SoC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux