From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Bruno Thomsen <bruno.thomsen@gmail.com>
Cc: linux-rtc@vger.kernel.org, linux-watchdog@vger.kernel.org,
a.zummo@towertech.it, wim@linux-watchdog.org, linux@roeck-us.net,
u.kleine-koenig@pengutronix.de, bth@kamstrup.com
Subject: Re: [PATCH v3 2/5] rtc: pcf2127: cleanup register and bit defines
Date: Thu, 22 Aug 2019 23:27:22 +0200 [thread overview]
Message-ID: <20190822212722.GH27031@piout.net> (raw)
In-Reply-To: <20190822131936.18772-2-bruno.thomsen@gmail.com>
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@gmail.com>
> ---
> 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
next prev parent reply other threads:[~2019-08-22 21:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-22 13:19 [PATCH v3 1/5] rtc: pcf2127: convert to devm_rtc_allocate_device Bruno Thomsen
2019-08-22 13:19 ` [PATCH v3 2/5] rtc: pcf2127: cleanup register and bit defines Bruno Thomsen
2019-08-22 21:27 ` Alexandre Belloni [this message]
2019-08-22 13:19 ` [PATCH v3 3/5] rtc: pcf2127: bugfix: read rtc disables watchdog Bruno Thomsen
2019-08-22 21:28 ` Alexandre Belloni
2019-08-22 13:19 ` [PATCH v3 4/5] rtc: pcf2127: add watchdog feature support Bruno Thomsen
2019-08-22 14:11 ` Guenter Roeck
2019-08-22 21:28 ` Alexandre Belloni
2020-07-16 14:47 ` Uwe Kleine-König
2020-07-16 18:18 ` Alexandre Belloni
2020-07-17 6:21 ` Uwe Kleine-König
2019-08-22 13:19 ` [PATCH v3 5/5] rtc: pcf2127: add tamper detection support Bruno Thomsen
2019-08-22 21:29 ` Alexandre Belloni
2019-08-22 21:26 ` [PATCH v3 1/5] rtc: pcf2127: convert to devm_rtc_allocate_device Alexandre Belloni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190822212722.GH27031@piout.net \
--to=alexandre.belloni@bootlin.com \
--cc=a.zummo@towertech.it \
--cc=bruno.thomsen@gmail.com \
--cc=bth@kamstrup.com \
--cc=linux-rtc@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=u.kleine-koenig@pengutronix.de \
--cc=wim@linux-watchdog.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).