On 10/19/2015 02:19 PM, Joachim Eastwood wrote: >>> +static int __init mma7455_modinit(void) >>> +{ >>> + int ret; >>> +#if IS_ENABLED(CONFIG_I2C) >>> + ret = i2c_add_driver(&mma7455_i2c_driver); >>> + if (ret) >>> + pr_err("failed to register MMA7455L I2C driver: %d\n", ret); >>> +#endif >>> +#if IS_ENABLED(CONFIG_SPI_MASTER) >>> + ret = spi_register_driver(&mma7455_spi_driver); >>> + if (ret) >>> + pr_err("failed to register MMA7455L SPI driver: %d\n", ret); >>> +#endif >> >> I know there are a fair amount of bad examples in the IIO tree for this, >> which do the same thing. But the SPI and the I2C parts should go into >> different modules, otherwise you run into issues if one of them is built-in >> while the other is built as a module. The bmg160 gyro driver is a good >> example on how to do handle this. > > Ok, I semi-copied from a ASoC CODEC driver. I'll take a look at how > bmg160 handles it. We deprecated this style in ASoC as well. All new drivers that support both SPI and I2C always come with a foobar-spi.c and foobar-i2c.c file. Not all drivers have been updated to this new scheme yet, but I think the majority follows it by now. -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html