On Wed, Nov 18, 2009 at 01:17:26PM +0100, Wolfram Sang wrote: > Add the MAX7300-I2C variant to the MAX7301-SPI version. They share most parts > of the driver (i.e. the logic) and the read/write-register functions get > encapsulated. It is thus possible to use both variants simultaneously. > > diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig > index 2ad0128..a1d2608 100644 [...] > +MODULE_ALIAS("spi:max7301"); > + > +#define max7301_add_driver(drv) spi_register_driver(drv) > +#define max7301_del_driver(drv) spi_unregister_driver(drv) > +#else > +#define max7301_add_driver(drv) (0) > +#define max7301_del_driver(drv) do { } while(0) > +#endif /* CONFIG_GPIO_MAX7301_SPI */ [...] > static int __init max7301_init(void) > { > - return spi_register_driver(&max7301_driver); > + int ret; > + ret = max7300_add_driver(&max7300_driver); > + if (ret) > + return ret; > + ret = max7301_add_driver(&max7301_driver); Nowadays you can use device table matching, as an example see commit 8cec03eee4a771f949c70cff07775c9bb21d4642 ("hwmon: lm70: convert to device table matching"). Thanks, -- Anton Vorontsov email: cbouatmailru@xxxxxxxxx irc://irc.freenode.net/bd2 -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html