s390/stp: let subsys_system_register() sysfs attributes
Instead of creating the sysfs attributes for the stp root_dev by hand, pass them to subsys_system_register() as parameter. This also ensures that the attributes are available when the KOBJ_ADD event is raised. Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
This commit is contained in:
parent
ba1a6be994
commit
074ff04e27
|
@ -927,41 +927,25 @@ static ssize_t online_store(struct device *dev,
|
|||
*/
|
||||
static DEVICE_ATTR_RW(online);
|
||||
|
||||
static struct device_attribute *stp_attributes[] = {
|
||||
&dev_attr_ctn_id,
|
||||
&dev_attr_ctn_type,
|
||||
&dev_attr_dst_offset,
|
||||
&dev_attr_leap_seconds,
|
||||
&dev_attr_online,
|
||||
&dev_attr_leap_seconds_scheduled,
|
||||
&dev_attr_stratum,
|
||||
&dev_attr_time_offset,
|
||||
&dev_attr_time_zone_offset,
|
||||
&dev_attr_timing_mode,
|
||||
&dev_attr_timing_state,
|
||||
static struct attribute *stp_dev_attrs[] = {
|
||||
&dev_attr_ctn_id.attr,
|
||||
&dev_attr_ctn_type.attr,
|
||||
&dev_attr_dst_offset.attr,
|
||||
&dev_attr_leap_seconds.attr,
|
||||
&dev_attr_online.attr,
|
||||
&dev_attr_leap_seconds_scheduled.attr,
|
||||
&dev_attr_stratum.attr,
|
||||
&dev_attr_time_offset.attr,
|
||||
&dev_attr_time_zone_offset.attr,
|
||||
&dev_attr_timing_mode.attr,
|
||||
&dev_attr_timing_state.attr,
|
||||
NULL
|
||||
};
|
||||
ATTRIBUTE_GROUPS(stp_dev);
|
||||
|
||||
static int __init stp_init_sysfs(void)
|
||||
{
|
||||
struct device_attribute **attr;
|
||||
int rc;
|
||||
|
||||
rc = subsys_system_register(&stp_subsys, NULL);
|
||||
if (rc)
|
||||
goto out;
|
||||
for (attr = stp_attributes; *attr; attr++) {
|
||||
rc = device_create_file(stp_subsys.dev_root, *attr);
|
||||
if (rc)
|
||||
goto out_unreg;
|
||||
}
|
||||
return 0;
|
||||
out_unreg:
|
||||
for (; attr >= stp_attributes; attr--)
|
||||
device_remove_file(stp_subsys.dev_root, *attr);
|
||||
bus_unregister(&stp_subsys);
|
||||
out:
|
||||
return rc;
|
||||
return subsys_system_register(&stp_subsys, stp_dev_groups);
|
||||
}
|
||||
|
||||
device_initcall(stp_init_sysfs);
|
||||
|
|
Loading…
Reference in New Issue