public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Willy Tarreau <w@1wt.eu>
To: Nicholas Mc Guire <hofrat@osadl.org>
Cc: Willy Tarreau <willy@meta-x.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Mariusz Gorski <marius.gorski@gmail.com>,
	Sudip Mukherjee <sudipm.mukherjee@gmail.com>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: panel: use schedule_timeout_interruptible()
Date: Sat, 30 May 2015 08:00:33 +0200	[thread overview]
Message-ID: <20150530060033.GA25881@1wt.eu> (raw)
In-Reply-To: <1432918952-27948-1-git-send-email-hofrat@osadl.org>

Hi Nicholas,

On Fri, May 29, 2015 at 07:02:32PM +0200, Nicholas Mc Guire wrote:
> API consolidation with coccinelle found:
> ./drivers/staging/panel/panel.c:782:2-18:
>         consolidation with schedule_timeout_*() recommended
> 
> This is a 1:1 conversion with respect to schedule_timeout() to the
> schedule_timeout_interruptible() helper only - so only an API
> consolidation to improve readability. The timeout was being passed
> as (ms * HZ + 999) / 1000 but that simply looks wrong - rather than
> "manual" converting to jiffies, msecs_to_jiffies which handles all 
> corner-cases correctly, was used.
> 
> Patch was compile tested with x86_64_defconfig + CONFIG_STAGING=y,
> CONFIG_PARPORT=m, CONFIG_PANEL=m
> 
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>

Acked-by: Willy Tarreau <w@1wt.eu>

> ---
> Patch is against 4.1-rc5 (localversion-next is -next-20150529)
> 
> not really clear what the intent of (ms * HZ + 999) / 1000 was - this 
> is HZ dependent and does not really make sense - the comment states
> "sleeps that many milliseconds" so it probably simply should be
> msecs_to_jiffies(ms) - but someone that knows the intention of this code
> needs to check this.

Oh it's very simple, we call this a bug :-)
The code was written for kernel 2.2 and by then there was no
msecs_to_jiffies(). I did a mistake with this +999, the purpose was
to round up, but it's not 999 that should have been used, but HZ-1
since the result is supposed to be in units of HZ.

Thanks for fixing this one!

Willy


      reply	other threads:[~2015-05-30  6:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-29 17:02 [PATCH] staging: panel: use schedule_timeout_interruptible() Nicholas Mc Guire
2015-05-30  6:00 ` Willy Tarreau [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=20150530060033.GA25881@1wt.eu \
    --to=w@1wt.eu \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hofrat@osadl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marius.gorski@gmail.com \
    --cc=sudipm.mukherjee@gmail.com \
    --cc=willy@meta-x.org \
    /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