public inbox for linux-sound@vger.kernel.org
 help / color / mirror / Atom feed
From: "Cássio Gabriel Monteiro Pires" <cassiogabrielcontato@gmail.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: 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, 7 Apr 2026 11:39:30 -0300	[thread overview]
Message-ID: <28143355-b02f-418e-b1ec-1551c497d416@gmail.com> (raw)
In-Reply-To: <87tstnm1bp.wl-tiwai@suse.de>


[-- Attachment #1.1: Type: text/plain, Size: 1498 bytes --]

On 4/7/26 08:55, Takashi Iwai wrote:
> 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.)

Right, I'll do it.
 
>> +
>> +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. 

I'll fix in v2.

> thanks,
> 
> Takashi

-- 
Thanks,
Cássio


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

  reply	other threads:[~2026-04-07 14:39 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
2026-04-07 14:39     ` Cássio Gabriel Monteiro Pires [this message]
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=28143355-b02f-418e-b1ec-1551c497d416@gmail.com \
    --to=cassiogabrielcontato@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.de \
    /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