lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230426122015.cilet7diaxapgbim@intel.intel>
Date:   Wed, 26 Apr 2023 14:20:15 +0200
From:   Andi Shyti <andi.shyti@...nel.org>
To:     Matti Vaittinen <mazziesaccount@...il.com>
Cc:     Andi Shyti <andi.shyti@...nel.org>,
        Matti Vaittinen <matti.vaittinen@...rohmeurope.com>,
        Jonathan Cameron <jic23@...nel.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Zhigang Shi <Zhigang.Shi@...eon.com>,
        Shreeya Patel <shreeya.patel@...labora.com>,
        Paul Gazzillo <paul@...zz.com>,
        Dmitry Osipenko <dmitry.osipenko@...labora.com>,
        linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 4/5] iio: light: ROHM BU27008 color sensor

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ