From: tip-bot for Baolin Wang <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: baolin.wang@linaro.org, mingo@kernel.org, hpa@zytor.com,
linux-kernel@vger.kernel.org, tglx@linutronix.de
Subject: [tip:timers/core] clocksource: Use DEVICE_ATTR_RW/RO/WO to define device attributes
Date: Wed, 28 Feb 2018 05:10:16 -0800 [thread overview]
Message-ID: <tip-e87821d18cf4db19d634a04061c0a1b7eb9c0e65@git.kernel.org> (raw)
In-Reply-To: <8f35c77e753e957b61187e8e7b2e4a3d61e4a72b.1516167691.git.baolin.wang@linaro.org>
Commit-ID: e87821d18cf4db19d634a04061c0a1b7eb9c0e65
Gitweb: https://git.kernel.org/tip/e87821d18cf4db19d634a04061c0a1b7eb9c0e65
Author: Baolin Wang <baolin.wang@linaro.org>
AuthorDate: Wed, 17 Jan 2018 14:01:29 +0800
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 28 Feb 2018 14:04:52 +0100
clocksource: Use DEVICE_ATTR_RW/RO/WO to define device attributes
Convert DEVICE_ATTR to DEVICE_ATTR_RW/RO/WO which is the preferred and
simpler way of implementation.
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: arnd@arndb.de
Cc: sboyd@codeaurora.org
Cc: broonie@kernel.org
Cc: john.stultz@linaro.org
Link: https://lkml.kernel.org/r/8f35c77e753e957b61187e8e7b2e4a3d61e4a72b.1516167691.git.baolin.wang@linaro.org
---
kernel/time/clocksource.c | 43 +++++++++++++++++--------------------------
1 file changed, 17 insertions(+), 26 deletions(-)
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index c5fdcb13200f..7ce53465782b 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -857,16 +857,16 @@ EXPORT_SYMBOL(clocksource_unregister);
#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 @@ sysfs_show_available_clocksources(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",
next prev parent reply other threads:[~2018-02-28 13:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-17 6:01 [PATCH 1/3] clocksource: Skip to check the override clocksource if override name is empty Baolin Wang
2018-01-17 6:01 ` [PATCH 2/3] clocksource: Use DEVICE_ATTR_RW/RO/WO to define device attributes Baolin Wang
2018-02-28 13:10 ` tip-bot for Baolin Wang [this message]
2018-01-17 6:01 ` [PATCH 3/3] clocksource: Use ATTRIBUTE_GROUPS macro Baolin Wang
2018-02-28 13:10 ` [tip:timers/core] clocksource: Use ATTRIBUTE_GROUPS tip-bot for Baolin Wang
2018-02-28 13:09 ` [tip:timers/core] clocksource: Don't walk the clocksource list for empty override tip-bot for Baolin Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-e87821d18cf4db19d634a04061c0a1b7eb9c0e65@git.kernel.org \
--to=tipbot@zytor.com \
--cc=baolin.wang@linaro.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®