diff options
author | Baolin Wang <baolin.wang@linaro.org> | 2018-01-17 01:01:30 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2018-02-28 08:05:07 -0500 |
commit | 27263e8dc0f6fe27540a843611ec14a000591c41 (patch) | |
tree | cd5a742bfbcfb1f6a5a22f439bb5f611c33ba4f2 | |
parent | e87821d18cf4db19d634a04061c0a1b7eb9c0e65 (diff) |
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.c | 21 |
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, | |||
993 | } | 993 | } |
994 | static DEVICE_ATTR_RO(available_clocksource); | 994 | static DEVICE_ATTR_RO(available_clocksource); |
995 | 995 | ||
996 | static struct attribute *clocksource_attrs[] = { | ||
997 | &dev_attr_current_clocksource.attr, | ||
998 | &dev_attr_unbind_clocksource.attr, | ||
999 | &dev_attr_available_clocksource.attr, | ||
1000 | NULL | ||
1001 | }; | ||
1002 | ATTRIBUTE_GROUPS(clocksource); | ||
1003 | |||
996 | static struct bus_type clocksource_subsys = { | 1004 | static struct bus_type clocksource_subsys = { |
997 | .name = "clocksource", | 1005 | .name = "clocksource", |
998 | .dev_name = "clocksource", | 1006 | .dev_name = "clocksource", |
@@ -1001,6 +1009,7 @@ static struct bus_type clocksource_subsys = { | |||
1001 | static struct device device_clocksource = { | 1009 | static struct device device_clocksource = { |
1002 | .id = 0, | 1010 | .id = 0, |
1003 | .bus = &clocksource_subsys, | 1011 | .bus = &clocksource_subsys, |
1012 | .groups = clocksource_groups, | ||
1004 | }; | 1013 | }; |
1005 | 1014 | ||
1006 | static int __init init_clocksource_sysfs(void) | 1015 | static int __init init_clocksource_sysfs(void) |
@@ -1009,17 +1018,7 @@ static int __init init_clocksource_sysfs(void) | |||
1009 | 1018 | ||
1010 | if (!error) | 1019 | if (!error) |
1011 | error = device_register(&device_clocksource); | 1020 | error = device_register(&device_clocksource); |
1012 | if (!error) | 1021 | |
1013 | error = device_create_file( | ||
1014 | &device_clocksource, | ||
1015 | &dev_attr_current_clocksource); | ||
1016 | if (!error) | ||
1017 | error = device_create_file(&device_clocksource, | ||
1018 | &dev_attr_unbind_clocksource); | ||
1019 | if (!error) | ||
1020 | error = device_create_file( | ||
1021 | &device_clocksource, | ||
1022 | &dev_attr_available_clocksource); | ||
1023 | return error; | 1022 | return error; |
1024 | } | 1023 | } |
1025 | 1024 | ||