From patchwork Wed Jan 17 06:01:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 124780 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp1268613lje; Tue, 16 Jan 2018 22:05:28 -0800 (PST) X-Google-Smtp-Source: ACJfBouey5d+jvQuteuEcNNeKDFfYRQf4igKQ4/SRrUQkqCbxC9CJNjTqgPj4dOmH2fPfWynhDy6 X-Received: by 10.159.253.8 with SMTP id p8mr41452283pls.44.1516169128799; Tue, 16 Jan 2018 22:05:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516169128; cv=none; d=google.com; s=arc-20160816; b=b5cDcl3PwLcX85jdc7ttGJdG8JyLwg4YjHCFsAMuK0SNpZtSq4gohPwqt+XfdjAyCv yZvBcH8+p9k9duIIB8eBXbUkndjB0mxaXUyh8jhfCOcna0/yo0PW6rtpzmxW/4teU4EI ok+w1qDQKvI8aosxftejX6Rs4e3MB/Q4g1h+WnxkR+EYcKjNNiBp/Dx6YVrbhgjcurBI TurgyVZtQHQT+yBPa4gXnSomlOJtjkvfKqHVe8gflStvJj4BlDDTTz8L8sGIuaW6Vqr5 nvcnudMcZZ+dQpflINyaV4zaf1g+WlildZuO4UJLMCeolPRVdxEaXeoP97rCHGFxbzTi h8aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=EUoj80eDdxYnt/DPWo44yjlYW/VJrR/nsZ/wVjN7e6I=; b=JXWUmIJX6En7d0m3vNWm9xSOEi8npnnPdx8Z365EfeCxn2aA6xHSkm1abTuGi62TAw rmFCzktpF0Dme7vaqyCjEreoELiJeGJmv66eEK/XKbJbWZZVAxdvpH/B8nBKyjPhyIUl 0GQ2u1oRdRQKI6u5GuoS0B86jr1v0gKHEHXEyX7bk157YtifIhpVY7AUrFcDcQXaXf3a fGWBSe5XXfpBUt4KiHrFASTvnIzeWwyaGOdV0gH2QJh100En8EfSBE/FE3PLvESegm5s THLawv6zyYFyI3RIP3sVoUcS+GbLfJuIBhCdKQNalOOipQctPGkTXmCoKMZ80b8y6ZdO l+6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NCp+UMiJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u23si3764083plk.516.2018.01.16.22.05.28; Tue, 16 Jan 2018 22:05:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NCp+UMiJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750908AbeAQGF0 (ORCPT + 28 others); Wed, 17 Jan 2018 01:05:26 -0500 Received: from mail-pl0-f67.google.com ([209.85.160.67]:34381 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750794AbeAQGFY (ORCPT ); Wed, 17 Jan 2018 01:05:24 -0500 Received: by mail-pl0-f67.google.com with SMTP id d21so8038332pll.1 for ; Tue, 16 Jan 2018 22:05:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=EUoj80eDdxYnt/DPWo44yjlYW/VJrR/nsZ/wVjN7e6I=; b=NCp+UMiJ78qHD9YBxAlF/yUK+BjEORSnhVKo0XjNG57S4HHxe29YgGaGwT+a2GSa/2 TX9OJ78WEKBrF2/P8l6jBJyGTwCavwS/LgefYGSpfjTL1/IdDY1jnMWrWrkdLm++ul8A 0Jx59YyactNwDqdJIbosZtaP3hfhB6fXZLFyE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=EUoj80eDdxYnt/DPWo44yjlYW/VJrR/nsZ/wVjN7e6I=; b=NJ+7Y3FSVU/lF3kc9ONm2ScQKhWpPLEfOQdsBw6FnM7yKYqrdO9Z5FKyo3lxaBzRLe qWQJhe7HU4oroCuSdXel2rqSkl/Vcecet5siWX1SpdlsvrLmUKSQZj0KOQhnezobl6l5 C06yDHaKf8hWgIe8qZ67LAcHuugMRYKy+gvWPjCWeqxE4WnsoUoC/IPQNR1KSXIxmeRo kcIPxKaeJFFTGElmB0dzjAEPUJuz669uOEneLp6AHe7lTnhD1Ldr+D3MiDG+XGRzU9c8 cRAKSCR4p/OVYpNJZIVxrvvK3bNxiQogyNLttgD7T+AM8gfKO+NinUtQVCvHJlht8mb1 Ug4w== X-Gm-Message-State: AKwxyteFckAGGIFjjEWX/hOQkbTHVYLYgN05w/cpgmm9na7o/qvj4CM+ QcEAdWrE4AiblyhWZRMBtrIWjg== X-Received: by 10.159.235.143 with SMTP id f15mr10258933plr.214.1516169124357; Tue, 16 Jan 2018 22:05:24 -0800 (PST) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id n66sm5987418pfn.64.2018.01.16.22.03.43 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Jan 2018 22:05:23 -0800 (PST) From: Baolin Wang To: john.stultz@linaro.org, tglx@linutronix.de, sboyd@codeaurora.org Cc: broonie@kernel.org, arnd@arndb.de, baolin.wang@linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] clocksource: Use DEVICE_ATTR_RW/RO/WO to define device attributes Date: Wed, 17 Jan 2018 14:01:29 +0800 Message-Id: <8f35c77e753e957b61187e8e7b2e4a3d61e4a72b.1516167691.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <069ce2a605546bcad6552968cff755f0a03f9f10.1516167691.git.baolin.wang@linaro.org> References: <069ce2a605546bcad6552968cff755f0a03f9f10.1516167691.git.baolin.wang@linaro.org> In-Reply-To: <069ce2a605546bcad6552968cff755f0a03f9f10.1516167691.git.baolin.wang@linaro.org> References: <069ce2a605546bcad6552968cff755f0a03f9f10.1516167691.git.baolin.wang@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert DEVICE_ATTR to DEVICE_ATTR_RW/RO/WO to make attributes' definition more clear. Signed-off-by: Baolin Wang --- kernel/time/clocksource.c | 43 +++++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 26 deletions(-) -- 1.7.9.5 diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index c5fdcb1..7ce5346 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c @@ -857,16 +857,16 @@ int clocksource_unregister(struct clocksource *cs) #ifdef CONFIG_SYSFS /** - * sysfs_show_current_clocksources - sysfs interface for current clocksource + * current_clocksource_show - sysfs interface for current clocksource * @dev: unused * @attr: unused * @buf: char buffer to be filled with clocksource list * * Provides sysfs interface for listing current clocksource. */ -static ssize_t -sysfs_show_current_clocksources(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t current_clocksource_show(struct device *dev, + struct device_attribute *attr, + char *buf) { ssize_t count = 0; @@ -895,7 +895,7 @@ ssize_t sysfs_get_uname(const char *buf, char *dst, size_t cnt) } /** - * sysfs_override_clocksource - interface for manually overriding clocksource + * current_clocksource_store - interface for manually overriding clocksource * @dev: unused * @attr: unused * @buf: name of override clocksource @@ -904,9 +904,9 @@ ssize_t sysfs_get_uname(const char *buf, char *dst, size_t cnt) * Takes input from sysfs interface for manually overriding the default * clocksource selection. */ -static ssize_t sysfs_override_clocksource(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) +static ssize_t current_clocksource_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) { ssize_t ret; @@ -920,9 +920,10 @@ static ssize_t sysfs_override_clocksource(struct device *dev, return ret; } +static DEVICE_ATTR_RW(current_clocksource); /** - * sysfs_unbind_current_clocksource - interface for manually unbinding clocksource + * unbind_clocksource_store - interface for manually unbinding clocksource * @dev: unused * @attr: unused * @buf: unused @@ -930,7 +931,7 @@ static ssize_t sysfs_override_clocksource(struct device *dev, * * Takes input from sysfs interface for manually unbinding a clocksource. */ -static ssize_t sysfs_unbind_clocksource(struct device *dev, +static ssize_t unbind_clocksource_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { @@ -954,19 +955,19 @@ static ssize_t sysfs_unbind_clocksource(struct device *dev, return ret ? ret : count; } +static DEVICE_ATTR_WO(unbind_clocksource); /** - * sysfs_show_available_clocksources - sysfs interface for listing clocksource + * available_clocksource_show - sysfs interface for listing clocksource * @dev: unused * @attr: unused * @buf: char buffer to be filled with clocksource list * * Provides sysfs interface for listing registered clocksources */ -static ssize_t -sysfs_show_available_clocksources(struct device *dev, - struct device_attribute *attr, - char *buf) +static ssize_t available_clocksource_show(struct device *dev, + struct device_attribute *attr, + char *buf) { struct clocksource *src; ssize_t count = 0; @@ -990,17 +991,7 @@ static ssize_t sysfs_unbind_clocksource(struct device *dev, return count; } - -/* - * Sysfs setup bits: - */ -static DEVICE_ATTR(current_clocksource, 0644, sysfs_show_current_clocksources, - sysfs_override_clocksource); - -static DEVICE_ATTR(unbind_clocksource, 0200, NULL, sysfs_unbind_clocksource); - -static DEVICE_ATTR(available_clocksource, 0444, - sysfs_show_available_clocksources, NULL); +static DEVICE_ATTR_RO(available_clocksource); static struct bus_type clocksource_subsys = { .name = "clocksource",