Skip to contentSkip to conversation

codecs: Use IS_ENABLED() macro

PATCH Applied Fabio Estevam 3 participants 16 messages Nov 20, 2013 – Nov 29, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover codecs: Use IS_ENABLED() macro

From: Fabio Estevam <[email protected]>

Using the IS_ENABLED() macro can make the code shorter and simpler.

Mark,

There are still more ocurrences that can be converted to IS_ENABLED.

If you are happy with this series I will send another one with the remaining pieces.

#1 lore raw

PATCH 1/11 wm8962: Use IS_ENABLED() macro

From: Fabio Estevam <[email protected]>

Using the IS_ENABLED() macro can make the code shorter and simpler.

---
 sound/soc/codecs/wm8962.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/wm8962.c +2 -2
index 543c5c2..07da601 100644
@@ -74,7 +74,7 @@ struct wm8962_priv {
 	struct regulator_bulk_data supplies[WM8962_NUM_SUPPLIES];
 	struct notifier_block disable_nb[WM8962_NUM_SUPPLIES];
 
-#if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE)
+#if IS_ENABLED(CONFIG_INPUT)
 	struct input_dev *beep;
 	struct work_struct beep_work;
 	int beep_rate;
@@ -3108,7 +3108,7 @@ int wm8962_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack)
 }
 EXPORT_SYMBOL_GPL(wm8962_mic_detect);
 
-#if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE)
+#if IS_ENABLED(CONFIG_INPUT)
 static int beep_rates[] = {
 	500, 1000, 2000, 4000,
 };
Signature · 1 line
1.8.1.2
#2 lore raw

PATCH 2/11 soc-io.c: Use IS_ENABLED() macro

In reply to Fabio Estevam

From: Fabio Estevam <[email protected]>

Using the IS_ENABLED() macro can make the code shorter and simpler.

---
 sound/soc/soc-io.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/soc-io.c +2 -2
index 4f11d23..aa886cc 100644
@@ -99,14 +99,14 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
 	config.val_bits = data_bits;
 
 	switch (control) {
-#if defined(CONFIG_REGMAP_I2C) || defined(CONFIG_REGMAP_I2C_MODULE)
+#if IS_ENABLED(CONFIG_REGMAP_I2C)
 	case SND_SOC_I2C:
 		codec->control_data = regmap_init_i2c(to_i2c_client(codec->dev),
 						      &config);
 		break;
 #endif
 
-#if defined(CONFIG_REGMAP_SPI) || defined(CONFIG_REGMAP_SPI_MODULE)
+#if IS_ENABLED(CONFIG_REGMAP_SPI)
 	case SND_SOC_SPI:
 		codec->control_data = regmap_init_spi(to_spi_device(codec->dev),
 						      &config);
Signature · 1 line
1.8.1.2
#3 lore raw

PATCH 3/11 ad193x: Use IS_ENABLED() macro

In reply to Fabio Estevam

From: Fabio Estevam <[email protected]>

Using the IS_ENABLED() macro can make the code shorter and simpler.

---
 sound/soc/codecs/ad193x.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/codecs/ad193x.c +3 -3
index aea7e52..12c27eb 100644
@@ -413,7 +413,7 @@ static struct spi_driver ad193x_spi_driver = {
 };
 #endif
 
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
 
 static const struct regmap_config ad193x_i2c_regmap_config = {
 	.val_bits = 8,
@@ -470,7 +470,7 @@ static int __init ad193x_modinit(void)
 {
 	int ret;
 
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
 	ret =  i2c_add_driver(&ad193x_i2c_driver);
 	if (ret != 0) {
 		printk(KERN_ERR "Failed to register AD193X I2C driver: %d\n",
@@ -495,7 +495,7 @@ static void __exit ad193x_modexit(void)
 	spi_unregister_driver(&ad193x_spi_driver);
 #endif
 
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
 	i2c_del_driver(&ad193x_i2c_driver);
 #endif
 }
Signature · 1 line
1.8.1.2
Acked-by on v1 3/11
#4 lore raw

Re: [PATCH 03/11] ad193x: Use IS_ENABLED() macro

2013/11/21 Fabio Estevam <[email protected]>:

Quoted 32 lines

From: Fabio Estevam <[email protected]>

Using the IS_ENABLED() macro can make the code shorter and simpler.

---
 sound/soc/codecs/ad193x.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/codecs/ad193x.c +2 -2
index aea7e52..12c27eb 100644
@@ -413,7 +413,7 @@ static struct spi_driver ad193x_spi_driver = {
 };
 #endif
 
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
 
 static const struct regmap_config ad193x_i2c_regmap_config = {
        .val_bits = 8,
@@ -470,7 +470,7 @@ static int __init ad193x_modinit(void)
 {
        int ret;
 
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
        ret =  i2c_add_driver(&ad193x_i2c_driver);
        if (ret != 0) {
                printk(KERN_ERR "Failed to register AD193X I2C driver: %d\n",

sound/soc/codecs/ad193x.c static void __exit ad193x_modexit(void) · line 501

Quoted 8 lines
sound/soc/codecs/ad193x.c +1 -1
@@ -495,7 +495,7 @@ static void __exit ad193x_modexit(void)
        spi_unregister_driver(&ad193x_spi_driver);
 #endif
 
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
        i2c_del_driver(&ad193x_i2c_driver);
 #endif
 }
#5 lore raw

PATCH 4/11 adav80x: Use IS_ENABLED() macro

In reply to Fabio Estevam

From: Fabio Estevam <[email protected]>

Using the IS_ENABLED() macro can make the code shorter and simpler.

---
 sound/soc/codecs/adav80x.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/codecs/adav80x.c +3 -3
index 14a7c16..f7bf455 100644
@@ -939,7 +939,7 @@ static struct spi_driver adav80x_spi_driver = {
 };
 #endif
 
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
 static const struct regmap_config adav80x_i2c_regmap_config = {
 	.val_bits = 8,
 	.pad_bits = 1,
@@ -985,7 +985,7 @@ static int __init adav80x_init(void)
 {
 	int ret = 0;
 
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
 	ret = i2c_add_driver(&adav80x_i2c_driver);
 	if (ret)
 		return ret;
@@ -1001,7 +1001,7 @@ module_init(adav80x_init);
 
 static void __exit adav80x_exit(void)
 {
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
 	i2c_del_driver(&adav80x_i2c_driver);
 #endif
 #if defined(CONFIG_SPI_MASTER)
Signature · 1 line
1.8.1.2
#6 lore raw

PATCH 4/11 adav80x: Use IS_ENABLED() macro

In reply to Fabio Estevam

From: Fabio Estevam <[email protected]>

Using the IS_ENABLED() macro can make the code shorter and simpler.

---
 sound/soc/codecs/adav80x.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/codecs/adav80x.c +3 -3
index 14a7c16..f7bf455 100644
@@ -939,7 +939,7 @@ static struct spi_driver adav80x_spi_driver = {
 };
 #endif
 
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
 static const struct regmap_config adav80x_i2c_regmap_config = {
 	.val_bits = 8,
 	.pad_bits = 1,
@@ -985,7 +985,7 @@ static int __init adav80x_init(void)
 {
 	int ret = 0;
 
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
 	ret = i2c_add_driver(&adav80x_i2c_driver);
 	if (ret)
 		return ret;
@@ -1001,7 +1001,7 @@ module_init(adav80x_init);
 
 static void __exit adav80x_exit(void)
 {
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
 	i2c_del_driver(&adav80x_i2c_driver);
 #endif
 #if defined(CONFIG_SPI_MASTER)
Signature · 1 line
1.8.1.2
#7 lore raw

PATCH 5/11 ak4642: Use IS_ENABLED() macro

In reply to Fabio Estevam

From: Fabio Estevam <[email protected]>

Using the IS_ENABLED() macro can make the code shorter and simpler.

---
 sound/soc/codecs/ak4642.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/codecs/ak4642.c +3 -3
index 090d499..2f861c9 100644
@@ -511,7 +511,7 @@ static struct snd_soc_codec_driver soc_codec_dev_ak4648 = {
 	.num_dapm_routes	= ARRAY_SIZE(ak4642_intercon),
 };
 
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
 static struct of_device_id ak4642_of_match[];
 static int ak4642_i2c_probe(struct i2c_client *i2c,
 			    const struct i2c_device_id *id)
@@ -576,7 +576,7 @@ static struct i2c_driver ak4642_i2c_driver = {
 static int __init ak4642_modinit(void)
 {
 	int ret = 0;
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
 	ret = i2c_add_driver(&ak4642_i2c_driver);
 #endif
 	return ret;
@@ -586,7 +586,7 @@ module_init(ak4642_modinit);
 
 static void __exit ak4642_exit(void)
 {
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
 	i2c_del_driver(&ak4642_i2c_driver);
 #endif
 
Signature · 1 line
1.8.1.2
#8 lore raw

PATCH 6/11 wm8728: Use IS_ENABLED() macro

In reply to Fabio Estevam

From: Fabio Estevam <[email protected]>

Using the IS_ENABLED() macro can make the code shorter and simpler.

---
 sound/soc/codecs/wm8728.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/codecs/wm8728.c +3 -3
index c6a292d..cd89033 100644
@@ -320,7 +320,7 @@ static struct spi_driver wm8728_spi_driver = {
 };
 #endif /* CONFIG_SPI_MASTER */
 
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
 static int wm8728_i2c_probe(struct i2c_client *i2c,
 			    const struct i2c_device_id *id)
 {
@@ -371,7 +371,7 @@ static struct i2c_driver wm8728_i2c_driver = {
 static int __init wm8728_modinit(void)
 {
 	int ret = 0;
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
 	ret = i2c_add_driver(&wm8728_i2c_driver);
 	if (ret != 0) {
 		printk(KERN_ERR "Failed to register wm8728 I2C driver: %d\n",
@@ -391,7 +391,7 @@ module_init(wm8728_modinit);
 
 static void __exit wm8728_exit(void)
 {
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
 	i2c_del_driver(&wm8728_i2c_driver);
 #endif
 #if defined(CONFIG_SPI_MASTER)
Signature · 1 line
1.8.1.2
maintainer Applied
#9 lore raw

Re: [PATCH 06/11] wm8728: Use IS_ENABLED() macro

Quoted 3 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

Using the IS_ENABLED() macro can make the code shorter and simpler.

Applied, thanks.

#10 lore raw

PATCH 7/11 wm8711: Use IS_ENABLED() macro

In reply to Fabio Estevam

From: Fabio Estevam <[email protected]>

Using the IS_ENABLED() macro can make the code shorter and simpler.

---
 sound/soc/codecs/wm8711.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/codecs/wm8711.c +3 -3
index 5b428b0..d99f948 100644
@@ -469,7 +469,7 @@ static struct spi_driver wm8711_spi_driver = {
 };
 #endif /* CONFIG_SPI_MASTER */
 
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
 static int wm8711_i2c_probe(struct i2c_client *client,
 			    const struct i2c_device_id *id)
 {
@@ -520,7 +520,7 @@ static struct i2c_driver wm8711_i2c_driver = {
 static int __init wm8711_modinit(void)
 {
 	int ret;
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
 	ret = i2c_add_driver(&wm8711_i2c_driver);
 	if (ret != 0) {
 		printk(KERN_ERR "Failed to register WM8711 I2C driver: %d\n",
@@ -540,7 +540,7 @@ module_init(wm8711_modinit);
 
 static void __exit wm8711_exit(void)
 {
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
 	i2c_del_driver(&wm8711_i2c_driver);
 #endif
 #if defined(CONFIG_SPI_MASTER)
Signature · 1 line
1.8.1.2
#11 lore raw

PATCH 8/11 wm8580: Use IS_ENABLED() macro

In reply to Fabio Estevam

From: Fabio Estevam <[email protected]>

Using the IS_ENABLED() macro can make the code shorter and simpler.

---
 sound/soc/codecs/wm8580.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/codecs/wm8580.c +3 -3
index 08a414b..318989a 100644
@@ -941,7 +941,7 @@ static const struct regmap_config wm8580_regmap = {
 	.volatile_reg = wm8580_volatile,
 };
 
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
 static int wm8580_i2c_probe(struct i2c_client *i2c,
 			    const struct i2c_device_id *id)
 {
@@ -1003,7 +1003,7 @@ static int __init wm8580_modinit(void)
 {
 	int ret = 0;
 
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
 	ret = i2c_add_driver(&wm8580_i2c_driver);
 	if (ret != 0) {
 		pr_err("Failed to register WM8580 I2C driver: %d\n", ret);
@@ -1016,7 +1016,7 @@ module_init(wm8580_modinit);
 
 static void __exit wm8580_exit(void)
 {
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
 	i2c_del_driver(&wm8580_i2c_driver);
 #endif
 }
Signature · 1 line
1.8.1.2
#12 lore raw

PATCH 9/11 wm8523: Use IS_ENABLED() macro

In reply to Fabio Estevam

From: Fabio Estevam <[email protected]>

Using the IS_ENABLED() macro can make the code shorter and simpler.

---
 sound/soc/codecs/wm8523.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/codecs/wm8523.c +3 -3
index 139bf9a..74d106d 100644
@@ -452,7 +452,7 @@ static const struct regmap_config wm8523_regmap = {
 	.volatile_reg = wm8523_volatile_register,
 };
 
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
 static int wm8523_i2c_probe(struct i2c_client *i2c,
 			    const struct i2c_device_id *id)
 {
@@ -555,7 +555,7 @@ static struct i2c_driver wm8523_i2c_driver = {
 static int __init wm8523_modinit(void)
 {
 	int ret;
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
 	ret = i2c_add_driver(&wm8523_i2c_driver);
 	if (ret != 0) {
 		printk(KERN_ERR "Failed to register WM8523 I2C driver: %d\n",
@@ -568,7 +568,7 @@ module_init(wm8523_modinit);
 
 static void __exit wm8523_exit(void)
 {
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
 	i2c_del_driver(&wm8523_i2c_driver);
 #endif
 }
Signature · 1 line
1.8.1.2
#13 lore raw

PATCH 10/11 wm8510: Use IS_ENABLED() macro

In reply to Fabio Estevam

From: Fabio Estevam <[email protected]>

Using the IS_ENABLED() macro can make the code shorter and simpler.

---
 sound/soc/codecs/wm8510.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/codecs/wm8510.c +3 -3
index 6ed5433..7df7d45 100644
@@ -684,7 +684,7 @@ static struct spi_driver wm8510_spi_driver = {
 };
 #endif /* CONFIG_SPI_MASTER */
 
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
 static int wm8510_i2c_probe(struct i2c_client *i2c,
 			    const struct i2c_device_id *id)
 {
@@ -735,7 +735,7 @@ static struct i2c_driver wm8510_i2c_driver = {
 static int __init wm8510_modinit(void)
 {
 	int ret = 0;
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
 	ret = i2c_add_driver(&wm8510_i2c_driver);
 	if (ret != 0) {
 		printk(KERN_ERR "Failed to register WM8510 I2C driver: %d\n",
@@ -755,7 +755,7 @@ module_init(wm8510_modinit);
 
 static void __exit wm8510_exit(void)
 {
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
 	i2c_del_driver(&wm8510_i2c_driver);
 #endif
 #if defined(CONFIG_SPI_MASTER)
Signature · 1 line
1.8.1.2
#14 lore raw

PATCH 11/11 uda1380: Use IS_ENABLED() macro

In reply to Fabio Estevam

From: Fabio Estevam <[email protected]>

Using the IS_ENABLED() macro can make the code shorter and simpler.

---
 sound/soc/codecs/uda1380.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/codecs/uda1380.c +3 -3
index fd0a314..726df6d 100644
@@ -794,7 +794,7 @@ static struct snd_soc_codec_driver soc_codec_dev_uda1380 = {
 	.num_dapm_routes = ARRAY_SIZE(uda1380_dapm_routes),
 };
 
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
 static int uda1380_i2c_probe(struct i2c_client *i2c,
 			     const struct i2c_device_id *id)
 {
@@ -840,7 +840,7 @@ static struct i2c_driver uda1380_i2c_driver = {
 static int __init uda1380_modinit(void)
 {
 	int ret = 0;
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
 	ret = i2c_add_driver(&uda1380_i2c_driver);
 	if (ret != 0)
 		pr_err("Failed to register UDA1380 I2C driver: %d\n", ret);
@@ -851,7 +851,7 @@ module_init(uda1380_modinit);
 
 static void __exit uda1380_exit(void)
 {
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+#if IS_ENABLED(CONFIG_I2C)
 	i2c_del_driver(&uda1380_i2c_driver);
 #endif
 }
Signature · 1 line
1.8.1.2
maintainer Applied
#15 lore raw
In reply to Fabio Estevam
Quoted 3 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

Using the IS_ENABLED() macro can make the code shorter and simpler.

Applied all, thanks, but please do remember to use appropriate subject lines for commits - you were missing ASoC here.