Re: [PATCH v4 03/10] gpio: mxc: use for_each_set_bit() to iterate wakeup pads

From: Frank Li

Date: Thu Oct 08 2026 - 16:00:33 EST


On Wed, Oct 07, 2026 at 06:44:18PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@xxxxxxx>
>
> Use for_each_set_bit() to iterate over the enabled wakeup pads instead
> of checking every bit individually.
>
> Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
> ---

Reviewed-by: Frank Li <Frank.Li@xxxxxxx>

> drivers/gpio/gpio-mxc.c | 26 ++++++++++++--------------
> 1 file changed, 12 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
> index 627fff6f1886..1ff5c2afb2e8 100644
> --- a/drivers/gpio/gpio-mxc.c
> +++ b/drivers/gpio/gpio-mxc.c
> @@ -593,22 +593,20 @@ static bool mxc_gpio_set_pad_wakeup(struct mxc_gpio_port *port, bool enable)
> IMX_SCU_WAKEUP_LOW_LVL, /* IRQ_TYPE_LEVEL_LOW */
> };
>
> - for (i = 0; i < 32; i++) {
> - if ((port->wakeup_pads & (1 << i))) {
> - type = port->pad_type[i];
> - if (enable)
> - config = pad_type_map[type];
> - else
> - config = IMX_SCU_WAKEUP_OFF;
> -
> - if (is_imx8qm && config == IMX_SCU_WAKEUP_FALL_EDGE) {
> - dev_warn_once(port->dev,
> - "No falling-edge support for wakeup on i.MX8QM\n");
> - config = IMX_SCU_WAKEUP_OFF;
> - }
> + for_each_set_bit(i, &port->wakeup_pads, 32) {
> + type = port->pad_type[i];
> + if (enable)
> + config = pad_type_map[type];
> + else
> + config = IMX_SCU_WAKEUP_OFF;
>
> - ret |= mxc_gpio_generic_config(port, i, config);
> + if (is_imx8qm && config == IMX_SCU_WAKEUP_FALL_EDGE) {
> + dev_warn_once(port->dev,
> + "No falling-edge support for wakeup on i.MX8QM\n");
> + config = IMX_SCU_WAKEUP_OFF;
> }
> +
> + ret |= mxc_gpio_generic_config(port, i, config);
> }
>
> return ret;
>
> --
> 2.51.0
>
>