summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaolin Wang <baolin.wang@linaro.org>2018-01-17 09:01:30 +0300
committerThomas Gleixner <tglx@linutronix.de>2018-02-28 16:05:07 +0300
commit27263e8dc0f6fe27540a843611ec14a000591c41 (patch)
treecd5a742bfbcfb1f6a5a22f439bb5f611c33ba4f2
parente87821d18cf4db19d634a04061c0a1b7eb9c0e65 (diff)
downloadlinux-27263e8dc0f6fe27540a843611ec14a000591c41.tar.xz
clocksource: Use ATTRIBUTE_GROUPS
Use ATTRIBUTE_GROUPS instead of manually creating the individual device files. 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/d80dccb981dc2461781ebb8d71a32ccdc1b0e6f9.1516167691.git.baolin.wang@linaro.org
-rw-r--r--kernel/time/clocksource.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 7ce53465782b..0e974cface0b 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -993,6 +993,14 @@ static ssize_t available_clocksource_show(struct device *dev,
}
static DEVICE_ATTR_RO(available_clocksource);
+static struct attribute *clocksource_attrs[] = {
+ &dev_attr_current_clocksource.attr,
+ &dev_attr_unbind_clocksource.attr,
+ &dev_attr_available_clocksource.attr,
+ NULL
+};
+ATTRIBUTE_GROUPS(clocksource);
+
static struct bus_type clocksource_subsys = {
.name = "clocksource",
.dev_name = "clocksource",
@@ -1001,6 +1009,7 @@ static struct bus_type clocksource_subsys = {
static struct device device_clocksource = {
.id = 0,
.bus = &clocksource_subsys,
+ .groups = clocksource_groups,
};
static int __init init_clocksource_sysfs(void)
@@ -1009,17 +1018,7 @@ static int __init init_clocksource_sysfs(void)
if (!error)
error = device_register(&device_clocksource);
- if (!error)
- error = device_create_file(
- &device_clocksource,
- &dev_attr_current_clocksource);
- if (!error)
- error = device_create_file(&device_clocksource,
- &dev_attr_unbind_clocksource);
- if (!error)
- error = device_create_file(
- &device_clocksource,
- &dev_attr_available_clocksource);
+
return error;
}