[U-Boot] [PATCH 15/23] gpio: eg20t: Add driver for Intel EG20T GPIO controllers

Simon Glass sjg at chromium.org
Wed Sep 28 00:17:35 CEST 2016


Hi Paul,

On 27 September 2016 at 02:21, Paul Burton <paul.burton at imgtec.com> wrote:
> On Monday, 26 September 2016 18:35:32 BST Simon Glass wrote:
>
>> > +enum {
>
>> > + REG_IEN = 0x00,
>
>> > + REG_ISTATUS = 0x04,
>
>> > + REG_IDISP = 0x08,
>
>> > + REG_ICLR = 0x0c,
>
>> > + REG_IMASK = 0x10,
>
>> > + REG_IMASKCLR = 0x14,
>
>> > + REG_PO = 0x18,
>
>> > + REG_PI = 0x1c,
>
>> > + REG_PM = 0x20,
>
>>
>
>> How about using a struct?
>
>
>
> Hi Simon,
>
>
>
> Interesting - I was told over here[1] that using structs for register access
> was "deprecated".
>
>
>
> [1] https://www.mail-archive.com/u-boot@lists.denx.de/msg220500.html
>
>
>
> ...so I actually converted the driver away from that style before
> submitting. Yet both yourself & Bin have suggested it - shall I take it that
> it's not deprecated after all?

Well I try to use it when possible, as does Bin. It reads better and
we may as well use the features of C. It can't be used if register
offsets differ (e.g. a driver needs to deal with registers being 4
bytes apart on one machine and 8 on another). But in general I think
it is preferable to offsets.

Regards,
Simon


More information about the U-Boot mailing list