Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3028427pxj; Sun, 23 May 2021 19:13:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1VEdnkbhKwmyuPvj3S/GOhkz4Cto+VdakQgd3Oji7Tgg3AD5Z9pGXnVWTQ017vscS2UCw X-Received: by 2002:aa7:db90:: with SMTP id u16mr22793834edt.106.1621822436176; Sun, 23 May 2021 19:13:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621822436; cv=none; d=google.com; s=arc-20160816; b=Sitly4Qixuu7mK8J9E4TUgcCtaN+OUD706Wip4YFE8F5S0BIhFDktBvqYFP45JN7OS BKZx6BtH/u4dQ+H9GXubJHlnnfJ2eprTlBvRP3TfpXU+61gryJ6E1KzYqWxYRUQRhAeP Mwr+pBmfbIplnyCQN5YT8gsORBbZlZHZX+KDA1MC8tEkdbynDewD3lPRQcoW19FqdoCb cIqFLVjh4SptqKyn5pfMfEgDc7qC1h6HcbWeizEXxQ7JA1TboJ1wiBMEoHO/Gv8p8aRx ZEsvfntLQ5WTI/QOtpIH3Yq2JJdwqY2Bv7pIobJykHtwUeIxUYCCccx8amHQM5nKMwUH IWcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=wj+KEoJVqhJAv81aLK6/VE28vveVYHaf2MOXOoZSANQ=; b=sZZJfHbLjKr1YUD7HK5amhAX0t18zkxjiy6NpOTDELDe4Y15IH4YtpmNFx5DHQw3jF wiNbLKPJlNSdvvHFQy19c/vQHChA71EBuH9roFboDOD122mNHopFmuXOEA30GflXU9l/ Iz5r+FJB5Homx2SMEFV/ZKsFsxhYKdYR3XzTkW36ieVObxTnQOW7Rpb41wpwGRjQHNTS +FEaqztv/runs0D8L8fjrujYUgua/YKFCmuQo5xVIJr7eka2cdGOQ0h+eJXFra0EAEAg ATS8k5eioCt4S6OJ7+5OMvmwSjvEwF7SxZtzw+7mqz7raAzcKtrnsfIwxnZFo4wcGBhQ tS9g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n14si3081910edd.359.2021.05.23.19.13.33; Sun, 23 May 2021 19:13:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232167AbhEXCNn (ORCPT + 99 others); Sun, 23 May 2021 22:13:43 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:5670 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231765AbhEXCNn (ORCPT ); Sun, 23 May 2021 22:13:43 -0400 Received: from dggems701-chm.china.huawei.com (unknown [172.30.72.60]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4FpLHm342dz1BQn6; Mon, 24 May 2021 10:09:24 +0800 (CST) Received: from dggema769-chm.china.huawei.com (10.1.198.211) by dggems701-chm.china.huawei.com (10.3.19.178) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Mon, 24 May 2021 10:12:11 +0800 Received: from localhost (10.174.179.215) by dggema769-chm.china.huawei.com (10.1.198.211) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Mon, 24 May 2021 10:12:10 +0800 From: YueHaibing To: , , , CC: , Subject: [PATCH -next] PM / devfreq: governor: use DEVICE_ATTR_RW macro Date: Mon, 24 May 2021 10:11:58 +0800 Message-ID: <20210524021158.21236-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.179.215] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggema769-chm.china.huawei.com (10.1.198.211) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use DEVICE_ATTR_RW helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read. Signed-off-by: YueHaibing --- drivers/devfreq/governor_userspace.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/devfreq/governor_userspace.c b/drivers/devfreq/governor_userspace.c index 0fd6c4851071..ab9db7adb3ad 100644 --- a/drivers/devfreq/governor_userspace.c +++ b/drivers/devfreq/governor_userspace.c @@ -31,8 +31,8 @@ static int devfreq_userspace_func(struct devfreq *df, unsigned long *freq) return 0; } -static ssize_t store_freq(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) +static ssize_t set_freq_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) { struct devfreq *devfreq = to_devfreq(dev); struct userspace_data *data; @@ -52,8 +52,8 @@ static ssize_t store_freq(struct device *dev, struct device_attribute *attr, return err; } -static ssize_t show_freq(struct device *dev, struct device_attribute *attr, - char *buf) +static ssize_t set_freq_show(struct device *dev, + struct device_attribute *attr, char *buf) { struct devfreq *devfreq = to_devfreq(dev); struct userspace_data *data; @@ -70,7 +70,7 @@ static ssize_t show_freq(struct device *dev, struct device_attribute *attr, return err; } -static DEVICE_ATTR(set_freq, 0644, show_freq, store_freq); +static DEVICE_ATTR_RW(set_freq); static struct attribute *dev_entries[] = { &dev_attr_set_freq.attr, NULL, -- 2.17.1