From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: linux-acpi@vger.kernel.org, rui.zhang@intel.com,
Linux PM list <linux-pm@vger.kernel.org>
Subject: Re: [PATCH] thermal: Can't set policy
Date: Fri, 26 Apr 2013 22:33:22 +0200 [thread overview]
Message-ID: <4217740.SfDcdCo8sm@vostro.rjw.lan> (raw)
In-Reply-To: <1366989432-4825-1-git-send-email-srinivas.pandruvada@linux.intel.com>
On Friday, April 26, 2013 08:17:12 AM Srinivas Pandruvada wrote:
> Setting policy results in invalid value error.
> >echo "step_wise" > policy
> >echo: write error: Invalid argument
>
> Need clean up of the buffer which "echo" may add based on the
> arguments, before comparing aganist list of governor names.
>
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
This needs to go to linux-pm@vger.kernel.org, so that the people who work on
thermal have chance to comment. Please resend.
Thanks,
Rafael
> ---
> drivers/thermal/thermal_core.c | 19 +++++++++++++++----
> 1 file changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
> index 4cdc3e3..ed6904f 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -696,16 +696,27 @@ static ssize_t
> policy_store(struct device *dev, struct device_attribute *attr,
> const char *buf, size_t count)
> {
> - int ret = -EINVAL;
> + int ret;
> struct thermal_zone_device *tz = to_thermal_zone(dev);
> struct thermal_governor *gov;
> + char str_gov[THERMAL_NAME_LENGTH];
> + char format[6]; /* enough for 3 digit format width */
> +
> + ret = snprintf(format, sizeof(format), "%%%ds",
> + THERMAL_NAME_LENGTH - 1);
> + if (ret < 0)
> + return ret;
> + ret = sscanf(buf, format, str_gov);
> + if (ret <= 0)
> + return -EINVAL;
>
> mutex_lock(&thermal_governor_lock);
>
> - gov = __find_governor(buf);
> - if (!gov)
> + gov = __find_governor(str_gov);
> + if (!gov) {
> + ret = -EINVAL;
> goto exit;
> -
> + }
> tz->governor = gov;
> ret = count;
>
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
next prev parent reply other threads:[~2013-04-26 20:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-26 15:17 [PATCH] thermal: Can't set policy Srinivas Pandruvada
2013-04-26 20:33 ` Rafael J. Wysocki [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-04-26 20:35 Srinivas Pandruvada
2013-04-26 21:21 ` Eduardo Valentin
[not found] ` <517B0E9D.6000904@linux.intel.com>
2013-05-02 4:50 ` Srinivas Pandruvada
2013-05-02 17:31 ` Eduardo Valentin
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=4217740.SfDcdCo8sm@vostro.rjw.lan \
--to=rjw@sisk.pl \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rui.zhang@intel.com \
--cc=srinivas.pandruvada@linux.intel.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