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

From: Linus Walleij
Date: Fri Sep 05 2014 - 04:00:57 EST


On Fri, Sep 5, 2014 at 4:09 AM, Chen, Alvin <alvin.chen@xxxxxxxxx> wrote:

>> > + 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;

NO because this is still a singleton variable. Put it into the
dynamically allocated structs.

> Comparing to allocate for each port
> dynamically, it is more directly and easy to understand.

No, I disagree. The overall design pattern in the kernel is to
allocate all state containers dynamically.

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/