Re: [PATCH v3 2/5] rtc: pcf2127: cleanup register and bit defines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 22/08/2019 15:19:33+0200, Bruno Thomsen wrote:
> Cleanup of defines to follow kernel coding style and increase code
> readability by using same register and bit define style.
> 
> Change PCF2127_REG_RAM_{addr_MSB,wrt_cmd,rd_cmd} to upper case as
> kernel coding guide section 12 'Macros, Enums and RTL' states
> "Names of macros defining constants and labels in enums are capitalized".
> 
> Improve readability of RAM register comment by making whole sentences.
> 
> Remove parentheses from register defines as they are only used
> for expressions and not constants.
> 
> As there are no clear style for name of registers and bits in the
> kernel drivers, I suggest the following for at least this driver,
> but hopefully also other RTC drivers.
> 
> Register name should follow this convention:
> [chip]_REG_[reg name] 0xXX
> 
> Bit name should follow this convention, so it clearly states which
> chip register it's part of:
> [chip]_BIT_[reg name]_[bit name] BIT(X)
> 
> Additionally I suggest bit defines are always placed right below
> its corresponding register define and using an extra tab indentation
> for the BIT(X) part. This will visualt make it easy to see that bit
> defines are part of the complete register definition.
> 
> Rename PCF2127_OSF to PCF2127_BIT_SC_OSF and move it right below
> PCF2127_REG_SC. This will improve readability of bit checks as it's
> easy to verify that it uses the correct register.
> 
> Move end of line comments above register defines as it's more like
> a heading for 1 register define and up to 8 bit defines or a
> collection of registers that are close related like timestamp
> split across 6 registers.
> 
> Signed-off-by: Bruno Thomsen <bruno.thomsen@xxxxxxxxx>
> ---
> v3: no change.
> v2: updated commit message.
> 
>  drivers/rtc/rtc-pcf2127.c | 59 ++++++++++++++++++++++-----------------
>  1 file changed, 33 insertions(+), 26 deletions(-)
> 
Applied, even if most of the churn is annoying. However, I agree
PCF2127_OSF should have been named differently.

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com



[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux