All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: DelaySystem@tubot.lat
Cc: shyamsunderreddypadira@gmail.com, marusik.adamenko@gmail.com,
	rajveer.chaudhari.linux@gmail.com,
	parthiban.veerasooran@microchip.com,
	christian.gromm@microchip.com, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev
Subject: Re: [PATCH v2] staging: most: dim2: use atomic_t for channel state counters
Date: Wed, 18 Nov 2026 11:58:08 +0300	[thread overview]
Message-ID: <av1ooLApGizPA0tC@stanley.mountain> (raw)
In-Reply-To: <20261117-staging-dim2-atomic-v2-1-a550f0518043@tubot.lat>

On Tue, Nov 17, 2026 at 04:06:06PM -0800, Maximo Manriquez Lizarraga via B4 Relay wrote:
> @@ -682,8 +682,9 @@ static u8 channel_service(struct dim_channel *ch)
>  {
>  	struct int_ch_state *const state = &ch->state;
>  
> -	if (state->service_counter != state->request_counter) {
> -		state->service_counter++;
> +	if (atomic_read(&state->service_counter) !=
> +	    atomic_read(&state->request_counter)) {
> +		atomic_inc(&state->service_counter);


This isn't the right way to do it, because it's no longer atomic if
you do it as two steps.

regards,
dan carpenter




      reply	other threads:[~2026-11-18  8:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18  0:06 [PATCH v2] staging: most: dim2: use atomic_t for channel state counters Maximo Manriquez Lizarraga via B4 Relay
2026-11-18  0:06 ` Maximo Manriquez Lizarraga
2026-11-18  8:58 ` Dan Carpenter [this message]

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=av1ooLApGizPA0tC@stanley.mountain \
    --to=error27@gmail.com \
    --cc=DelaySystem@tubot.lat \
    --cc=christian.gromm@microchip.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=marusik.adamenko@gmail.com \
    --cc=parthiban.veerasooran@microchip.com \
    --cc=rajveer.chaudhari.linux@gmail.com \
    --cc=shyamsunderreddypadira@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.