lkml.org 
[lkml]   [2018]   [Apr]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 13/14] Move ad7746 out of staging
From
Date
On Sun, 2018-04-15 at 18:04 +0100, Jonathan Cameron wrote:
> On Fri, 13 Apr 2018 13:36:50 -0300
> Hernán Gonzalez <hernan@vanguardiasur.com.ar> wrote:
>
> > Signed-off-by: Hernán Gonzalez <hernan@vanguardiasur.com.ar>
>
> A few comments inline.

And a trivial typo and other bits

> > diff --git a/drivers/iio/cdc/Makefile b/drivers/iio/cdc/Makefile
[]
> > @@ -0,0 +1,5 @@
> > +#
> > +#Makeefile for industrial I/O CDC drivers

Makefile

> > diff --git a/drivers/iio/cdc/ad7746.c b/drivers/iio/cdc/ad7746.c
[]
> > @@ -0,0 +1,855 @@

Perhaps use the SPDX tags

> > +/*
> > + * AD7746 capacitive sensor driver supporting AD7745, AD7746 and AD7747
> > + *
> > + * Copyright 2011 Analog Devices Inc.
> > + *
> > + * Licensed under the GPL-2.
> > + */

[]

> > +static const struct iio_chan_spec ad7746_channels[] = {
> > + [VIN] = {
> > + .type = IIO_VOLTAGE,
> > + .indexed = 1,
> > + .channel = 0,
> > + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
> > + .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) |
> > + BIT(IIO_CHAN_INFO_SAMP_FREQ),
> > + .address = AD7746_REG_VT_DATA_HIGH << 8 |
> > + AD7746_VTSETUP_VTMD_EXT_VIN,
>
> Hmm. I never like to see a single location used to hold two different things.
> I would suggest perhaps having address be an enum then have have a lookup
> into an array of structures that have the two elements separately.
> (use the ad7746_chan enum again for this?)

And perhaps it's nicer to align the multiple
BIT(identifier) uses like

.info_mask_shared_by_type = (BIT(IIO_CHAN_INFO_SCALE) |
BIT(IIO_CHAN_INFO_SAMP_FREQ)),

The extra unnecessary parentheses allow at least emacs
to align the BIT uses properly.

[]

> > + [CIN1] = {
> > + .type = IIO_CAPACITANCE,
> > + .indexed = 1,
> > + .channel = 0,
> > + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
> > + BIT(IIO_CHAN_INFO_CALIBSCALE) | BIT(IIO_CHAN_INFO_OFFSET),
> > + .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_CALIBBIAS) |
> > + BIT(IIO_CHAN_INFO_SCALE) | BIT(IIO_CHAN_INFO_SAMP_FREQ),
> > + .address = AD7746_REG_CAP_DATA_HIGH << 8,
> > + },

So this one could be:

.info_mask_shared_by_type = (BIT(IIO_CHAN_INFO_CALIBBIAS) |
BIT(IIO_CHAN_INFO_SCALE) |
BIT(IIO_CHAN_INFO_SAMP_FREQ)),

etc...


\
 
 \ /
  Last update: 2018-04-15 20:47    [W:0.042 / U:4.008 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site