From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Ivan Mikhaylov <i.mikhaylov@yadro.com>,
Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
linux-iio <linux-iio@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
devicetree <devicetree@vger.kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Rob Herring <robh+dt@kernel.org>
Subject: Re: [PATCH v6 2/2] iio: proximity: Add driver support for vcnl3020 proximity sensor
Date: Sun, 5 Apr 2020 11:13:41 +0100 [thread overview]
Message-ID: <20200405111341.0912468d@archlinux> (raw)
In-Reply-To: <CAHp75VdaM_pumyWyeHJxCQXrKUAW=ktJme1uYxH0w4e9an0X2A@mail.gmail.com>
On Thu, 2 Apr 2020 15:42:02 +0300
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> On Thu, Apr 2, 2020 at 11:24 AM Ivan Mikhaylov <i.mikhaylov@yadro.com> wrote:
> >
> > On Wed, 2020-04-01 at 19:35 +0300, Andy Shevchenko wrote:
> > > On Wed, Apr 1, 2020 at 7:24 PM Ivan Mikhaylov <i.mikhaylov@yadro.com> wrote:
> > > > Proximity sensor driver based on light/vcnl4000.c code.
> > > > For now supports only the single on-demand measurement.
> > > >
> > > > The VCNL3020 is a fully integrated proximity sensor. Fully
> > > > integrated means that the infrared emitter is included in the
> > > > package. It has 16-bit resolution. It includes a signal
> > > > processing IC and features standard I2C communication
> > > > interface. It features an interrupt function.
> > >
> > > Thank you for an update, my comments below.
> > >
> > > ...
> > >
> > > > +static int get_and_apply_property(struct vcnl3020_data *data, const char
> > > > *prop,
> > > > + u32 reg)
> > > > +{
> > > > + int rc;
> > > > + u32 val;
> > > > +
> > > > + rc = device_property_read_u32(data->dev, prop, &val);
> > > > + if (rc)
> > > > + return 0;
> > > > +
> > > > + rc = regmap_write(data->regmap, reg, val);
> > > > + if (rc)
> > > > + dev_err(data->dev, "Error (%d) setting property (%s)",
> > > > + rc, prop);
> > >
> > > This requires {} according to the coding style
> >
> > checkpatch.pl doesn't say anything bad on this spot. Do you mean to make
> > something like this?
> >
> > rc = regmap_write(data->regmap, reg, val);
> > if (rc) {
> > dev_err(data->dev, "Error (%d) setting property (%s)",
> > rc, prop);
> > }
>
> Yes. Checkpatch is neither strict nor fully comprehensive tool.
>
> > In previous notes you said to remove them.
>
> When it's one line, it fine, otherwise you need {} surround.
>
> https://www.kernel.org/doc/html/latest/process/coding-style.html#placing-braces-and-spaces
>
> > > > + return rc;
> > > > +}
> > >
> > > ...
> > >
> > > > +static int vcnl3020_probe(struct i2c_client *client)
> > > > +{
> > > > + indio_dev->name = VCNL_DRV_NAME;
> > >
> > > It's definitely not a driver name. You have to put part number here.
> >
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/iio/light/tsl4531.c?h=v5.6#n199
That one is actually fine (if not very pretty) because the driver only supports one part and it happens
to also be the name of the driver.
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/iio/light/max44009.c?h=v5.6#n507
Also only one part supported, so fine if liable to accidentally get broken if we support more parts.
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/iio/light/vl6180.c?h=v5.6#n515
Again, one part supported and the driver has the same name.
>
> Let's Jonathan speak up.
So, the real point here is not the value being assigned but the fact it's
explicitly linked to the name of the driver. I'd argue that you could use
VCNL_NAME as the define and that link is clearly broken. Or just put the string
inline in both places and don't worry about the tiny bit of replication!
Jonathan
>
next prev parent reply other threads:[~2020-04-05 10:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-01 16:24 [PATCH v6 0/2] iio: proximity: driver for vcnl3020 Ivan Mikhaylov
2020-04-01 16:24 ` [PATCH v6 1/2] iio: proximity: provide device tree binding document Ivan Mikhaylov
2020-04-01 16:24 ` [PATCH v6 2/2] iio: proximity: Add driver support for vcnl3020 proximity sensor Ivan Mikhaylov
2020-04-01 16:35 ` Andy Shevchenko
2020-04-02 8:24 ` Ivan Mikhaylov
2020-04-02 12:42 ` Andy Shevchenko
2020-04-05 10:13 ` Jonathan Cameron [this message]
2020-04-05 10:38 ` Andy Shevchenko
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=20200405111341.0912468d@archlinux \
--to=jic23@kernel.org \
--cc=andy.shevchenko@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=i.mikhaylov@yadro.com \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=pmeerw@pmeerw.net \
--cc=robh+dt@kernel.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