All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
Cc: Shuah Khan <shuahkhan@gmail.com>,
	Richard Purdie <rpurdie@rpsys.net>,
	Jacek Anaszewski <j.anaszewski@samsung.com>,
	linux-leds@vger.kernel.org
Subject: [PATCH] leds: ledtrig-transient: fix duration to be msec instead of jiffies
Date: Tue, 10 Nov 2015 17:10:17 -0600	[thread overview]
Message-ID: <1447197017-4783-1-git-send-email-robh@kernel.org> (raw)

The transient trigger duration is documented to be in msec units, but is
actually in jiffies units. Other time based triggers are in msec units
as well. Fix the timer setup to convert from msec.

This could break an existing userspace that worked around this problem,
but exposing jiffies to userspace is just wrong and would break anyway
if HZ is changed.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Shuah Khan <shuahkhan@gmail.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Jacek Anaszewski <j.anaszewski@samsung.com>
Cc: linux-leds@vger.kernel.org
---
 drivers/leds/trigger/ledtrig-transient.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/leds/trigger/ledtrig-transient.c b/drivers/leds/trigger/ledtrig-transient.c
index 3c34de4..60034bf 100644
--- a/drivers/leds/trigger/ledtrig-transient.c
+++ b/drivers/leds/trigger/ledtrig-transient.c
@@ -85,7 +85,7 @@ static ssize_t transient_activate_store(struct device *dev,
 		transient_data->restore_state =
 		    (transient_data->state == LED_FULL) ? LED_OFF : LED_FULL;
 		mod_timer(&transient_data->timer,
-			  jiffies + transient_data->duration);
+			  jiffies + msecs_to_jiffies(transient_data->duration));
 	}
 
 	/* state == 0 && transient_data->activate == 0
-- 
2.5.0

             reply	other threads:[~2015-11-10 23:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-10 23:10 Rob Herring [this message]
2015-11-16 13:20 ` [PATCH] leds: ledtrig-transient: fix duration to be msec instead of jiffies Jacek Anaszewski

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=1447197017-4783-1-git-send-email-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=j.anaszewski@samsung.com \
    --cc=linux-leds@vger.kernel.org \
    --cc=rpurdie@rpsys.net \
    --cc=shuahkhan@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.