Re: [PATCH 2/2] ASoC: ti: omap-twl4030: use per-device instance of headset jack gpio
Sebastian Reichel <[email protected]>
| Newsgroups | org.kernel.vger.linux-sound,org.kernel.vger.linux-kernel,org.kernel.vger.linux-omap |
|---|---|
| Message-ID | <amQM056GAKZzudvp@venus> |
Hi, On Fri, Jul 24, 2026 at 04:34:30PM -0700, Dmitry Torokhov wrote: > hs_jack_gpios is being potentially shared among several instances of the > same device, and is being modified. This is not the best approach to > structuring the code (even if the device is in fact a singleton). > Change it to allocate a per-device instance. > > Signed-off-by: Dmitry Torokhov <[email protected]> > --- Reviewed-by: Sebastian Reichel <[email protected]> Greetings, -- Sebastian > sound/soc/ti/omap-twl4030.c | 24 +++++++++--------------- > 1 file changed, 9 insertions(+), 15 deletions(-) > > diff --git a/sound/soc/ti/omap-twl4030.c b/sound/soc/ti/omap-twl4030.c > index 950879fc7275..4abcfff04bc7 100644 > --- a/sound/soc/ti/omap-twl4030.c > +++ b/sound/soc/ti/omap-twl4030.c > @@ -28,6 +28,7 @@ > #include "omap-mcbsp.h" > > struct omap_twl4030 { > + struct snd_soc_jack_gpio hs_jack_gpio; > struct snd_soc_jack hs_jack; > }; > > @@ -123,15 +124,6 @@ static struct snd_soc_jack_pin hs_jack_pins[] = { > }, > }; > > -/* Headset jack detection gpios */ > -static struct snd_soc_jack_gpio hs_jack_gpios[] = { > - { > - .name = "ti,jack-det", > - .report = SND_JACK_HEADSET, > - .debounce_time = 200, > - }, > -}; > - > static int omap_twl4030_init(struct snd_soc_pcm_runtime *rtd) > { > struct snd_soc_card *card = rtd->card; > @@ -144,9 +136,6 @@ static int omap_twl4030_init(struct snd_soc_pcm_runtime *rtd) > * only want to add the jack detection if the GPIO is there. > */ > if (of_property_present(card->dev->of_node, "ti,jack-det-gpio")) { > - hs_jack_gpios[0].gpiod_dev = card->dev; > - hs_jack_gpios[0].idx = 0; > - > ret = snd_soc_card_jack_new_pins(rtd->card, "Headset Jack", > SND_JACK_HEADSET, > &priv->hs_jack, hs_jack_pins, > @@ -154,9 +143,14 @@ static int omap_twl4030_init(struct snd_soc_pcm_runtime *rtd) > if (ret) > return ret; > > - ret = snd_soc_jack_add_gpios(&priv->hs_jack, > - ARRAY_SIZE(hs_jack_gpios), > - hs_jack_gpios); > + priv->hs_jack_gpio.name = "ti,jack-det"; > + priv->hs_jack_gpio.report = SND_JACK_HEADSET; > + priv->hs_jack_gpio.debounce_time = 200; > + priv->hs_jack_gpio.gpiod_dev = card->dev; > + priv->hs_jack_gpio.idx = 0; > + > + ret = snd_soc_jack_add_gpios(&priv->hs_jack, 1, > + &priv->hs_jack_gpio); > if (ret) > return ret; > } > -- > 2.55.0.229.g6434b31f56-goog > >
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE72YNB0Y/i3JqeVQT2O7X88g7+poFAmpkDPEACgkQ2O7X88g7 +ppQJw//TjvNcLnNPlKJxNOMs105YOn3lsiqZzRORHpJrrRyiOUViVmi06WW/+rT a+0D1/d6JElwDXTVY+4B1ngW5RTB+HH9U5rv1mzIFsf+F5GNcBv1DgI51QsAL88M 71F+t9Ozm3f/5ycAdFVpE7niOJAorYJLAdsv80KXHCSaeNl79WyFrNhLDvuFc8x/ nuvVrZbxZZe4ewM4a+2hEwN/hB/JyjgWynXtpUDB3qhaOcQNwdhPI/hk8otPVYQf oV4wfRL6MD4Yba5mj4+waBF/GkG125+WgnnxdEytE8Wkemvavpl8zj8JC+ofPZ7/ /chRwnTeUNpq1FGdWSJpLBrF9FOVEPti0ZpGqzSnhQqwm2/2zV+iuri6Zs75s/a7 RRqcBuV1G/+6gZ80VELD1tX4fqmXQdxilxmWZpYaVt79MkSvbsmf8/n4t+0+xOgq hfxePDL5gsLgJqt7fb3AilIhpdijxsiJnWF7b4lgilDWZoI701XVSUTbmh5EYRLc n8EimKCJ/TJjx1YI9HK5bzXtbIkeudYdu5uP0cVcTzY2YqOdFrxfd9sEOvH/xv29 vbkRaeB32tKT8GIo7F/nA6QBl5FLY35cQl2bf8XD9Q4J9j7L3CR4NRE4Bmyu1S8Q TVs91dV7Yv8/h6oRPrg5hfXORktXQiDJfzY1lI3tMlZ+w6b5CYg= =6q2z -----END PGP SIGNATURE-----