Re: [PATCH 3/3] GPIO: gpio-dwapb: Suspend & Resume PM enabling

From: Linus Walleij
Date: Thu Sep 04 2014 - 12:45:11 EST


On Wed, Aug 27, 2014 at 7:46 PM, Weike Chen <alvin.chen@xxxxxxxxx> wrote:

> This patch enables suspend and resume mode for the power management, and
> it is based on Josef Ahmad's previous work.
>
> Reviewed-by: Hock Leong Kweh <hock.leong.kweh@xxxxxxxxx>
> Reviewed-by: Shevchenko, Andriy <andriy.shevchenko@xxxxxxxxx>
> Signed-off-by: Weike Chen <alvin.chen@xxxxxxxxx>

(...)

> +#if defined CONFIG_PM_SLEEP

I wonder whether it's worth #ifdef:in out such things, it clutters
the place.

> +/* Store GPIO context across system-wide suspend/resume transitions */
> +static struct gpio_saved_regs {

Call the struct:

struct dwapb_context

because that is easier to understand.

> + unsigned long data;
> + unsigned long dir;
> + unsigned long int_en;
> + unsigned long int_mask;
> + unsigned long int_type;
> + unsigned long int_pol;
> + unsigned long int_deb;
> +} saved_regs;

Singleton huh?

Insert this into the dynamically allocated per-port or chip struct
instead.

+ dwapb_write(gpio, GPIO_SWPORTA_DR, saved_regs.data);
+ dwapb_write(gpio, GPIO_SWPORTA_DDR, saved_regs.dir);

And port B, C, D?

This looks like a crude hack.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/