From: Takashi Iwai <tiwai@suse.de>
To: "Cássio Gabriel" <cassiogabrielcontato@gmail.com>
Cc: Takashi Iwai <tiwai@suse.com>, Jaroslav Kysela <perex@perex.cz>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] ALSA: tea6330t: add mixer state restore helper
Date: Tue, 07 Apr 2026 13:55:54 +0200 [thread overview]
Message-ID: <87tstnm1bp.wl-tiwai@suse.de> (raw)
In-Reply-To: <20260406-alsa-interwave-pm-v1-1-6ffa6f317c8f@gmail.com>
On Tue, 07 Apr 2026 03:22:07 +0200,
Cássio Gabriel wrote:
> diff --git a/sound/i2c/tea6330t.c b/sound/i2c/tea6330t.c
> index e8c50a036bea..3e413929d3ea 100644
> --- a/sound/i2c/tea6330t.c
> +++ b/sound/i2c/tea6330t.c
> @@ -358,3 +358,36 @@ int snd_tea6330t_update_mixer(struct snd_card *card,
>
> EXPORT_SYMBOL(snd_tea6330t_detect);
> EXPORT_SYMBOL(snd_tea6330t_update_mixer);
Oh we need a cleanup to put EXPORT_SYMBOL() after each function.
(It should be a different patch, though.)
> +
> +int snd_tea6330t_restore_mixer(struct snd_i2c_bus *bus)
> +{
> + struct snd_i2c_device *device;
> + struct tea6330t *tea;
> + unsigned char bytes[7];
> + unsigned int idx;
> + int err;
> +
> + if (!bus)
> + return -EINVAL;
> +
> + list_for_each_entry(device, &bus->devices, list) {
> + if (device->addr != TEA6330T_ADDR)
> + continue;
> +
> + tea = device->private_data;
> + if (!tea)
> + return -EINVAL;
> +
> + snd_i2c_lock(bus);
> + bytes[0] = TEA6330T_SADDR_VOLUME_LEFT;
> + for (idx = 0; idx < 6; idx++)
> + bytes[idx + 1] = tea->regs[idx];
> + err = snd_i2c_sendbytes(device, bytes, 7);
> + snd_i2c_unlock(bus);
> +
> + return err < 0 ? err : 0;
> + }
I think snd_i2c_lock() should cover the whole loop for the race at
linked list traversal.
thanks,
Takashi
next prev parent reply other threads:[~2026-04-07 11:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-07 1:22 [PATCH 0/2] ALSA: add suspend/resume support for InterWave ISA cards Cássio Gabriel
2026-04-07 1:22 ` [PATCH 1/2] ALSA: tea6330t: add mixer state restore helper Cássio Gabriel
2026-04-07 11:55 ` Takashi Iwai [this message]
2026-04-07 14:39 ` Cássio Gabriel Monteiro Pires
2026-04-07 1:22 ` [PATCH 2/2] ALSA: interwave: add ISA and PnP suspend and resume callbacks Cássio Gabriel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tstnm1bp.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=cassiogabrielcontato@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox