Re: [PATCH v2 4/5] iio: light: ROHM BU27008 color sensor

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

 



Hi Matti,

> > > > > +static int bu27008_chip_init(struct bu27008_data *data)
> > > > > +{
> > > > > +	int ret;
> > > > > +
> > > > > +	ret = regmap_update_bits(data->regmap, BU27008_REG_SYSTEM_CONTROL,
> > > > > +			   BU27008_MASK_SW_RESET, BU27008_MASK_SW_RESET);
> > > > > +	if (ret)
> > > > > +		return dev_err_probe(data->dev, ret, "Sensor reset failed\n");
> > > > > +
> > > > > +	/*
> > > > > +	 * The data-sheet does not tell how long performing the IC reset takes.
> > > > > +	 * However, the data-sheet says the minimum time it takes the IC to be
> > > > > +	 * able to take inputs after power is applied, is 100 uS. I'd assume
> > > > > +	 * > 1 mS is enough.
> > > > > +	 */
> > > > > +	msleep(1);
> > > > 
> > > > please use usleep_range().
> > > 
> > > I prefer to not require setting up hrtimers as we have no real requirements
> > > for the duration of this sleep. I know the msleep() is likely to exceed the
> > > 1 mS, potentially a lot if there is things to do - but we don't really care
> > > at this point. The main thing is to give the HW time to reset while allowing
> > > other things to be scheduled.
> > 
> > For the reason above, msleep(1) is quite a meaningless
> > instruction. If you need to wait around 1ms, then usleep_range is
> > the function to be used.
> > 
> > Refer, also, to the Documentation/timers/timers-howto.rst
> 
> I know the msleep() may sleep much longer. It still is not meaningless. Here
> we use the msleep() in a purpose:
> 
> "Sleep at least 1 mS, but actually I don't care if that is 20 mS or more -
> as long as you allow scheduling other things with as little overhead as
> possible".
> 
> For that purpose msleep() works just perfectly :)
> 
> I actually had a comment clarifying this in previous IIO driver I wrote
> (just to avoid confusing reviewers) but Jonathan asked me to remove the
> comment ;)

OK... ok... you convinced me :)

Thanks, will check soon your v3.
Andi



[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