Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1375598 > unrolled thread

Re: [PATCH v3 02/16] mfd: da8xx-cfgchip: New header file for CFGCHIP registers.

Started bySekhar Nori <nsekhar@ti.com>
First post2016-04-11 10:30 +0200
Last post2016-04-11 10:30 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v3 02/16] mfd: da8xx-cfgchip: New header file for CFGCHIP  registers. Sekhar Nori <nsekhar@ti.com> - 2016-04-11 10:30 +0200

#1375598 — Re: [PATCH v3 02/16] mfd: da8xx-cfgchip: New header file for CFGCHIP registers.

FromSekhar Nori <nsekhar@ti.com>
Date2016-04-11 10:30 +0200
SubjectRe: [PATCH v3 02/16] mfd: da8xx-cfgchip: New header file for CFGCHIP registers.
Message-ID<rmFon-2Ng-11@gated-at.bofh.it>
On Monday 28 March 2016 10:12 PM, Sergei Shtylyov wrote:
> Hello.
> 
> On 03/28/2016 06:02 PM, David Lechner wrote:
> 
>>>> +/* register offsets */
>>>> +#define CFGCHIP_REG(n)                (n * 4)
>>>> +#define CFGCHIP0_REG                CFGCHIP_REG(0)
>>>> +#define CFGCHIP1_REG                CFGCHIP_REG(1)
>>>> +#define CFGCHIP2_REG                CFGCHIP_REG(2)
>>>> +#define CFGCHIP3_REG                CFGCHIP_REG(3)
>>>> +#define CFGCHIP4_REG                CFGCHIP_REG(4)
>>>
>>>     Why not just use CFGCHIP_REG(n) directly?
>>
>> I considered that, but I went this way because A) the TRM uses, for
>> example,
>> "CFGCHIP2", so I wanted to keep "CFGCHIP" and "2" together

IMO, this is not that big of an issue. Anyone reading should be able to
make out that CFGCHIP_REG(0) is same as CFGCHIP0 referred to in the TRM.

> 
>    I'd just drop the _REG suffix.
> 
>> and B) this tells
>> you how many CFGCHIP registers there are, i.e. there is no CFGCHIP5_REG.
> 
>    You can tell that in a comment. Having a parametrized macro and using
> it to just #define more macros doesn't appeal to me at all...

Agree with Sergei, I don't prefer the additional #defines as well.

Regards,
Sekhar

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web