@@ -433,7 +433,7 @@ static void device_remove_attributes(struct device *dev,
}
static int device_add_bin_attributes(struct device *dev,
- struct bin_attribute *attrs)
+ const struct bin_attribute *attrs)
{
int error = 0;
int i;
@@ -452,7 +452,7 @@ static int device_add_bin_attributes(struct device *dev,
}
static void device_remove_bin_attributes(struct device *dev,
- struct bin_attribute *attrs)
+ const struct bin_attribute *attrs)
{
int i;
@@ -516,8 +516,14 @@ static int device_add_attrs(struct device *dev)
if (error)
goto err_remove_type_groups;
+ error = device_add_bin_attributes(dev, dev->bin_attrs);
+ if (error)
+ goto err_remove_groups;
return 0;
+ err_remove_groups:
+ device_remove_groups(dev, dev->groups);
+
err_remove_type_groups:
if (type)
device_remove_groups(dev, type->groups);
@@ -537,6 +543,7 @@ static void device_remove_attrs(struct device *dev)
const struct device_type *type = dev->type;
device_remove_groups(dev, dev->groups);
+ device_remove_bin_attributes(dev, dev->bin_attrs);
if (type)
device_remove_groups(dev, type->groups);
@@ -645,6 +645,7 @@ struct acpi_dev_node {
* @knode_class: The node used to add the device to the class list.
* @class: The class of the device.
* @groups: Optional attribute groups.
+ * @bin_attrs: Optional binary attributes for this device.
* @release: Callback to free the device after all references have
* gone away. This should be set by the allocator of the
* device (i.e. the bus driver that discovered the device).
@@ -717,6 +718,7 @@ struct device {
struct klist_node knode_class;
struct class *class;
const struct attribute_group **groups; /* optional groups */
+ const struct bin_attribute *bin_attrs;
void (*release)(struct device *dev);
struct iommu_group *iommu_group;