diff mbox series

ASoC: samsung: speyside: Free gpiod table

Message ID 20250312-cleanup-table-v1-1-1d9a14464482@linaro.org (mailing list archive)
State New
Headers show
Series ASoC: samsung: speyside: Free gpiod table | expand

Commit Message

Linus Walleij March 12, 2025, 10:02 a.m. UTC
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.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Fixes: da9146c19b17 ("ASoC: samsung: speyside: Convert to GPIO descriptor")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 sound/soc/samsung/speyside.c | 10 ++++++++++
 1 file changed, 10 insertions(+)


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

Best regards,

Comments

andriy.shevchenko@linux.intel.com March 12, 2025, 11:14 a.m. UTC | #1
On Wed, Mar 12, 2025 at 11:02:25AM +0100, Linus Walleij wrote:
> 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?

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Linus Walleij March 12, 2025, 11:22 a.m. UTC | #2
On Wed, Mar 12, 2025 at 12:14 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> On Wed, Mar 12, 2025 at 11:02:25AM +0100, Linus Walleij wrote:
> > 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
Mark Brown March 12, 2025, 3 p.m. UTC | #3
On Wed, 12 Mar 2025 11:02:25 +0100, Linus Walleij wrote:
> 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
diff mbox series

Patch

diff --git a/sound/soc/samsung/speyside.c b/sound/soc/samsung/speyside.c
index f781e2be2fd496924045597b750ab7f2249d8977..9262e56265842e7f8e5b5a740115cb5fbb0c537a 100644
--- a/sound/soc/samsung/speyside.c
+++ b/sound/soc/samsung/speyside.c
@@ -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");