[alsa-devel] [PATCH 19/19] ASoC: da7210: Convert to module_i2c/spi_driver()

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Tue Nov 15 06:14:50 CET 2016


From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>

Let's use module_i2c/spi_driver()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
 sound/soc/codecs/da7210.c | 30 ++----------------------------
 1 file changed, 2 insertions(+), 28 deletions(-)

diff --git a/sound/soc/codecs/da7210.c b/sound/soc/codecs/da7210.c
index 17053df..308df3f 100644
--- a/sound/soc/codecs/da7210.c
+++ b/sound/soc/codecs/da7210.c
@@ -1261,6 +1261,7 @@ static int da7210_i2c_remove(struct i2c_client *client)
 	.remove		= da7210_i2c_remove,
 	.id_table	= da7210_i2c_id,
 };
+module_i2c_driver(da7210_i2c_driver);
 #endif
 
 #if defined(CONFIG_SPI_MASTER)
@@ -1344,36 +1345,9 @@ static int da7210_spi_remove(struct spi_device *spi)
 	.probe = da7210_spi_probe,
 	.remove = da7210_spi_remove
 };
+module_spi_driver(da7210_spi_driver);
 #endif
 
-static int __init da7210_modinit(void)
-{
-	int ret = 0;
-#if IS_ENABLED(CONFIG_I2C)
-	ret = i2c_add_driver(&da7210_i2c_driver);
-#endif
-#if defined(CONFIG_SPI_MASTER)
-	ret = spi_register_driver(&da7210_spi_driver);
-	if (ret) {
-		printk(KERN_ERR "Failed to register da7210 SPI driver: %d\n",
-		       ret);
-	}
-#endif
-	return ret;
-}
-module_init(da7210_modinit);
-
-static void __exit da7210_exit(void)
-{
-#if IS_ENABLED(CONFIG_I2C)
-	i2c_del_driver(&da7210_i2c_driver);
-#endif
-#if defined(CONFIG_SPI_MASTER)
-	spi_unregister_driver(&da7210_spi_driver);
-#endif
-}
-module_exit(da7210_exit);
-
 MODULE_DESCRIPTION("ASoC DA7210 driver");
 MODULE_AUTHOR("David Chen, Kuninori Morimoto");
 MODULE_LICENSE("GPL");
-- 
1.9.1



More information about the Alsa-devel mailing list