From patchwork Mon Feb 3 16:19:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 232202 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC600C3524D for ; Mon, 3 Feb 2020 16:32:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C3463218AC for ; Mon, 3 Feb 2020 16:32:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580747546; bh=SYyVBxqOvd8PZBMYuPnTKpW3r9nD8zK15FsRGcjFJXA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=0PnHLk6RzkNZpETlNfJj+hH9rMqhXIHb/Dv4Zt/0jsngy3O4tqKJn3GKLK6ioOFKL yCThKlymhQcPliDPqW49LWYQosrvJ7FICwcpgvgApptwlCzpbFKBqLly+RMqSzrQHw IfTyJHku9yxyIhwCUfA965SILNbA06iDu+vHQtLk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730400AbgBCQcW (ORCPT ); Mon, 3 Feb 2020 11:32:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:46006 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730407AbgBCQcU (ORCPT ); Mon, 3 Feb 2020 11:32:20 -0500 Received: from localhost (unknown [104.132.45.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7153621744; Mon, 3 Feb 2020 16:32:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580747539; bh=SYyVBxqOvd8PZBMYuPnTKpW3r9nD8zK15FsRGcjFJXA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xobgM9GApQV47iI9SAZJBd/XSfcZ9F+mtbI9vjKKLM08R348eL7pWYm9oehvCSuwh FPYn5Nui+YgBk2QN0dWYi/Mp3hEZT+D7C8Rx8Q8z+HbSfLcrL/AuylqJ5UdX12eKnz pGZt/bYgjDUBbTcVXL6LD5TweG9KpPRWVORwRPFw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chanwoo Choi Subject: [PATCH 4.19 09/70] PM / devfreq: Add new name attribute for sysfs Date: Mon, 3 Feb 2020 16:19:21 +0000 Message-Id: <20200203161913.849916643@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200203161912.158976871@linuxfoundation.org> References: <20200203161912.158976871@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Chanwoo Choi commit 2fee1a7cc6b1ce6634bb0f025be2c94a58dfa34d upstream. The 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@vger.kernel.org Fixes: 4585fbcb5331 ("PM / devfreq: Modify the device name as devfreq(X) for sysfs") Signed-off-by: Chanwoo Choi Signed-off-by: Greg Kroah-Hartman --- Documentation/ABI/testing/sysfs-class-devfreq | 7 +++++++ drivers/devfreq/devfreq.c | 9 +++++++++ 2 files changed, 16 insertions(+) --- a/Documentation/ABI/testing/sysfs-class-devfreq +++ b/Documentation/ABI/testing/sysfs-class-devfreq @@ -7,6 +7,13 @@ Description: The name of devfreq object denoted as ... is same as the name of device using devfreq. +What: /sys/class/devfreq/.../name +Date: November 2019 +Contact: Chanwoo Choi +Description: + The /sys/class/devfreq/.../name shows the name of device + of the corresponding devfreq object. + What: /sys/class/devfreq/.../governor Date: September 2011 Contact: MyungJoo Ham --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -1014,6 +1014,14 @@ err_out: } EXPORT_SYMBOL(devfreq_remove_governor); +static ssize_t name_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct devfreq *devfreq = to_devfreq(dev); + return sprintf(buf, "%s\n", dev_name(devfreq->dev.parent)); +} +static DEVICE_ATTR_RO(name); + static ssize_t governor_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -1330,6 +1338,7 @@ static ssize_t trans_stat_show(struct de static DEVICE_ATTR_RO(trans_stat); static struct attribute *devfreq_attrs[] = { + &dev_attr_name.attr, &dev_attr_governor.attr, &dev_attr_available_governors.attr, &dev_attr_cur_freq.attr,