public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrei Simion <andrei.simion@microchip.com>
To: <claudiu.beznea@tuxon.dev>
Cc: <alexandre.belloni@bootlin.com>, <alsa-devel@alsa-project.org>,
	<andrei.simion@microchip.com>, <broonie@kernel.org>,
	<codrin.ciubotariu@microchip.com>, <lgirdwood@gmail.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <linux-sound@vger.kernel.org>,
	<nicolas.ferre@microchip.com>, <perex@perex.cz>, <tiwai@suse.com>
Subject: Re: [PATCH 3/3] ASoC: atmel: mchp-pdmc: Retain Non-Runtime Controls
Date: Thu, 12 Sep 2024 12:53:38 +0300	[thread overview]
Message-ID: <20240912095337.41507-1-andrei.simion@microchip.com> (raw)
In-Reply-To: <ae7a3386-5e11-4d9b-84a5-8e6a79c91c52@tuxon.dev>

>>  struct mchp_pdmc {
>>  	struct mic_map channel_mic_map[MCHP_PDMC_MAX_CHANNELS];
>> +	spinlock_t busy_lock;		/* lock protecting busy */
>>  	struct device *dev;
>>  	struct snd_dmaengine_dai_dma_data addr;
>>  	struct regmap *regmap;
>> @@ -124,6 +126,7 @@ struct mchp_pdmc {
>>  	int mic_no;
>>  	int sinc_order;
>>  	bool audio_filter_en;
>> +	u8 busy:1;

> Can the spinlock and busy flag be replaced by an atomic variable?

I will use atomic_t variable with atomic_set and atomic_read.
I will do a test and send V2.

>>  };
>>
>>  static const char *const mchp_pdmc_sinc_filter_order_text[] = {
>> @@ -167,10 +170,19 @@ static int mchp_pdmc_sinc_order_put(struct snd_kcontrol *kcontrol,
>>  		return -EINVAL;
>>
>>  	val = snd_soc_enum_item_to_val(e, item[0]) << e->shift_l;
>> -	if (val == dd->sinc_order)
>> +
>> +	spin_lock(&dd->busy_lock);
>> +	if (dd->busy) {
>> +		spin_unlock((&dd->busy_lock));

> You can remove () around (&dd->busy_lock). Valid for the rest of occurrences.

OK. Got it!

>> +		return -EBUSY;
>> +	}
>> +	if (val == dd->sinc_order) {
>> +		spin_unlock((&dd->busy_lock));
>>  		return 0;
>> +	}
>>
>>  	dd->sinc_order = val;
>> +	spin_unlock((&dd->busy_lock));
>>
>>  	return 1;
>>  }


  reply	other threads:[~2024-09-12  9:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-11 12:29 [PATCH 0/3] Improvements for mchp-pdmc Andrei Simion
2024-09-11 12:29 ` [PATCH 1/3] ASoC: atmel: mchp-pdmc: Improve maxburst calculation for better performance Andrei Simion
2024-09-11 12:29 ` [PATCH 2/3] ASoC: atmel: mchp-pdmc: Add snd_soc_dai_driver name Andrei Simion
2024-09-11 12:29 ` [PATCH 3/3] ASoC: atmel: mchp-pdmc: Retain Non-Runtime Controls Andrei Simion
2024-09-12  7:23   ` claudiu beznea
2024-09-12  9:53     ` Andrei Simion [this message]
2024-09-12 16:42 ` [PATCH 0/3] Improvements for mchp-pdmc Mark Brown

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=20240912095337.41507-1-andrei.simion@microchip.com \
    --to=andrei.simion@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=codrin.ciubotariu@microchip.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --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