Commit ab25a501 authored by Julian Wiedmann's avatar Julian Wiedmann Committed by David S. Miller

s390/qeth: simplify L3 sysfs group management

Use the right helpers to create/remove all attribute groups in one go.
Suggested-by: default avatarHans Wippel <hwippel@linux.vnet.ibm.com>
Signed-off-by: default avatarJulian Wiedmann <jwi@linux.vnet.ibm.com>
Reviewed-by: default avatarUrsula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7c2e9ba3
...@@ -1028,52 +1028,31 @@ static const struct attribute_group qeth_device_rxip_group = { ...@@ -1028,52 +1028,31 @@ static const struct attribute_group qeth_device_rxip_group = {
.attrs = qeth_rxip_device_attrs, .attrs = qeth_rxip_device_attrs,
}; };
static const struct attribute_group *qeth_l3_only_attr_groups[] = {
&qeth_l3_device_attr_group,
&qeth_device_ipato_group,
&qeth_device_vipa_group,
&qeth_device_rxip_group,
NULL,
};
int qeth_l3_create_device_attributes(struct device *dev) int qeth_l3_create_device_attributes(struct device *dev)
{ {
int ret; return sysfs_create_groups(&dev->kobj, qeth_l3_only_attr_groups);
ret = sysfs_create_group(&dev->kobj, &qeth_l3_device_attr_group);
if (ret)
return ret;
ret = sysfs_create_group(&dev->kobj, &qeth_device_ipato_group);
if (ret) {
sysfs_remove_group(&dev->kobj, &qeth_l3_device_attr_group);
return ret;
}
ret = sysfs_create_group(&dev->kobj, &qeth_device_vipa_group);
if (ret) {
sysfs_remove_group(&dev->kobj, &qeth_l3_device_attr_group);
sysfs_remove_group(&dev->kobj, &qeth_device_ipato_group);
return ret;
}
ret = sysfs_create_group(&dev->kobj, &qeth_device_rxip_group);
if (ret) {
sysfs_remove_group(&dev->kobj, &qeth_l3_device_attr_group);
sysfs_remove_group(&dev->kobj, &qeth_device_ipato_group);
sysfs_remove_group(&dev->kobj, &qeth_device_vipa_group);
return ret;
}
return 0;
} }
void qeth_l3_remove_device_attributes(struct device *dev) void qeth_l3_remove_device_attributes(struct device *dev)
{ {
sysfs_remove_group(&dev->kobj, &qeth_l3_device_attr_group); sysfs_remove_groups(&dev->kobj, qeth_l3_only_attr_groups);
sysfs_remove_group(&dev->kobj, &qeth_device_ipato_group);
sysfs_remove_group(&dev->kobj, &qeth_device_vipa_group);
sysfs_remove_group(&dev->kobj, &qeth_device_rxip_group);
} }
const struct attribute_group *qeth_l3_attr_groups[] = { const struct attribute_group *qeth_l3_attr_groups[] = {
&qeth_device_attr_group, &qeth_device_attr_group,
&qeth_device_blkt_group, &qeth_device_blkt_group,
/* l3 specific, see l3_{create,remove}_device_attributes(): */ /* l3 specific, see qeth_l3_only_attr_groups: */
&qeth_l3_device_attr_group, &qeth_l3_device_attr_group,
&qeth_device_ipato_group, &qeth_device_ipato_group,
&qeth_device_vipa_group, &qeth_device_vipa_group,
&qeth_device_rxip_group, &qeth_device_rxip_group,
NULL, NULL,
}; };
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