Skip to contentSkip to conversation

ASoC: soc-jack: Get rid of legacy GPIO support

PATCH Superseded Andy Shevchenko 2 participants 6 messages Mar 18, 2024 – Mar 26, 2024

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: soc-jack: Get rid of legacy GPIO support

No more users.

---
 include/sound/soc-jack.h |  2 --

If I am not mistaken, after
https://lore.kernel.org/r/[email protected]
there is no more users. Hence the above is the only dependency.

 sound/soc/soc-jack.c     | 23 ++++-------------------
 2 files changed, 4 insertions(+), 21 deletions(-)
include/sound/soc-jack.h +0 -2
index a0abb1ee5110..3a81d4b8ca8a 100644
@@ -44,7 +44,6 @@ struct snd_soc_jack_zone {
 /**
  * struct snd_soc_jack_gpio - Describes a gpio pin for jack detection
  *
- * @gpio:         legacy gpio number
  * @idx:          gpio descriptor index within the function of the GPIO
  *                consumer device
  * @gpiod_dev:    GPIO consumer device
@@ -59,7 +58,6 @@ struct snd_soc_jack_zone {
  *		       ADC).
  */
 struct snd_soc_jack_gpio {
-	unsigned int gpio;
 	unsigned int idx;
 	struct device *gpiod_dev;
 	const char *name;
sound/soc/soc-jack.c +4 -19
index b2cc13b9c77b..63971396b708 100644
@@ -8,7 +8,6 @@
 
 #include <sound/jack.h>
 #include <sound/soc.h>
-#include <linux/gpio.h>
 #include <linux/gpio/consumer.h>
 #include <linux/interrupt.h>
 #include <linux/workqueue.h>
@@ -345,21 +344,9 @@ int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
 				goto undo;
 			}
 		} else {
-			/* legacy GPIO number */
-			if (!gpio_is_valid(gpios[i].gpio)) {
-				dev_err(jack->card->dev,
-					"ASoC: Invalid gpio %d\n",
-					gpios[i].gpio);
-				ret = -EINVAL;
-				goto undo;
-			}
-
-			ret = gpio_request_one(gpios[i].gpio, GPIOF_IN,
-					       gpios[i].name);
-			if (ret)
-				goto undo;
-
-			gpios[i].desc = gpio_to_desc(gpios[i].gpio);
+			dev_err(jack->card->dev, "ASoC: Invalid gpio at index %d\n", i);
+		        ret = -EINVAL;
+		        goto undo;
 		}
 got_gpio:
 		INIT_DELAYED_WORK(&gpios[i].work, gpio_work);
@@ -373,7 +360,7 @@ int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
 					      gpios[i].name,
 					      &gpios[i]);
 		if (ret < 0)
-			goto err;
+			goto undo;
 
 		if (gpios[i].wake) {
 			ret = irq_set_irq_wake(gpiod_to_irq(gpios[i].desc), 1);
@@ -401,8 +388,6 @@ int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
 	devres_add(jack->card->dev, tbl);
 	return 0;
 
-err:
-	gpio_free(gpios[i].gpio);
 undo:
 	jack_free_gpios(jack, i, gpios);
 	devres_free(tbl);
Signature · 1 line
2.43.0.rc1.1.gbec44491f096
maintainer
#1 lore raw
Quoted 9 lines · Andy Shevchenko

No more users.

---
 include/sound/soc-jack.h |  2 --

If I am not mistaken, after
https://lore.kernel.org/r/[email protected]
there is no more users. Hence the above is the only dependency.

You are mistaken, please try compile tests:

/build/stage/linux/sound/soc/generic/simple-card-utils.c: In function ‘simple_util_init_jack’:
/build/stage/linux/sound/soc/generic/simple-card-utils.c:755:20: error: ‘struct snd_soc_jack_gpio’ has no member named ‘gpio’
755 | sjack->gpio.gpio = -ENOENT;
| ^

(this is among other things in x86 allmodconfig).

#2 lore raw
Quoted 1 line · Mark Brown

On Mon, Mar 18, 2024 at 10:25:16PM +0200, Andy Shevchenko wrote:

...

Quoted 4 lines
Quoted 3 lines

If I am not mistaken, after
https://lore.kernel.org/r/[email protected]
there is no more users. Hence the above is the only dependency.

Quoted 8 lines

You are mistaken, please try compile tests:

/build/stage/linux/sound/soc/generic/simple-card-utils.c: In function ‘simple_util_init_jack’:
/build/stage/linux/sound/soc/generic/simple-card-utils.c:755:20: error: ‘struct snd_soc_jack_gpio’ has no member named ‘gpio’
755 | sjack->gpio.gpio = -ENOENT;
| ^

(this is among other things in x86 allmodconfig).

I usually enable the particular drivers and I have compile tested this, but indeed, I haven't enabled _all_ modules.

Thank you for the pointing out.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#3 lore raw
Quoted 8 lines · Andy Shevchenko
Quoted 7 lines · Mark Brown
Quoted 3 lines · Andy Shevchenko

If I am not mistaken, after
https://lore.kernel.org/r/[email protected]
there is no more users. Hence the above is the only dependency.

You are mistaken, please try compile tests:

...

Quoted 6 lines
Quoted 1 line

(this is among other things in x86 allmodconfig).

I usually enable the particular drivers and I have compile tested this, but indeed, I haven't enabled _all_ modules.

Thank you for the pointing out.

Especially if you're doing this sort of "I think I got everything" type change it's sensible to do at least one allmodconfig build, it won't get everything but it'll catch a lot.

#4 lore raw
Quoted 3 lines · Mark Brown
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Mark Brown

On Mon, Mar 18, 2024 at 10:25:16PM +0200, Andy Shevchenko wrote:

...

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

If I am not mistaken, after
https://lore.kernel.org/r/[email protected]
there is no more users. Hence the above is the only dependency.

You are mistaken, please try compile tests:

...

Quoted 10 lines
Quoted 6 lines
Quoted 1 line

(this is among other things in x86 allmodconfig).

I usually enable the particular drivers and I have compile tested this, but indeed, I haven't enabled _all_ modules.

Thank you for the pointing out.

Especially if you're doing this sort of "I think I got everything" type change it's sensible to do at least one allmodconfig build, it won't get everything but it'll catch a lot.

True, as even git grep output can be misinterpreted and some occurrences may disappear from the sight.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#5 lore raw
In reply to Andy Shevchenko
Quoted 3 lines · Andy Shevchenko

No more users.

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: soc-jack: Get rid of legacy GPIO support

      commit: 7b95ee0db7e0a7f99077f1b926323c7bf0d2e8f8

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark