|
@@ -455,35 +455,6 @@ static ssize_t online_store(struct device *dev, struct device_attribute *attr,
|
|
|
}
|
|
|
static DEVICE_ATTR_RW(online);
|
|
|
|
|
|
-static int device_add_attributes(struct device *dev,
|
|
|
- struct device_attribute *attrs)
|
|
|
-{
|
|
|
- int error = 0;
|
|
|
- int i;
|
|
|
-
|
|
|
- if (attrs) {
|
|
|
- for (i = 0; attrs[i].attr.name; i++) {
|
|
|
- error = device_create_file(dev, &attrs[i]);
|
|
|
- if (error)
|
|
|
- break;
|
|
|
- }
|
|
|
- if (error)
|
|
|
- while (--i >= 0)
|
|
|
- device_remove_file(dev, &attrs[i]);
|
|
|
- }
|
|
|
- return error;
|
|
|
-}
|
|
|
-
|
|
|
-static void device_remove_attributes(struct device *dev,
|
|
|
- struct device_attribute *attrs)
|
|
|
-{
|
|
|
- int i;
|
|
|
-
|
|
|
- if (attrs)
|
|
|
- for (i = 0; attrs[i].attr.name; i++)
|
|
|
- device_remove_file(dev, &attrs[i]);
|
|
|
-}
|
|
|
-
|
|
|
static int device_add_bin_attributes(struct device *dev,
|
|
|
struct bin_attribute *attrs)
|
|
|
{
|
|
@@ -534,12 +505,9 @@ static int device_add_attrs(struct device *dev)
|
|
|
error = device_add_groups(dev, class->dev_groups);
|
|
|
if (error)
|
|
|
return error;
|
|
|
- error = device_add_attributes(dev, class->dev_attrs);
|
|
|
- if (error)
|
|
|
- goto err_remove_class_groups;
|
|
|
error = device_add_bin_attributes(dev, class->dev_bin_attrs);
|
|
|
if (error)
|
|
|
- goto err_remove_class_attrs;
|
|
|
+ goto err_remove_class_groups;
|
|
|
}
|
|
|
|
|
|
if (type) {
|
|
@@ -566,9 +534,6 @@ static int device_add_attrs(struct device *dev)
|
|
|
err_remove_class_bin_attrs:
|
|
|
if (class)
|
|
|
device_remove_bin_attributes(dev, class->dev_bin_attrs);
|
|
|
- err_remove_class_attrs:
|
|
|
- if (class)
|
|
|
- device_remove_attributes(dev, class->dev_attrs);
|
|
|
err_remove_class_groups:
|
|
|
if (class)
|
|
|
device_remove_groups(dev, class->dev_groups);
|
|
@@ -588,7 +553,6 @@ static void device_remove_attrs(struct device *dev)
|
|
|
device_remove_groups(dev, type->groups);
|
|
|
|
|
|
if (class) {
|
|
|
- device_remove_attributes(dev, class->dev_attrs);
|
|
|
device_remove_bin_attributes(dev, class->dev_bin_attrs);
|
|
|
device_remove_groups(dev, class->dev_groups);
|
|
|
}
|