[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180829105738.GA26948@kroah.com>
Date: Wed, 29 Aug 2018 03:57:38 -0700
From: Greg KH <greg@...ah.com>
To: Chanwoo Choi <cw00.choi@...sung.com>
Cc: myungjoo.ham@...sung.com, kyungmin.park@...sung.com,
rafael.j.wysocki@...el.com, chanwoo@...nel.org,
linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Subject: Re: [PATCH] PM / devfreq: Add new name attribute for sysfs
On Wed, Aug 29, 2018 at 04:34:06PM +0900, Chanwoo Choi wrote:
> commit 4585fbcb5331 ("PM / devfreq: Modify the device name as devfreq(X) for
> sysfs") changed the node name to devfreq(x). After this commit, it is not
> possible to get the device name through /sys/class/devfreq/devfreq(X)/*.
>
> Add new name attribute in order to get device name.
>
> Cc: stable@...r.kernel.org
> Fixes: 4585fbcb5331 ("PM / devfreq: Modify the device name as devfreq(X) for sysfs")
> Signed-off-by: Chanwoo Choi <cw00.choi@...sung.com>
> ---
> drivers/devfreq/devfreq.c | 11 +++++++++++
> include/linux/devfreq.h | 3 +++
> 2 files changed, 14 insertions(+)
>
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index 4c49bb1330b5..2145563d5ee5 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -620,6 +620,9 @@ struct devfreq *devfreq_add_device(struct device *dev,
> }
> devfreq->max_freq = devfreq->scaling_max_freq;
>
> + devfreq->name = dev_name(devfreq->dev.parent);
> + if (IS_ERR_OR_NULL(devfreq->name))
> + return -EINVAL;
> dev_set_name(&devfreq->dev, "devfreq%d",
> atomic_inc_return(&devfreq_no));
> err = device_register(&devfreq->dev);
> @@ -1261,6 +1264,13 @@ static ssize_t trans_stat_show(struct device *dev,
> }
> static DEVICE_ATTR_RO(trans_stat);
>
> +static ssize_t name_show(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + return sprintf(buf, "%s\n", to_devfreq(dev)->name);
> +}
> +static DEVICE_ATTR_RO(name);
You need a new Documentation/ABI/ entry for this.
thanks,
greg k-h
Powered by blists - more mailing lists