Re: [PATCH v2 2/2] iio: light: as73211: New driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Andy,

thanks for the extensive review. Almost all of you comments will be integrated 
into v3. 

On Tuesday, 28 July 2020, 20:00:31 CEST, Andy Shevchenko wrote:
> On Tue, Jul 28, 2020 at 9:32 AM Christian Eggers <ceggers@xxxxxxx> wrote:

> > +       if (data->client->irq)
> > +               init_completion(&data->completion);
> I believe it should be reinit_completion().
added missing init_completion() in probe().

> > +       /* During measurement, there should be no traffic on the i2c bus 
*/
> > +       i2c_lock_bus(data->client->adapter, I2C_LOCK_SEGMENT);
> Hmm.. Really?
yes. According to the datasheet, the device is very sensitive to external 
noise
during measurement.

> > +               *val = (1 << (data->creg3 & 0b11)) * 1024 * 1000;
> 
> BIT()? GENMASK() ? 1000 I believe defined already.
Please recheck in v3. What shall I use instead of "1000"?

> > +                       /* saturate all channels (useful for overflows) */
> > +                       iio_buffer[1] = 0xffff;
> > +                       iio_buffer[2] = 0xffff;
> > +                       iio_buffer[3] = 0xffff;
> 
> Magic!
Replaced by U16_MAX. Do you want to see something else here? It is required
to communicate measurement errors to user space as the application will have
to adjust integration time and gain.

> > +static ssize_t as73211_show_samp_freq_available(
> > +               struct device *dev __always_unused,
> > +               struct device_attribute *attr __always_unused,
> > +               char *buf)
> > +{
> > +       size_t len = 0;
> > +       int i;
> > +
> > +       for (i = 0; i < 4; i++) {
> > +               len += scnprintf(buf + len, PAGE_SIZE - len, "%d ",
> > +                       (1 << (i + 10)) * 1000);
> > +       }
> > +
> > +       /* replace trailing space by newline */
> > +       buf[len - 1] = '\n';
> > +
> > +       return len;
> > +}
> 
> Repetition of IIO core functionality?
> 
> Ditto question for the other similar functions.
Can you please give me a pointer to an example? The list of available values 
of
some attributes depend on the current value of other attributes.

regards
Christian






[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux