lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Tue, 06 Nov 2012 09:02:18 +0000 (GMT)
From:	MyungJoo Ham <myungjoo.ham@...sung.com>
To:	Nishanth Menon <nm@...com>, linux-pm <linux-pm@...r.kernel.org>
Cc:	Rajagopal Venkat <rajagopal.venkat@...aro.org>,
	¹Ú°æ¹Î <kyungmin.park@...sung.com>,
	"Rafael J. Wysocki" <rjw@...k.pl>, Kevin Hilman <khilman@...com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [linux-next PATCH 6/7] PM / devfreq: allow sysfs governor node to
 switch governor

> --- 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;
> +}
> +
[]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ