[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdYZ0W4+iGyP5bbARAAfrqcrG77PVCHKcGhnBXvpCHoqxw@mail.gmail.com>
Date: Fri, 5 Sep 2014 10:00:51 +0200
From: Linus Walleij <linus.walleij@...aro.org>
To: "Chen, Alvin" <alvin.chen@...el.com>
Cc: Alexandre Courbot <gnurou@...il.com>,
Grant Likely <grant.likely@...aro.org>,
Rob Herring <robh+dt@...nel.org>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"Ong, Boon Leong" <boon.leong.ong@...el.com>,
"Shevchenko, Andriy" <andriy.shevchenko@...el.com>,
"Westerberg, Mika" <mika.westerberg@...el.com>,
"Kweh, Hock Leong" <hock.leong.kweh@...el.com>,
Darren Hart <dvhart@...ux.intel.com>
Subject: Re: [PATCH 3/3] GPIO: gpio-dwapb: Suspend & Resume PM enabling
On Fri, Sep 5, 2014 at 4:09 AM, Chen, Alvin <alvin.chen@...el.com> 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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists