Commit e87821d1 authored by Baolin Wang's avatar Baolin Wang Committed by Thomas Gleixner

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: default avatarBaolin Wang <baolin.wang@linaro.org>
Signed-off-by: default avatarThomas 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
parent 7f852afe
...@@ -857,16 +857,16 @@ EXPORT_SYMBOL(clocksource_unregister); ...@@ -857,16 +857,16 @@ EXPORT_SYMBOL(clocksource_unregister);
#ifdef CONFIG_SYSFS #ifdef CONFIG_SYSFS
/** /**
* sysfs_show_current_clocksources - sysfs interface for current clocksource * current_clocksource_show - sysfs interface for current clocksource
* @dev: unused * @dev: unused
* @attr: unused * @attr: unused
* @buf: char buffer to be filled with clocksource list * @buf: char buffer to be filled with clocksource list
* *
* Provides sysfs interface for listing current clocksource. * Provides sysfs interface for listing current clocksource.
*/ */
static ssize_t static ssize_t current_clocksource_show(struct device *dev,
sysfs_show_current_clocksources(struct device *dev, struct device_attribute *attr,
struct device_attribute *attr, char *buf) char *buf)
{ {
ssize_t count = 0; ssize_t count = 0;
...@@ -895,7 +895,7 @@ ssize_t sysfs_get_uname(const char *buf, char *dst, size_t cnt) ...@@ -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 * @dev: unused
* @attr: unused * @attr: unused
* @buf: name of override clocksource * @buf: name of override clocksource
...@@ -904,9 +904,9 @@ ssize_t sysfs_get_uname(const char *buf, char *dst, size_t cnt) ...@@ -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 * Takes input from sysfs interface for manually overriding the default
* clocksource selection. * clocksource selection.
*/ */
static ssize_t sysfs_override_clocksource(struct device *dev, static ssize_t current_clocksource_store(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
ssize_t ret; ssize_t ret;
...@@ -920,9 +920,10 @@ static ssize_t sysfs_override_clocksource(struct device *dev, ...@@ -920,9 +920,10 @@ static ssize_t sysfs_override_clocksource(struct device *dev,
return ret; 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 * @dev: unused
* @attr: unused * @attr: unused
* @buf: unused * @buf: unused
...@@ -930,7 +931,7 @@ static ssize_t sysfs_override_clocksource(struct device *dev, ...@@ -930,7 +931,7 @@ static ssize_t sysfs_override_clocksource(struct device *dev,
* *
* Takes input from sysfs interface for manually unbinding a clocksource. * 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, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
...@@ -954,19 +955,19 @@ static ssize_t sysfs_unbind_clocksource(struct device *dev, ...@@ -954,19 +955,19 @@ static ssize_t sysfs_unbind_clocksource(struct device *dev,
return ret ? ret : count; 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 * @dev: unused
* @attr: unused * @attr: unused
* @buf: char buffer to be filled with clocksource list * @buf: char buffer to be filled with clocksource list
* *
* Provides sysfs interface for listing registered clocksources * Provides sysfs interface for listing registered clocksources
*/ */
static ssize_t static ssize_t available_clocksource_show(struct device *dev,
sysfs_show_available_clocksources(struct device *dev, struct device_attribute *attr,
struct device_attribute *attr, char *buf)
char *buf)
{ {
struct clocksource *src; struct clocksource *src;
ssize_t count = 0; ssize_t count = 0;
...@@ -990,17 +991,7 @@ sysfs_show_available_clocksources(struct device *dev, ...@@ -990,17 +991,7 @@ sysfs_show_available_clocksources(struct device *dev,
return count; return count;
} }
static DEVICE_ATTR_RO(available_clocksource);
/*
* 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 struct bus_type clocksource_subsys = { static struct bus_type clocksource_subsys = {
.name = "clocksource", .name = "clocksource",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment