From: Jonathan Cameron <jic23@jic23.retrosnub.co.uk>
To: Tomasz Duszynski <tduszyns@gmail.com>
Cc: Himanshu Jha <himanshujha199640@gmail.com>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH 2/3] iio: chemical: add support for Sensirion SPS30 sensor
Date: Sat, 1 Dec 2018 16:02:03 +0000 [thread overview]
Message-ID: <20181201160203.0b26e393@archlinux> (raw)
In-Reply-To: <20181126204803.GA19277@arch>
On Mon, 26 Nov 2018 21:48:07 +0100
Tomasz Duszynski <tduszyns@gmail.com> wrote:
> On Sun, Nov 25, 2018 at 04:14:34PM +0530, Himanshu Jha wrote:
> > On Sat, Nov 24, 2018 at 11:14:14PM +0100, Tomasz Duszynski wrote:
> > > Add support for Sensirion SPS30 particulate matter sensor.
> > >
> > > Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com>
> > > ---
> > > drivers/iio/chemical/Kconfig | 11 ++
> > > drivers/iio/chemical/Makefile | 1 +
> > > drivers/iio/chemical/sps30.c | 359 ++++++++++++++++++++++++++++++++++
> > > 3 files changed, 371 insertions(+)
> > > create mode 100644 drivers/iio/chemical/sps30.c
> >
> > []
> >
> > > +#define pr_fmt(fmt) "sps30: " fmt
> >
> > I don't see its usage ?
> >
>
> Hint: checkout how dev_err() is defined.
>
> > > +#include <linux/crc8.h>
> > > +#include <linux/delay.h>
> > > +#include <linux/i2c.h>
> > > +#include <linux/iio/buffer.h>
> > > +#include <linux/iio/iio.h>
> > > +#include <linux/iio/sysfs.h>
> > > +#include <linux/iio/trigger_consumer.h>
> > > +#include <linux/iio/triggered_buffer.h>
> > > +#include <linux/module.h>
> > > +
> > > +#define SPS30_CRC8_POLYNOMIAL 0x31
> > > +
> > > +/* SPS30 commands */
> > > +#define SPS30_START_MEAS 0x0010
> > > +#define SPS30_STOP_MEAS 0x0104
> > > +#define SPS30_RESET 0xd304
> > > +#define SPS30_READ_DATA_READY_FLAG 0x0202
> > > +#define SPS30_READ_DATA 0x0300
> > > +#define SPS30_READ_SERIAL 0xD033
> >
> > Could you please put a tab and align these macros.
> >
> > #define SPS30_START_MEAS 0x0010
> > #define SPS30_STOP_MEAS 0x0104
> >
>
> In my opinion this sort of alignment does not pay off in the long run.
> Adding a new definition, a slightly longer one perhaps, can easily break
> formatting.
>
> So I would stay with current one.
Personally I agree with you on this one. I don't care enough to
say either way though normally!
>
> >
> > > +static int sps30_write_then_read(struct sps30_state *state, u8 *buf,
> > > + int buf_size, u8 *data, int data_size)
> > > +{
> > > + /* every two received data bytes are checksummed */
> > > + u8 tmp[data_size + data_size / 2];
> >
> > No VLAs!
> >
> > https://lore.kernel.org/lkml/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qPXydAacU1RqZWA@mail.gmail.com/
> >
>
> Looks like -Wvla is some fairly recent addition to KBUILD_CFLAGS.
Yeah, that was only after a 'lot' of effort over years to get the number
present down to a small number.
I wrote plenty of them in the early days of IIO so got a lot of
those patches as part of the move to introducing the warning :)
Jonathan
...
next prev parent reply other threads:[~2018-12-02 3:14 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-24 22:14 [PATCH 0/3] add support for Sensirion SPS30 PM sensor Tomasz Duszynski
2018-11-24 22:14 ` [PATCH 1/3] iio: add IIO_MASSCONCENTRATION channel type Tomasz Duszynski
2018-11-25 8:35 ` Jonathan Cameron
2018-11-25 15:19 ` Tomasz Duszynski
2018-11-25 13:51 ` Matt Ranostay
2018-11-25 14:03 ` Jonathan Cameron
2018-11-25 14:14 ` Matt Ranostay
2018-11-25 15:44 ` Tomasz Duszynski
2018-12-01 15:48 ` Jonathan Cameron
2018-12-02 11:32 ` Matt Ranostay
2018-11-25 15:35 ` Tomasz Duszynski
2018-11-24 22:14 ` [PATCH 2/3] iio: chemical: add support for Sensirion SPS30 sensor Tomasz Duszynski
2018-11-25 8:56 ` Jonathan Cameron
2018-11-25 19:05 ` Tomasz Duszynski
2018-12-01 15:58 ` Jonathan Cameron
2018-12-03 10:30 ` Andreas Brauchli
2018-12-04 18:47 ` Tomasz Duszynski
2018-11-25 10:44 ` Himanshu Jha
2018-11-26 20:48 ` Tomasz Duszynski
2018-12-01 16:02 ` Jonathan Cameron [this message]
2018-11-24 22:14 ` [PATCH 3/3] iio: chemical: sps30: add device tree support Tomasz Duszynski
2018-11-25 8:59 ` Jonathan Cameron
2018-12-02 18:29 ` Tomasz Duszynski
2018-12-03 13:10 ` Jonathan Cameron
2018-11-26 4:11 ` kbuild test robot
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=20181201160203.0b26e393@archlinux \
--to=jic23@jic23.retrosnub.co.uk \
--cc=devicetree@vger.kernel.org \
--cc=himanshujha199640@gmail.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tduszyns@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).