linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Aniroop Mathur <aniroop.mathur@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	Linus Walleij <linus.walleij@linaro.org>,
	"knaack.h@gmx.de" <knaack.h@gmx.de>,
	"pmeerw@pmeerw.net" <pmeerw@pmeerw.net>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	SAMUEL SEQUEIRA <s.samuel@samsung.com>,
	Rahul Mahale <r.mahale@samsung.com>,
	a.mathur@samsung.com
Subject: Re: [PATCH] IIO: Change msleep to usleep_range for small msecs
Date: Sat, 3 Dec 2016 21:13:25 +0530	[thread overview]
Message-ID: <CADYu30_=u6A1vOwB10gHDxVgZb+c3k0VE4sXDStbpDbDu6WK=w@mail.gmail.com> (raw)
In-Reply-To: <37304261-5b26-c63e-2387-c13e3032ad0c@kernel.org>

On Sat, Dec 3, 2016 at 2:30 PM, Jonathan Cameron <jic23@kernel.org> wrote:
> On 02/12/16 19:07, Aniroop Mathur wrote:
>> On Wed, Nov 30, 2016 at 8:13 PM, Aniroop Mathur <a.mathur@samsung.com> wrote:
>>> On 30 Nov 2016 19:05, "Lars-Peter Clausen" <lars@metafoo.de> wrote:
>>>  >
>>>  > On 11/27/2016 11:51 AM, Jonathan Cameron wrote:
>>>  > > On 26/11/16 03:47, Aniroop Mathur wrote:
>>>  > >> msleep(1~20) may not do what the caller intends, and will often sleep longer.
>>>  > >> (~20 ms actual sleep for any value given in the 1~20ms range)
>>>  > >> This is not the desired behaviour for many cases like device resume time,
>>>  > >> device suspend time, device enable time, data reading time, etc.
>>>  > >> Thus, change msleep to usleep_range for precise wakeups.
>>>  > >>
>>>  > >> Signed-off-by: Aniroop Mathur <a.mathur@samsung.com>
>>>  > > As these need individual review by the various original authors and driver maintainers to
>>>  > > establish the intent of the sleep, it would have been better to have done a series of
>>>  > > patches (one per driver) with the relevant maintainers cc'd on the ones that they care about.
>>>  > >
>>>  > > Most of these are ADI parts looked after by Lars though so perhaps wait for his comments
>>>  > > before respining.
>>>  >
>>>  > I agree with what Jonathan said. For most of these extending the maximum
>>>  > sleep time a bit further is ok.
>>>  >
>>>
>>> Well, its right that sleep a bit further is okay but this patch is not trying
>>> to solve any major bug. This patch is only trying to make the wake up more
>>> precise than before. So like with msleep(1), process could sleep for 20 ms
>>> so this patch only making the making the process to sleep for 1 ms as
>>> mentioned in the parameter. So I think, changing to usleep_range is only
>>> advantageous and does not cause any harm here.
>>> We have also applied the same change in enable/disable/suspend/resume
>>> functions in accel, gyro, mag, etc drivers and found decent results like the
>>> first sesor data is generated much faster than before so response time
>>> increased. This is critical as  sensor can run at a rate of 200Hz / 5ms or
>>> even more now a days in new devices. We even applied in probe as doing the
>>> same in many drivers contribute to a little saving overall in kernel boot up.
>>> Also, it is recommended and mentioned in kernel documentation to use
>>> usleep_range for 1-10 ms.
>>> Sources -
>>> https://www.kernel.org/doc/Documentation/timers/timers-howto.txt
>>> https://lkml.org/lkml/2007/8/3/250
>>>
>>
>>
>> Hello Mr. Jonathan / Mr. Lars / All,
>>
>>
>> Would you kindly update further about this change?
> Hi Aniroop,
>
> Quite a few of us only manage to get to kernel patches once or twice a week
> (in my case only on weekends most weeks).
>
> Anyhow, I've applied this patch as is.  I don't necessarily think the change
> is that important in the probe paths, but as you said it does little harm.
>
> So what the heck ;)
>
> Applied to the togreg branch of iio.git which I'll push out as testing
> once I have a net connection (currently on a train).
>

This sounds great !! Thanks a lot :)

BR,
Aniroop Mathur

> Thanks,
>
> Jonathan
>>
>>
>>> Thanks.
>>>
>>> BR,
>>> Aniroop Mathur
>

      reply	other threads:[~2016-12-03 15:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-26  3:47 [PATCH] IIO: Change msleep to usleep_range for small msecs Aniroop Mathur
2016-11-27 10:51 ` Jonathan Cameron
2016-11-30 12:19   ` Linus Walleij
2016-12-02 19:01     ` Aniroop Mathur
2016-11-30 13:35   ` Lars-Peter Clausen
     [not found]   ` <CGME20161130133557epcas2p2caca5d58770bf31614812d14b809fe8f@epcas2p2.samsung.com>
2016-11-30 14:43     ` Aniroop Mathur
2016-12-02 19:07       ` Aniroop Mathur
2016-12-03  9:00         ` Jonathan Cameron
2016-12-03 15:43           ` Aniroop Mathur [this message]

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='CADYu30_=u6A1vOwB10gHDxVgZb+c3k0VE4sXDStbpDbDu6WK=w@mail.gmail.com' \
    --to=aniroop.mathur@gmail.com \
    --cc=a.mathur@samsung.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=r.mahale@samsung.com \
    --cc=s.samuel@samsung.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).