From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: "Rafał Miłecki" <rafal@milecki.pl>
Cc: "Rafał Miłecki" <zajec5@gmail.com>,
"Rob Herring" <robh+dt@kernel.org>,
"Linus Walleij" <linus.walleij@linaro.org>,
"Álvaro Fernández Rojas" <noltari@gmail.com>,
"Jonas Gorski" <jonas.gorski@gmail.com>,
"Randy Dunlap" <rdunlap@infradead.org>,
"Florian Fainelli" <f.fainelli@gmail.com>,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
devicetree <devicetree@vger.kernel.org>,
bcm-kernel-feedback-list <bcm-kernel-feedback-list@broadcom.com>
Subject: Re: [PATCH 2/2] pinctrl: bcm: add driver for BCM4908 pinmux
Date: Wed, 22 Dec 2021 14:12:11 +0200 [thread overview]
Message-ID: <CAHp75Vd3npYTP7etoBdOL1UbXYqJZ1qhPzft+hspUmUib0bppQ@mail.gmail.com> (raw)
In-Reply-To: <c17724bc-2d5a-7c70-4aea-899ff3665b73@milecki.pl>
On Wed, Dec 22, 2021 at 12:19 PM Rafał Miłecki <rafal@milecki.pl> wrote:
> On 16.12.2021 20:55, Andy Shevchenko wrote:
> >> +/*
> >> + * Copyright (C) 2021 Rafał Miłecki <rafal@milecki.pl>
> >> + */
> >
> > One line?
>
> I don't think there's a rule for that. Not in coding-style.rst as much
> as I'm aware of. checkpatch.pl also doesn't complain.
There is no rule, but common sense. Why occupy 3 LOCs instead of 1 LOC?
...
> >> +#include <linux/pinctrl/pinconf-generic.h>
> >> +#include <linux/pinctrl/pinctrl.h>
> >> +#include <linux/pinctrl/pinmux.h>
> >
> > Can you move this group...
> >
> >> +#include <linux/platform_device.h>
> >> +#include <linux/slab.h>
> >
> > ...here?
>
> Any reason for that? For most of the time I keep my includes sorted
> alphabetically. Now I checked coding-style.rst is actually seems to
> recomment "clang-format" for the same reason: sorting includes.
Yes. The reason is simple. With moving this group separately you
follow the rule of going from most generic to most particular headers
in the block. Grouping like this will show better that this code has
tighten relations with the pin control subsystem.
...
> >> +#define TEST_PORT_BLOCK_EN_LSB 0x00
> >> +#define TEST_PORT_BLOCK_DATA_MSB 0x04
> >> +#define TEST_PORT_BLOCK_DATA_LSB 0x08
> >> +#define TEST_PORT_LSB_PINMUX_DATA_SHIFT 12
> >> +#define TEST_PORT_COMMAND 0x0c
> >> +#define TEST_PORT_CMD_LOAD_MUX_REG 0x00000021
> >
> > The prefix of all above doesn't match the module name.
>
> Those are register names as in Broadcom's documentation. I don't think
> those names can conflict with any included header defines but I can
> change it.
They may easily conflict through headers with something more generic
not related to your driver or even GPIO. The TEST_PORT_COMMAND seems
one of this kind that might potentially collide.
...
> >> +
> >
> > Here and everywhere else, please drop redundant blank line.
>
> No clear kernel rule for that.
>
> I use blank line to indicate / suggest that comment applies to more than
> just a single line that follows.
Maybe these comments are not so useful after all?
...
> >> +
> >
> > No need.
> >
> >> +module_platform_driver(bcm4908_pinctrl_driver);
>
> You have 1344 other source files with empty line above
> module_platform_driver(). coding-style.rst says to "separate functions
> with one blank line". Are we supposed to argue now whether a macro can
> be considered a functio nor not?
>
> grep -B 1 -r "module_platform_driver" drivers/* | egrep -c "\.c-$"
> 1344
Same as above, common sense and the tight relationship between two.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2021-12-22 12:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-15 20:47 [PATCH 1/2] dt-bindings: pinctrl: Add binding for BCM4908 pinctrl Rafał Miłecki
2021-12-15 20:47 ` [PATCH 2/2] pinctrl: bcm: add driver for BCM4908 pinmux Rafał Miłecki
2021-12-16 6:34 ` kernel test robot
2021-12-16 14:26 ` kernel test robot
2021-12-16 19:55 ` Andy Shevchenko
2021-12-22 10:19 ` Rafał Miłecki
2021-12-22 12:12 ` Andy Shevchenko [this message]
2021-12-15 22:27 ` [PATCH 1/2] dt-bindings: pinctrl: Add binding for BCM4908 pinctrl Rob Herring
2021-12-15 22:35 ` Rafał Miłecki
2021-12-16 15:32 ` Rob Herring
2021-12-16 15:35 ` Rob Herring
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=CAHp75Vd3npYTP7etoBdOL1UbXYqJZ1qhPzft+hspUmUib0bppQ@mail.gmail.com \
--to=andy.shevchenko@gmail.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=devicetree@vger.kernel.org \
--cc=f.fainelli@gmail.com \
--cc=jonas.gorski@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=noltari@gmail.com \
--cc=rafal@milecki.pl \
--cc=rdunlap@infradead.org \
--cc=robh+dt@kernel.org \
--cc=zajec5@gmail.com \
/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).