Re: [PATCH v6 03/13] gpio: mxc: fix wakeup_pads bit operations
From: Andy Shevchenko
Date: Mon Oct 12 2026 - 05:16:19 EST
On Sun, Oct 11, 2026 at 2:54 PM Peng Fan (OSS) <peng.fan@xxxxxxxxxxx> wrote:
>
> gpio_set_wake_irq() can be called concurrently for different pins on
> the same port, so use atomic bitops when modifying wakeup_pads.
The code doesn't modify any reader part of this member. So, the above
paragraph is incorrect, right? Otherwise it needs to be clarified how
assign_bit() does change anything.
> wakeup_pads is a u32, while assign_bit() operates on unsigned long
> pointers. On 64-bit platforms, this causes an 8-byte read-modify-write
> on a 4-byte field, corrupting the adjacent is_pad_wakeup. So change
> wakeup_pads to unsigned long and reorder to avoid wasting words.
>
> And fix the enable/disable path unconditionally sets/clears the
> wakeup_pads bit even when enable_irq_wake()/disable_irq_wake() fails.
> Only update the bit on success.
--
With Best Regards,
Andy Shevchenko