diff options
| author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-08 22:48:17 -0700 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-08 22:48:17 -0700 |
| commit | e3969ac8cec3b143aa777a5d3f531c6e660da5b9 (patch) | |
| tree | 76e2d21cca3b3a08f70fbe89ae16d1f4621c55c9 | |
| parent | 587ab858102ac95c961d6118a62078dc25b1ee3a (diff) | |
| download | patches-e3969ac8cec3b143aa777a5d3f531c6e660da5b9.tar.gz | |
driver core patches added
| -rw-r--r-- | d1.patch | 4 | ||||
| -rw-r--r-- | driver-core-add-binary-attributes-to-struct-device.patch | 83 | ||||
| -rw-r--r-- | driver-core-add-device_attr_rw-and-device_attr_ro-macros.patch | 28 | ||||
| -rw-r--r-- | series | 2 |
4 files changed, 115 insertions, 2 deletions
diff --git a/d1.patch b/d1.patch index 9073f2105da82a..8855ad8f4afaba 100644 --- a/d1.patch +++ b/d1.patch @@ -49,7 +49,7 @@ Subject: meta-patch of all of the dev_attr conversions } if (type) { -@@ -560,9 +563,12 @@ static int device_add_attrs(struct devic +@@ -566,9 +569,12 @@ static int device_add_attrs(struct devic err_remove_class_bin_attrs: if (class) device_remove_bin_attributes(dev, class->dev_bin_attrs); @@ -64,7 +64,7 @@ Subject: meta-patch of all of the dev_attr conversions return error; } -@@ -579,7 +585,8 @@ static void device_remove_attrs(struct d +@@ -586,7 +592,8 @@ static void device_remove_attrs(struct d device_remove_groups(dev, type->groups); if (class) { diff --git a/driver-core-add-binary-attributes-to-struct-device.patch b/driver-core-add-binary-attributes-to-struct-device.patch new file mode 100644 index 00000000000000..658a6ccca87939 --- /dev/null +++ b/driver-core-add-binary-attributes-to-struct-device.patch @@ -0,0 +1,83 @@ +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 | 11 +++++++++-- + include/linux/device.h | 2 ++ + 2 files changed, 11 insertions(+), 2 deletions(-) + +--- a/drivers/base/core.c ++++ b/drivers/base/core.c +@@ -463,7 +463,7 @@ static void device_remove_attributes(str + } + + static int device_add_bin_attributes(struct device *dev, +- struct bin_attribute *attrs) ++ const struct bin_attribute *attrs) + { + int error = 0; + int i; +@@ -482,7 +482,7 @@ static int device_add_bin_attributes(str + } + + static void device_remove_bin_attributes(struct device *dev, +- struct bin_attribute *attrs) ++ const struct bin_attribute *attrs) + { + int i; + +@@ -552,8 +552,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); +@@ -574,6 +580,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 +@@ -658,6 +658,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). +@@ -734,6 +735,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/driver-core-add-device_attr_rw-and-device_attr_ro-macros.patch b/driver-core-add-device_attr_rw-and-device_attr_ro-macros.patch new file mode 100644 index 00000000000000..9dcdbce63fb8a1 --- /dev/null +++ b/driver-core-add-device_attr_rw-and-device_attr_ro-macros.patch @@ -0,0 +1,28 @@ +From foo@baz Mon Jul 8 22:44:37 PDT 2013 +Date: Mon, 08 Jul 2013 22:44:37 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: driver core: add DEVICE_ATTR_RW and DEVICE_ATTR_RO macros + +Make it easier to create attributes without having to always audit the +mode settings. + +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + include/linux/device.h | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/include/linux/device.h ++++ b/include/linux/device.h +@@ -512,6 +512,10 @@ ssize_t device_store_bool(struct device + + #define DEVICE_ATTR(_name, _mode, _show, _store) \ + struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) ++#define DEVICE_ATTR_RW(_name, _mode, _show, _store) \ ++ struct device_attribute dev_attr_##_name = __ATTR_RW(_name) ++#define DEVICE_ATTR_RO(_name, _mode, _show, _store) \ ++ struct device_attribute dev_attr_##_name = __ATTR_RO(_name) + #define DEVICE_ULONG_ATTR(_name, _mode, _var) \ + struct dev_ext_attribute dev_attr_##_name = \ + { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) } @@ -1,6 +1,8 @@ # My specific stuff, at the top to make it easier to work stuff below. sysfs.h-add-__attr_rw-macro.patch sysfs.h-add-attribute_groups-macro.patch +driver-core-add-device_attr_rw-and-device_attr_ro-macros.patch +driver-core-add-binary-attributes-to-struct-device.patch misc-c2port-use-dev_bin_attrs-instead-of-hand-coding-it.patch d1.patch usb-ldusb-remove-custom-dbg_info-macro.patch |
