Skip to content

Commit

Permalink
clocksource: Use ATTRIBUTE_GROUPS
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Baolin Wang authored and Thomas Gleixner committed Feb 28, 2018
1 parent e87821d commit 27263e8
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions kernel/time/clocksource.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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)
Expand All @@ -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;
}

Expand Down

0 comments on commit 27263e8

Please sign in to comment.