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

From: Chen, Alvin
Date: Thu Sep 04 2014 - 22:09:33 EST


>
> > +#if defined CONFIG_PM_SLEEP
>
> I wonder whether it's worth #ifdef:in out such things, it clutters the place.
OK. I will use '#ifdef'.
>
> > +/* 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.
>
OK.

> > + 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.
>
How about the following?

static struct dwapb_context {
u32 data[DWAPB_MAX_PORTS];
u32 dir[DWAPB_MAX_PORTS];
u32 ext[DWAPB_MAX_PORTS];
u32 int_en;
u32 int_mask;
u32 int_type;
u32 int_pol;
u32 int_deb;
} dwapb_context;

Since only portA can support irq, and the irq related registers are only for portA. Comparing to allocate for each port
dynamically, it is more directly and easy to understand.


> + 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.
I will add port B, C, D.
>
> Yours,
> Linus Walleij
N‹§²æ¸›yú²X¬¶ÇvØ–)Þ{.nlj·¥Š{±‘êX§¶›¡Ü}©ž²ÆzÚj:+v‰¨¾«‘êZ+€Êzf£¢·hšˆ§~†­†Ûÿû®w¥¢¸?™¨è&¢)ßf”ùy§m…á«a¶Úÿ 0¶ìå