diff options
Diffstat (limited to 'pending')
| -rw-r--r-- | pending/driver-core-add-binary-attributes-to-struct-device.patch | 65 | ||||
| -rw-r--r-- | pending/driver-core-remove-bin_attrs-from-struct-device.patch | 59 |
2 files changed, 124 insertions, 0 deletions
diff --git a/pending/driver-core-add-binary-attributes-to-struct-device.patch b/pending/driver-core-add-binary-attributes-to-struct-device.patch new file mode 100644 index 00000000000000..caf89bac3621ad --- /dev/null +++ b/pending/driver-core-add-binary-attributes-to-struct-device.patch @@ -0,0 +1,65 @@ +From foo@baz Sat Jul 6 17:21:15 PDT 2013 +Date: Sat, 06 Jul 2013 17:21:15 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: driver core: add binary attributes to struct device + +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +This lets a device provide a set of default binary attributes, like +normal attributes, that are initialized and torn down by the driver core +at the proper times, so that there are no races with userspace. + + +Reported-by: Oliver Schinagl <oliver+list@schinagl.nl> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + + +--- + drivers/base/core.c | 7 +++++++ + include/linux/device.h | 2 ++ + 2 files changed, 9 insertions(+) + +--- a/drivers/base/core.c ++++ b/drivers/base/core.c +@@ -491,8 +491,14 @@ static int device_add_attrs(struct devic + 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); +@@ -510,6 +516,7 @@ static void device_remove_attrs(struct d + + device_remove_file(dev, &online_attr); + device_remove_groups(dev, dev->groups); ++ device_remove_bin_attributes(dev, dev->bin_attrs); + + if (type) + device_remove_groups(dev, type->groups); +--- a/include/linux/device.h ++++ b/include/linux/device.h +@@ -656,6 +656,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). +@@ -732,6 +733,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; diff --git a/pending/driver-core-remove-bin_attrs-from-struct-device.patch b/pending/driver-core-remove-bin_attrs-from-struct-device.patch new file mode 100644 index 00000000000000..fb15c4c0a7e05f --- /dev/null +++ b/pending/driver-core-remove-bin_attrs-from-struct-device.patch @@ -0,0 +1,59 @@ +From foo@baz Wed Jul 10 11:59:39 PDT 2013 +Date: Wed, 10 Jul 2013 11:59:39 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: driver core: remove bin_attrs from struct device + +No one is using the bin_attrs field in struct device, and now that you +can add them properly through an attribute group, it isn't needed +either, so remove it. + +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/base/core.c | 7 ------- + include/linux/device.h | 2 -- + 2 files changed, 9 deletions(-) + +--- a/drivers/base/core.c ++++ b/drivers/base/core.c +@@ -491,14 +491,8 @@ static int device_add_attrs(struct devic + 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); +@@ -516,7 +510,6 @@ static void device_remove_attrs(struct d + + device_remove_file(dev, &online_attr); + device_remove_groups(dev, dev->groups); +- device_remove_bin_attributes(dev, dev->bin_attrs); + + if (type) + device_remove_groups(dev, type->groups); +--- a/include/linux/device.h ++++ b/include/linux/device.h +@@ -656,7 +656,6 @@ 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). +@@ -733,7 +732,6 @@ 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; |
