From: MyungJoo Ham <myungjoo.ham@samsung.com>
To: Nishanth Menon <nm@ti.com>, linux-pm <linux-pm@vger.kernel.org>
Cc: "Rajagopal Venkat" <rajagopal.venkat@linaro.org>,
박경민 <kyungmin.park@samsung.com>,
"Rafael J. Wysocki" <rjw@sisk.pl>,
"Kevin Hilman" <khilman@ti.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [linux-next PATCH 6/7] PM / devfreq: allow sysfs governor node to switch governor
Date: Tue, 06 Nov 2012 09:02:16 +0000 (GMT) [thread overview]
Message-ID: <31153640.425391352192535931.JavaMail.weblogic@epml11> (raw)
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -629,6 +629,44 @@ static ssize_t show_governor(struct device *dev,
> return sprintf(buf, "%s\n", to_devfreq(dev)->governor->name);
> }
>
> +static ssize_t store_governor(struct device *dev, struct device_attribute *attr,
> + const char *buf, size_t count)
> +{
> + struct devfreq *df = to_devfreq(dev);
> + int ret = 0;
> + struct devfreq_governor *governor;
> +
> + mutex_lock(&devfreq_list_lock);
Please remove the trailing \n from buf here.
When user enters "userspace", buf gets "userspace\n".
With some printks in find_devfreq_governor (printing the buf and governor names):
# echo userspace > /sys/class/devfreq/exynos4210-busfreq.0/governor
[ 65.975000] [userspace
[ 65.975000] ].[userspace]
[ 65.980000] [userspace
[ 65.980000] ].[powersave]
[ 65.985000] [userspace
[ 65.985000] ].[performance]
[ 65.990000] [userspace
[ 65.990000] ].[simple_ondemand]
[ 65.995000] err no = -19
#
Cheers,
MyungJoo
> + governor = find_devfreq_governor(buf);
> + if (IS_ERR(governor)) {
> + ret = PTR_ERR(governor);
> + goto out;
> + }
> + if (df->governor == governor)
> + goto out;
> +
> + if (df->governor) {
> + ret = df->governor->event_handler(df, DEVFREQ_GOV_STOP, NULL);
> + if (ret) {
> + dev_warn(dev, "%s: Governor %s not stopped(%d)\n",
> + __func__, df->governor->name, ret);
> + goto out;
> + }
> + }
> + df->governor = governor;
> + strncpy(df->governor_name, governor->name, DEVFREQ_NAME_LEN);
> + ret = df->governor->event_handler(df, DEVFREQ_GOV_START, NULL);
> + if (ret)
> + dev_warn(dev, "%s: Governor %s not started(%d)\n",
> + __func__, df->governor->name, ret);
> +out:
> + mutex_unlock(&devfreq_list_lock);
> +
> + if (!ret)
> + ret = count;
> + return ret;
> +}
> +
[]
WARNING: multiple messages have this Message-ID (diff)
From: MyungJoo Ham <myungjoo.ham@samsung.com>
To: Nishanth Menon <nm@ti.com>, linux-pm <linux-pm@vger.kernel.org>
Cc: "Rajagopal Venkat" <rajagopal.venkat@linaro.org>,
박경민 <kyungmin.park@samsung.com>,
"Rafael J. Wysocki" <rjw@sisk.pl>,
"Kevin Hilman" <khilman@ti.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [linux-next PATCH 6/7] PM / devfreq: allow sysfs governor node to switch governor
Date: Tue, 06 Nov 2012 09:02:18 +0000 (GMT) [thread overview]
Message-ID: <31153640.425391352192535931.JavaMail.weblogic@epml11> (raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=euc-kr, Size: 1977 bytes --]
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -629,6 +629,44 @@ static ssize_t show_governor(struct device *dev,
> return sprintf(buf, "%s\n", to_devfreq(dev)->governor->name);
> }
>
> +static ssize_t store_governor(struct device *dev, struct device_attribute *attr,
> + const char *buf, size_t count)
> +{
> + struct devfreq *df = to_devfreq(dev);
> + int ret = 0;
> + struct devfreq_governor *governor;
> +
> + mutex_lock(&devfreq_list_lock);
Please remove the trailing \n from buf here.
When user enters "userspace", buf gets "userspace\n".
With some printks in find_devfreq_governor (printing the buf and governor names):
# echo userspace > /sys/class/devfreq/exynos4210-busfreq.0/governor
[ 65.975000] [userspace
[ 65.975000] ].[userspace]
[ 65.980000] [userspace
[ 65.980000] ].[powersave]
[ 65.985000] [userspace
[ 65.985000] ].[performance]
[ 65.990000] [userspace
[ 65.990000] ].[simple_ondemand]
[ 65.995000] err no = -19
#
Cheers,
MyungJoo
> + governor = find_devfreq_governor(buf);
> + if (IS_ERR(governor)) {
> + ret = PTR_ERR(governor);
> + goto out;
> + }
> + if (df->governor == governor)
> + goto out;
> +
> + if (df->governor) {
> + ret = df->governor->event_handler(df, DEVFREQ_GOV_STOP, NULL);
> + if (ret) {
> + dev_warn(dev, "%s: Governor %s not stopped(%d)\n",
> + __func__, df->governor->name, ret);
> + goto out;
> + }
> + }
> + df->governor = governor;
> + strncpy(df->governor_name, governor->name, DEVFREQ_NAME_LEN);
> + ret = df->governor->event_handler(df, DEVFREQ_GOV_START, NULL);
> + if (ret)
> + dev_warn(dev, "%s: Governor %s not started(%d)\n",
> + __func__, df->governor->name, ret);
> +out:
> + mutex_unlock(&devfreq_list_lock);
> +
> + if (!ret)
> + ret = count;
> + return ret;
> +}
> +
[]
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
next reply other threads:[~2012-11-06 9:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-06 9:02 MyungJoo Ham [this message]
2012-11-06 9:02 ` [linux-next PATCH 6/7] PM / devfreq: allow sysfs governor node to switch governor MyungJoo Ham
[not found] ` <CAJ0PZbSe7Orhww-amHNRkbvUvJr6x9CtisHw2hoLpcJdyBSKCA@mail.gmail.com>
2012-11-06 21:28 ` Nishanth Menon
-- strict thread matches above, loose matches on Subject: below --
2012-10-29 20:01 [linux-next PATCH 0/7] PM / devfreq: allow governors to be modules and switch dynamically Nishanth Menon
2012-10-29 20:01 ` [linux-next PATCH 6/7] PM / devfreq: allow sysfs governor node to switch governor Nishanth Menon
2012-10-29 20:01 ` Nishanth Menon
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=31153640.425391352192535931.JavaMail.weblogic@epml11 \
--to=myungjoo.ham@samsung.com \
--cc=khilman@ti.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=nm@ti.com \
--cc=rajagopal.venkat@linaro.org \
--cc=rjw@sisk.pl \
/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.