Skip to contentSkip to conversation

ASoC: samsung: speyside: Free gpiod table

PATCH In review Linus Walleij 3 participants 4 messages Mar 12, 2025

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

PATCH 1/1 ASoC: samsung: speyside: Free gpiod table

We create a gpio descriptor table but it needs to be free:ed when the module is removed. Add a devm_ action to do the job.

Fixes da9146c19b17 ("ASoC: samsung: speyside: Convert to GPIO descriptor")
---
 sound/soc/samsung/speyside.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
sound/soc/samsung/speyside.c +10 -0
index f781e2be2fd496924045597b750ab7f2249d8977..9262e56265842e7f8e5b5a740115cb5fbb0c537a 100644
@@ -347,6 +347,11 @@ static struct gpiod_lookup_table wm8996_gpiod_table = {
 	},
 };
 
+static void speyside_gpiod_table_action(void *data)
+{
+	gpiod_remove_lookup_table(&wm8996_gpiod_table);
+}
+
 static int speyside_probe(struct platform_device *pdev)
 {
 	struct snd_soc_card *card = &speyside;
@@ -355,6 +360,11 @@ static int speyside_probe(struct platform_device *pdev)
 	card->dev = &pdev->dev;
 
 	gpiod_add_lookup_table(&wm8996_gpiod_table);
+	ret = devm_add_action_or_reset(&pdev->dev, speyside_gpiod_table_action,
+				       NULL);
+	if (ret)
+		return ret;
+
 	ret = devm_snd_soc_register_card(&pdev->dev, card);
 	if (ret)
 		dev_err_probe(&pdev->dev, ret, "snd_soc_register_card() failed\n");

---
base-commit: eea255893718268e1ab852fb52f70c613d109b99
change-id: 20250312-cleanup-table-ce8607f2b1ef

Best regards,

Signature · 1 line
Linus Walleij <[email protected]>
Reviewed-by on v1 1/1
#1 lore raw
Quoted 2 lines · Linus Walleij

We create a gpio descriptor table but it needs to be free:ed when the module is removed. Add a devm_ action to do the job.

As the fix this is fine, but I'm wondering if we want to have devm_gpiod_add_lookup_table() in the GPIO devres,c/h?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw
Quoted 6 lines · Andy Shevchenko
Quoted 2 lines · Linus Walleij

We create a gpio descriptor table but it needs to be free:ed when the module is removed. Add a devm_ action to do the job.

As the fix this is fine, but I'm wondering if we want to have devm_gpiod_add_lookup_table() in the GPIO devres,c/h?

A lot of the tables are added statically from board files and the like, i.e. there is no device to associate them with, but I don't know how many could actually use devres?

Yours,
Linus Walleij

maintainer
#3 lore raw
In reply to Linus Walleij
Quoted 4 lines · Linus Walleij

We create a gpio descriptor table but it needs to be free:ed when the module is removed. Add a devm_ action to do the job.

Applied to

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

Thanks!

[1/1] ASoC: samsung: speyside: Free gpiod table

      commit: 87fa872a1ecf542efc66a9184127faf03037f827

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