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

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Tue Nov 15 06:13: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/wm8737.c | 34 ++--------------------------------
 1 file changed, 2 insertions(+), 32 deletions(-)

diff --git a/sound/soc/codecs/wm8737.c b/sound/soc/codecs/wm8737.c
index f0cb1c4..60d0917 100644
--- a/sound/soc/codecs/wm8737.c
+++ b/sound/soc/codecs/wm8737.c
@@ -664,6 +664,7 @@ static int wm8737_i2c_remove(struct i2c_client *client)
 	.remove =   wm8737_i2c_remove,
 	.id_table = wm8737_i2c_id,
 };
+module_i2c_driver(wm8737_i2c_driver);
 #endif
 
 #if defined(CONFIG_SPI_MASTER)
@@ -714,40 +715,9 @@ static int wm8737_spi_remove(struct spi_device *spi)
 	.probe		= wm8737_spi_probe,
 	.remove		= wm8737_spi_remove,
 };
+module_spi_driver(wm8737_spi_driver);
 #endif /* CONFIG_SPI_MASTER */
 
-static int __init wm8737_modinit(void)
-{
-	int ret;
-#if IS_ENABLED(CONFIG_I2C)
-	ret = i2c_add_driver(&wm8737_i2c_driver);
-	if (ret != 0) {
-		printk(KERN_ERR "Failed to register WM8737 I2C driver: %d\n",
-		       ret);
-	}
-#endif
-#if defined(CONFIG_SPI_MASTER)
-	ret = spi_register_driver(&wm8737_spi_driver);
-	if (ret != 0) {
-		printk(KERN_ERR "Failed to register WM8737 SPI driver: %d\n",
-		       ret);
-	}
-#endif
-	return 0;
-}
-module_init(wm8737_modinit);
-
-static void __exit wm8737_exit(void)
-{
-#if defined(CONFIG_SPI_MASTER)
-	spi_unregister_driver(&wm8737_spi_driver);
-#endif
-#if IS_ENABLED(CONFIG_I2C)
-	i2c_del_driver(&wm8737_i2c_driver);
-#endif
-}
-module_exit(wm8737_exit);
-
 MODULE_DESCRIPTION("ASoC WM8737 driver");
 MODULE_AUTHOR("Mark Brown <broonie at opensource.wolfsonmicro.com>");
 MODULE_LICENSE("GPL");
-- 
1.9.1



More information about the Alsa-devel mailing list