From: Ivan Mikhaylov <i.mikhaylov@yadro.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
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 2/2] iio: proximity: Add driver support for vcnl3020 proximity sensor
Date: Tue, 24 Mar 2020 14:52:30 +0300 [thread overview]
Message-ID: <321453af40ca49839bc7b9d1c65b828841492f72.camel@yadro.com> (raw)
In-Reply-To: <CAHp75Ve4rejBKjG+mioRL3S7i3meyy=_4TtW1fr2aGvnVn2tBA@mail.gmail.com>
On Mon, 2020-03-23 at 14:10 +0200, Andy Shevchenko wrote:
> On Mon, Mar 23, 2020 at 12:41 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 a patch, my comments below.
>
> > Datasheet available at:
> > http://www.vishay.com/docs/84150/vcnl3020.pdf
>
> I'm thinking that we may simple introduce new tag, called Datesheet:
> to put such links.
>
> > Signed-off-by: Ivan Mikhaylov <i.mikhaylov@yadro.com>
>
> ...
>
> > obj-$(CONFIG_SRF08) += srf08.o
> > obj-$(CONFIG_SX9500) += sx9500.o
> > obj-$(CONFIG_VL53L0X_I2C) += vl53l0x-i2c.o
> > +obj-$(CONFIG_VCNL3020) += vcnl3020.o
>
> Perhaps keep ordered?
Oops.
>
> ...
>
> > +static int32_t vcnl3020_init(struct vcnl3020_data *data)
>
> int32_t...
>
> > +{
> > + s32 rc;
>
> ...s32?!
>
> Applies to entire code.
checkpatch.pl --strict doesn't show anything bad in it but I can change from
int32_t/s32 into int easily, it's not a problem for me.
>
> > + u32 led_current;
> > + struct device *dev = &data->client->dev;
>
> Reversed xmas tree order looks better.
>
> > + rc = i2c_smbus_read_byte_data(data->client, VCNL_PROD_REV);
>
> Can you use regmap I²C API?
>
That's a nice idea.
> ...
>
> > + dev_info(&client->dev, "Proximity sensor, Rev: %02x\n",
> > + data->rev);
>
> Noise.
Doesn't it help to determine the presence of driver to a common user?
>
> > + goto out;
> > +
> > + return rc;
> > +out:
> > + devm_iio_device_free(&client->dev, indio_dev);
> > + return rc;
>
> Managed resources are exactly for this not to be appeared in the code.
I can do something like this:
return devm_iio_device_register(&client->dev, indio_dev);
Would it suffice?
>
> > +}
>
> ...
>
> > +static const struct of_device_id vcnl3020_of_match[] = {
> > + {
> > + .compatible = "vishay,vcnl3020",
> > + },
>
> Missed terminator. How did you test this?
All works fine with real hw, I'll add terminator.
Agree with everything else.
Thanks.
next prev parent reply other threads:[~2020-03-24 11:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-23 10:39 [PATCH 0/2] iio: proximity: driver for vcnl3020 Ivan Mikhaylov
2020-03-23 10:39 ` [PATCH 1/2] iio: proximity: provide device tree binding document Ivan Mikhaylov
2020-03-23 10:39 ` [PATCH 2/2] iio: proximity: Add driver support for vcnl3020 proximity sensor Ivan Mikhaylov
2020-03-23 12:10 ` Andy Shevchenko
2020-03-24 11:52 ` Ivan Mikhaylov [this message]
2020-03-24 12:03 ` 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=321453af40ca49839bc7b9d1c65b828841492f72.camel@yadro.com \
--to=i.mikhaylov@yadro.com \
--cc=andy.shevchenko@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=jic23@kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).