mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kent Gibson <warthog618@gmail.com>
To: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Cc: Linus Walleij <linusw@kernel.org>,
	Bartosz Golaszewski <brgl@kernel.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Adrian Ambrozewicz <aambrozewicz@nvidia.com>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH v3 0/5] gpiolib: improve concurrent access to the flags field of struct gpio_desc
Date: Fri, 13 Nov 2026 17:52:43 +0800	[thread overview]
Message-ID: <20261113095243.GA103672@rigel> (raw)
In-Reply-To: <20261110-gpio-desc-flags-atomic-v3-0-2f463bce8086@oss.qualcomm.com>

On Tue, Nov 10, 2026 at 02:47:00PM +0100, Bartosz Golaszewski wrote:
> This is a follow-up to our discussion[1] about desc->flags and possible
> races with users who don't/can't synchronize with other means.
> 
> It's an attempt to use try_cmpxchg() to update only the required flags
> atomically where needed + minor fixes using atomic variants of bitops
> where it makes sense.
> 
> [1] https://lore.kernel.org/all/20261015153714.GA105746@rigel/
> 
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
> ---
> Changes in v3:
> - Don't pull in bitops.h when including bitmap.h
> - Improve coding style: fix indentation, set mask later in the function,
>   make lines longer and more readable
> - Use the right Fixes tags
> - Link to v2: https://patch.msgid.link/20261109-gpio-desc-flags-atomic-v2-0-c4c54b476628@oss.qualcomm.com
> 
> Changes in v2:
> - Drop the custom gpiod_update_flags() function and use the existing
>   set_mask_bits() macro instead
> - Add a patch clearing debounce_period_us before GPIOD_FLAG_REQUESTED as
>   suggested by Kent
> - Rename the functions updating flags in gpiolib-cdev.c
> - Don't rename the flags variable
> - Link to v1: https://patch.msgid.link/20261104-gpio-desc-flags-atomic-v1-0-e23cedf619ba@oss.qualcomm.com
> 
> ---
> Bartosz Golaszewski (5):
>       gpiolib: don't overwrite the entire flags field in gpiod_get_direction()
>       gpio: shared: use atomic set_bit() for descriptor flags
>       gpiolib: clear debounce period before the "requested" flag
>       gpiolib: don't overwrite the entire flags field in gpiod_free_commit()
>       gpio: cdev: don't overwrite the whole flags field when configuring lines
> 
>  drivers/gpio/gpiolib-cdev.c   | 93 +++++++++++++++++++++----------------------
>  drivers/gpio/gpiolib-shared.c |  5 +--
>  drivers/gpio/gpiolib.c        | 35 ++++++++--------
>  3 files changed, 65 insertions(+), 68 deletions(-)
> ---
> base-commit: 630059a5a632377b9b7b487baccde92b7ae1dd47
> change-id: 20261104-gpio-desc-flags-atomic-cc963a1ccfd0
> 
> Best regards,
> -- 
> Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
> 

Reviewed-by: Kent Gibson <warthog618@gmail.com>

Cheers,
Kent.

  parent reply	other threads:[~2026-11-13  9:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 13:47 Bartosz Golaszewski
2026-11-10 13:47 ` [PATCH v3 1/5] gpiolib: don't overwrite the entire flags field in gpiod_get_direction() Bartosz Golaszewski
2026-11-10 13:47 ` [PATCH v3 2/5] gpio: shared: use atomic set_bit() for descriptor flags Bartosz Golaszewski
2026-11-10 13:47 ` [PATCH v3 3/5] gpiolib: clear debounce period before the "requested" flag Bartosz Golaszewski
2026-11-10 13:47 ` [PATCH v3 4/5] gpiolib: don't overwrite the entire flags field in gpiod_free_commit() Bartosz Golaszewski
2026-11-10 13:47 ` [PATCH v3 5/5] gpio: cdev: don't overwrite the whole flags field when configuring lines Bartosz Golaszewski
2026-11-13  3:19   ` Kent Gibson
2026-11-13  8:34     ` Bartosz Golaszewski
2026-11-13  9:52 ` Kent Gibson [this message]
2026-11-13 10:36 ` [PATCH v3 0/5] gpiolib: improve concurrent access to the flags field of struct gpio_desc Bartosz Golaszewski

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=20261113095243.GA103672@rigel \
    --to=warthog618@gmail.com \
    --cc=aambrozewicz@nvidia.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bartosz.golaszewski@oss.qualcomm.com \
    --cc=brgl@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®