From: Pavel Machek <pavel@ucw.cz>
To: Andy Lutomirski <luto@kernel.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org
Subject: Re: [PATCH 1/3] dev_pm_qos: Improve sysfs pm_qos_latency_tolerance validation
Date: Mon, 5 Dec 2016 12:19:24 +0100 [thread overview]
Message-ID: <20161205111924.GA9148@amd> (raw)
In-Reply-To: <9f642daf2787251258336c4ce93b1d3090afd590.1480468027.git.luto@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 927 bytes --]
On Tue 2016-11-29 17:11:50, Andy Lutomirski wrote:
> Negative values are special. Don't let users write them directly.
>
> Signed-off-by: Andy Lutomirski <luto@kernel.org>
Acked-by: Pavel Machek <pavel@ucw.cz>
> --- a/drivers/base/power/sysfs.c
> +++ b/drivers/base/power/sysfs.c
> @@ -263,7 +263,11 @@ static ssize_t pm_qos_latency_tolerance_store(struct device *dev,
> s32 value;
> int ret;
>
> - if (kstrtos32(buf, 0, &value)) {
> + if (kstrtos32(buf, 0, &value) == 0) {
> + /* Users can't write negative values directly */
> + if (value < 0)
> + return -EINVAL;
> + } else {
> if (!strcmp(buf, "auto") || !strcmp(buf, "auto\n"))
> value = PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT;
> else if (!strcmp(buf, "any") || !strcmp(buf, "any\n"))
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
next prev parent reply other threads:[~2016-12-05 11:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-30 1:11 [PATCH 0/3] dev_pm_qos improvements Andy Lutomirski
2016-11-30 1:11 ` [PATCH 1/3] dev_pm_qos: Improve sysfs pm_qos_latency_tolerance validation Andy Lutomirski
2016-12-05 11:19 ` Pavel Machek [this message]
2016-11-30 1:11 ` [PATCH 2/3] dev_pm_qos: Fix writing 'auto' to pm_qos_latency_tolerance_us Andy Lutomirski
2016-11-30 1:11 ` [PATCH 3/3] dev_pm_qos: Export dev_pm_qos_update_user_latency_tolerance Andy Lutomirski
2016-12-01 14:26 ` [PATCH 0/3] dev_pm_qos improvements Rafael J. Wysocki
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=20161205111924.GA9148@amd \
--to=pavel@ucw.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=luto@kernel.org \
--cc=rjw@rjwysocki.net \
/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.