From: sashiko-bot@kernel.org
To: "Bartosz Golaszewski" <bartosz.golaszewski@oss.qualcomm.com>
Cc: linux-gpio@vger.kernel.org
Subject: Re: [PATCH v2 4/5] gpiolib: don't overwrite the entire flags field in gpiod_free_commit()
Date: Mon, 09 Nov 2026 10:32:24 +0000 [thread overview]
Message-ID: <sashiko-outbox-204825@kernel.org> (raw)
In-Reply-To: <20261109-gpio-desc-flags-atomic-v2-4-c4c54b476628@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] gpiolib: commit message and indentation reference
gpiod_update_flags()
--
commit 8c916355e1aeab892f0c8dc4d52c44c7d5dcf4e9
Author: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
gpiolib: don't overwrite the entire flags field in gpiod_free_commit()
This commit replaces the non-atomic clear_bit() sequence and WRITE_ONCE()
on desc->flags in gpiod_free_commit() with an atomic set_mask_bits() call.
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index af2d67d977f49..4c9c524389ca1 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
[ ... ]
> @@ -2696,24 +2697,23 @@ void gpiod_free_commit(struct gpio_desc *desc)
> #ifdef CONFIG_GPIO_CDEV
> WRITE_ONCE(desc->debounce_period_us, 0);
> #endif
> -
> - clear_bit(GPIOD_FLAG_ACTIVE_LOW, &flags);
> - clear_bit(GPIOD_FLAG_REQUESTED, &flags);
> - clear_bit(GPIOD_FLAG_OPEN_DRAIN, &flags);
> - clear_bit(GPIOD_FLAG_OPEN_SOURCE, &flags);
> - clear_bit(GPIOD_FLAG_PULL_UP, &flags);
> - clear_bit(GPIOD_FLAG_PULL_DOWN, &flags);
> - clear_bit(GPIOD_FLAG_BIAS_DISABLE, &flags);
> - clear_bit(GPIOD_FLAG_EDGE_RISING, &flags);
> - clear_bit(GPIOD_FLAG_EDGE_FALLING, &flags);
> - clear_bit(GPIOD_FLAG_EVENT_CLOCK_REALTIME, &flags);
> - clear_bit(GPIOD_FLAG_EVENT_CLOCK_HTE, &flags);
> - clear_bit(GPIOD_FLAG_IS_HOGGED, &flags);
> #ifdef CONFIG_OF_DYNAMIC
> WRITE_ONCE(desc->hog, NULL);
> #endif
> desc_set_label(desc, NULL);
> - WRITE_ONCE(desc->flags, flags);
> + set_mask_bits(&desc->flags,
> + BIT(GPIOD_FLAG_ACTIVE_LOW) |
> + BIT(GPIOD_FLAG_REQUESTED) |
> + BIT(GPIOD_FLAG_OPEN_DRAIN) |
> + BIT(GPIOD_FLAG_OPEN_SOURCE) |
> + BIT(GPIOD_FLAG_PULL_UP) |
> + BIT(GPIOD_FLAG_PULL_DOWN) |
> + BIT(GPIOD_FLAG_BIAS_DISABLE) |
> + BIT(GPIOD_FLAG_EDGE_RISING) |
> + BIT(GPIOD_FLAG_EDGE_FALLING) |
> + BIT(GPIOD_FLAG_EVENT_CLOCK_REALTIME) |
> + BIT(GPIOD_FLAG_EVENT_CLOCK_HTE) |
> + BIT(GPIOD_FLAG_IS_HOGGED), 0);
> gpiod_line_state_notify(desc, GPIO_V2_LINE_CHANGED_RELEASED);
> }
> }
[Severity: Low]
This isn't a bug, but the commit message says gpiod_update_flags() is used
here, whereas the code calls set_mask_bits(). The BIT(GPIOD_FLAG_*)
continuation lines are also still indented to align with the opening
parenthesis of gpiod_update_flags() rather than set_mask_bits().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261109-gpio-desc-flags-atomic-v2-0-c4c54b476628@oss.qualcomm.com?part=4
next prev parent reply other threads:[~2026-11-09 10:32 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 10:27 [PATCH v2 0/5] gpiolib: improve concurrent access to the flags field of struct gpio_desc Bartosz Golaszewski
2026-11-09 10:27 ` [PATCH v2 1/5] gpiolib: don't overwrite the entire flags field in gpiod_get_direction() Bartosz Golaszewski
2026-11-09 10:27 ` [PATCH v2 2/5] gpio: shared: use atomic set_bit() for descriptor flags Bartosz Golaszewski
2026-11-09 10:34 ` sashiko-bot
2026-11-09 10:27 ` [PATCH v2 3/5] gpiolib: clear debounce period before the "requested" flag Bartosz Golaszewski
2026-11-09 10:37 ` sashiko-bot
2026-11-09 10:27 ` [PATCH v2 4/5] gpiolib: don't overwrite the entire flags field in gpiod_free_commit() Bartosz Golaszewski
2026-11-09 10:32 ` sashiko-bot [this message]
2026-11-09 21:53 ` Andy Shevchenko
2026-11-10 8:54 ` Bartosz Golaszewski
2026-11-10 10:06 ` Andy Shevchenko
2026-11-10 11:05 ` Joshua Crofts
2026-11-09 10:27 ` [PATCH v2 5/5] gpio: cdev: don't overwrite the whole flags field when configuring lines Bartosz Golaszewski
2026-11-09 21:58 ` Andy Shevchenko
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=sashiko-outbox-204825@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bartosz.golaszewski@oss.qualcomm.com \
--cc=linux-gpio@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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