diff options
| author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-10 17:17:50 -0700 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-10 17:17:50 -0700 |
| commit | cf780b16c24465a06fe5a383b0d7c6684bc33fc6 (patch) | |
| tree | 84b63b6a40ab089b554dc4e58b9e4d0cf9b45623 | |
| parent | f2d9b9e684db7d5c4a01ffd0a74ec39d08d07452 (diff) | |
| download | patches-cf780b16c24465a06fe5a383b0d7c6684bc33fc6.tar.gz | |
updates and fixes
| -rw-r--r-- | driver-core-add-default-groups-to-struct-class.patch | 4 | ||||
| -rw-r--r-- | driver-core-introduce-device_create_groups.patch | 2 | ||||
| -rw-r--r-- | series | 5 | ||||
| -rw-r--r-- | sysfs-add-support-for-binary-attributes-in-groups.patch | 89 |
4 files changed, 70 insertions, 30 deletions
diff --git a/driver-core-add-default-groups-to-struct-class.patch b/driver-core-add-default-groups-to-struct-class.patch index 29a19d6e329814..b9fdfc05ff7445 100644 --- a/driver-core-add-default-groups-to-struct-class.patch +++ b/driver-core-add-default-groups-to-struct-class.patch @@ -53,7 +53,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- a/include/linux/device.h +++ b/include/linux/device.h -@@ -313,6 +313,7 @@ int subsys_virtual_register(struct bus_t +@@ -320,6 +320,7 @@ int subsys_virtual_register(struct bus_t * @name: Name of the class. * @owner: The module owner. * @class_attrs: Default attributes of this class. @@ -61,7 +61,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> * @dev_attrs: Default attributes of the devices belong to the class. * @dev_bin_attrs: Default binary attributes of the devices belong to the class. * @dev_kobj: The kobject that represents this class and links it into the hierarchy. -@@ -342,7 +343,8 @@ struct class { +@@ -349,7 +350,8 @@ struct class { struct module *owner; struct class_attribute *class_attrs; diff --git a/driver-core-introduce-device_create_groups.patch b/driver-core-introduce-device_create_groups.patch index 5d4a215c4967c1..e73fe6ef2236d6 100644 --- a/driver-core-introduce-device_create_groups.patch +++ b/driver-core-introduce-device_create_groups.patch @@ -165,7 +165,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> const dev_t *devt = data; --- a/include/linux/device.h +++ b/include/linux/device.h -@@ -928,6 +928,11 @@ extern __printf(5, 6) +@@ -938,6 +938,11 @@ extern __printf(5, 6) struct device *device_create(struct class *cls, struct device *parent, dev_t devt, void *drvdata, const char *fmt, ...); @@ -7,11 +7,10 @@ sysfs.h-add-bin_attr-macro.patch driver-core-add-device_attr_rw-and-device_attr_ro-macros.patch sysfs-add-support-for-binary-attributes-in-groups.patch driver-core-introduce-device_create_groups.patch - -misc-c2port-use-dev_bin_attrs-instead-of-hand-coding-it.patch +driver-core-add-default-groups-to-struct-class.patch # dev_groups to struct class work -driver-core-add-default-groups-to-struct-class.patch +misc-c2port-use-dev_bin_attrs-instead-of-hand-coding-it.patch mips-convert-vpe_class-to-use-dev_groups.patch bsr-convert-bsr_class-to-use-dev_groups.patch tile-srom-convert-srom_class-to-use-dev_groups.patch diff --git a/sysfs-add-support-for-binary-attributes-in-groups.patch b/sysfs-add-support-for-binary-attributes-in-groups.patch index fd52199e90ba37..42521e6488bcd2 100644 --- a/sysfs-add-support-for-binary-attributes-in-groups.patch +++ b/sysfs-add-support-for-binary-attributes-in-groups.patch @@ -14,13 +14,13 @@ Reported-by: Oliver Schinagl <oliver+list@schinagl.nl> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- - fs/sysfs/group.c | 20 ++++++++++++++++++-- - include/linux/sysfs.h | 4 ++-- - 2 files changed, 20 insertions(+), 4 deletions(-) + fs/sysfs/group.c | 66 ++++++++++++++++++++++++++++++++++---------------- + include/linux/sysfs.h | 4 +-- + 2 files changed, 48 insertions(+), 22 deletions(-) --- a/fs/sysfs/group.c +++ b/fs/sysfs/group.c -@@ -20,16 +20,19 @@ static void remove_files(struct sysfs_di +@@ -20,38 +20,64 @@ static void remove_files(struct sysfs_di const struct attribute_group *grp) { struct attribute *const* attr; @@ -28,10 +28,13 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + struct bin_attribute *const* bin_attr; - for (i = 0, attr = grp->attrs; *attr; i++, attr++) -+ for (attr = grp->attrs; *attr; attr++) - sysfs_hash_and_remove(dir_sd, NULL, (*attr)->name); -+ for (bin_attr = grp->bin_attrs; *bin_attr; bin_attr++) -+ sysfs_remove_bin_file(kobj, *bin_attr); +- sysfs_hash_and_remove(dir_sd, NULL, (*attr)->name); ++ if (grp->attrs) ++ for (attr = grp->attrs; *attr; attr++) ++ sysfs_hash_and_remove(dir_sd, NULL, (*attr)->name); ++ if (grp->bin_attrs) ++ for (bin_attr = grp->bin_attrs; *bin_attr; bin_attr++) ++ sysfs_remove_bin_file(kobj, *bin_attr); } static int create_files(struct sysfs_dirent *dir_sd, struct kobject *kobj, @@ -41,25 +44,63 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + struct bin_attribute *const* bin_attr; int error = 0, i; - for (i = 0, attr = grp->attrs; *attr && !error; i++, attr++) { -@@ -50,8 +53,21 @@ static int create_files(struct sysfs_dir - if (unlikely(error)) - break; - } -+ if (error) { -+ remove_files(dir_sd, kobj, grp); -+ goto exit; +- for (i = 0, attr = grp->attrs; *attr && !error; i++, attr++) { +- umode_t mode = 0; ++ if (grp->attrs) { ++ for (i = 0, attr = grp->attrs; *attr && !error; i++, attr++) { ++ umode_t mode = 0; + +- /* in update mode, we're changing the permissions or +- * visibility. Do this by first removing then +- * re-adding (if required) the file */ +- if (update) +- sysfs_hash_and_remove(dir_sd, NULL, (*attr)->name); +- if (grp->is_visible) { +- mode = grp->is_visible(kobj, *attr, i); +- if (!mode) +- continue; ++ /* ++ * In update mode, we're changing the permissions or ++ * visibility. Do this by first removing then ++ * re-adding (if required) the file. ++ */ ++ if (update) ++ sysfs_hash_and_remove(dir_sd, NULL, ++ (*attr)->name); ++ if (grp->is_visible) { ++ mode = grp->is_visible(kobj, *attr, i); ++ if (!mode) ++ continue; ++ } ++ error = sysfs_add_file_mode(dir_sd, *attr, ++ SYSFS_KOBJ_ATTR, ++ (*attr)->mode | mode); ++ if (unlikely(error)) ++ break; ++ } ++ if (error) { ++ remove_files(dir_sd, kobj, grp); ++ goto exit; ++ } + } + -+ for (bin_attr = grp->bin_attrs; *bin_attr; bin_attr++) { -+ if (update) -+ sysfs_remove_bin_file(kobj, *bin_attr); -+ error = sysfs_create_bin_file(kobj, *bin_attr); ++ if (grp->bin_attrs) { ++ for (bin_attr = grp->bin_attrs; *bin_attr; bin_attr++) { ++ if (update) ++ sysfs_remove_bin_file(kobj, *bin_attr); ++ error = sysfs_create_bin_file(kobj, *bin_attr); ++ if (error) ++ break; + } +- error = sysfs_add_file_mode(dir_sd, *attr, SYSFS_KOBJ_ATTR, +- (*attr)->mode | mode); +- if (unlikely(error)) +- break; + if (error) -+ break; -+ } - if (error) - remove_files(dir_sd, kobj, grp); ++ remove_files(dir_sd, kobj, grp); + } +- if (error) +- remove_files(dir_sd, kobj, grp); +exit: return error; } |
