Re: [PATCH 2/2] ASoC: ti: omap-twl4030: use per-device instance of headset jack gpio
Sebastian Reichel <[email protected]> Sat, 25 Jul 2026 03:10:09 +0200
| Newsgroups | org.kernel.vger.linux-omap,org.kernel.vger.linux-kernel,org.kernel.vger.linux-sound |
|---|---|
| Message-ID | <amQM056GAKZzudvp@venus> |
--o3uipsqb5lgyeoyy Content-Type: text/plain; protected-headers=v1; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH 2/2] ASoC: ti: omap-twl4030: use per-device instance of headset jack gpio MIME-Version: 1.0 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. >=20 > 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(-) >=20 > 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" > =20 > struct omap_twl4030 { > + struct snd_soc_jack_gpio hs_jack_gpio; > struct snd_soc_jack hs_jack; > }; > =20 > @@ -123,15 +124,6 @@ static struct snd_soc_jack_pin hs_jack_pins[] =3D { > }, > }; > =20 > -/* Headset jack detection gpios */ > -static struct snd_soc_jack_gpio hs_jack_gpios[] =3D { > - { > - .name =3D "ti,jack-det", > - .report =3D SND_JACK_HEADSET, > - .debounce_time =3D 200, > - }, > -}; > - > static int omap_twl4030_init(struct snd_soc_pcm_runtime *rtd) > { > struct snd_soc_card *card =3D rtd->card; > @@ -144,9 +136,6 @@ static int omap_twl4030_init(struct snd_soc_pcm_runti= me *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 =3D card->dev; > - hs_jack_gpios[0].idx =3D 0; > - > ret =3D 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_runt= ime *rtd) > if (ret) > return ret; > =20 > - ret =3D snd_soc_jack_add_gpios(&priv->hs_jack, > - ARRAY_SIZE(hs_jack_gpios), > - hs_jack_gpios); > + priv->hs_jack_gpio.name =3D "ti,jack-det"; > + priv->hs_jack_gpio.report =3D SND_JACK_HEADSET; > + priv->hs_jack_gpio.debounce_time =3D 200; > + priv->hs_jack_gpio.gpiod_dev =3D card->dev; > + priv->hs_jack_gpio.idx =3D 0; > + > + ret =3D snd_soc_jack_add_gpios(&priv->hs_jack, 1, > + &priv->hs_jack_gpio); > if (ret) > return ret; > } > --=20 > 2.55.0.229.g6434b31f56-goog >=20 >=20 --o3uipsqb5lgyeoyy Content-Type: application/pgp-signature; name="signature.asc" -----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----- --o3uipsqb5lgyeoyy--