diff options
Diffstat (limited to 'drivers/mfd/mc13xxx.c')
-rw-r--r-- | drivers/mfd/mc13xxx.c | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/drivers/mfd/mc13xxx.c b/drivers/mfd/mc13xxx.c index a5877dbda1..1f321a3272 100644 --- a/drivers/mfd/mc13xxx.c +++ b/drivers/mfd/mc13xxx.c @@ -399,37 +399,24 @@ static __maybe_unused struct of_device_id mc13xxx_dt_ids[] = { { } }; -static struct driver_d mc13xxx_i2c_driver = { +static __maybe_unused struct driver_d mc13xxx_i2c_driver = { .name = "mc13xxx-i2c", .probe = mc13xxx_probe, .id_table = mc13xxx_ids, .of_compatible = DRV_OF_COMPAT(mc13xxx_dt_ids), }; -static struct driver_d mc13xxx_spi_driver = { +#if IS_ENABLED(CONFIG_I2C) +coredevice_i2c_driver(mc13xxx_i2c_driver); +#endif + +static __maybe_unused struct driver_d mc13xxx_spi_driver = { .name = "mc13xxx-spi", .probe = mc13xxx_probe, .id_table = mc13xxx_ids, .of_compatible = DRV_OF_COMPAT(mc13xxx_dt_ids), }; -static int __init mc13xxx_init(void) -{ - int err_spi = 0, err_i2c = 0; - - if (IS_ENABLED(CONFIG_I2C)) - err_spi = i2c_driver_register(&mc13xxx_i2c_driver); - - if (IS_ENABLED(CONFIG_SPI)) - err_i2c = spi_driver_register(&mc13xxx_spi_driver); - - if (err_spi) - return err_spi; - - if (err_i2c) - return err_i2c; - - return 0; - -} -coredevice_initcall(mc13xxx_init); +#if IS_ENABLED(CONFIG_SPI) +coredevice_spi_driver(mc13xxx_spi_driver); +#endif |