Re: [PATCH] staging: comedi: Convert struct addi_board initializationto C99 format

From: Ian Abbott
Date: Fri May 18 2012 - 06:05:08 EST


On 2012-05-17 22:12, H Hartley Sweeten wrote:
On Thursday, May 17, 2012 11:29 AM, Ian Abbott wrote:
On 17/05/2012 17:38, H Hartley Sweeten wrote:
BTW, what actual hardware do you have available to test with?

Not a lot. Just the Amplicon cards (amplc_* drivers).

Speaking of the amplc_* drivers... What's up with them?

The dio200, pc236, and pc263 drivers appear to be some kind of
hybrid comedi driver/comedi pci driver.

That's right. The ISA devices and PCI devices are selected separately in the configuration, but they are similar enough to share the same code.

If the driver is simply
registered as a comedi pci driver will the isa drivers still work?

Yes if both the ISA devices and PCI devices are enabled in the configuration. But you might have one or the other.

In amplc_dio200.c (for example, but similarly for the others), you can assume that at least one of the CONFIG_COMEDI_AMPLC_DIO200_ISA and CONFIG_COMEDI_AMPLC_DIO200_PCI macros is #define'd, so you could do (with the existing variable names, that you'd probably change):

#ifdef CONFIG_COMEDI_AMPLC_DIO200_PCI
module_comedi_pci_driver(driver_amplc_dio200, driver_amplc_dio200_pci_driver);
#else
module_comedi_driver(driver_amplc_dio200);
#endif

(I guess you'd change driver_amplc_dio200 to amplc_dio200_driver and driver_amplc_dio200_pci_driver to amplc_dio200_pci_driver.)

If so we can get rid of a bunch of #ifdef stuff.

Some of them are there to separately configure the ISA and PCI devices and some are just there to trim out some code that is unreachable when one or the other isn't defined.

I tend not to include several functions within the same #ifdef, so it should be easy to move things around to avoid forward declarations.

--
-=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@xxxxxxxxx> )=-
-=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
--
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/