diff options
| author | Greg Kroah-Hartman <gregkh@suse.de> | 2007-11-02 15:32:47 -0700 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-11-02 15:32:47 -0700 |
| commit | 01bd5ebddeb41500adcab5d8701bdf9d64d7ef92 (patch) | |
| tree | a636e07a7096d6299f4d308b529310cf49835cb7 | |
| parent | fe94b2cd20d48a790977b4de0d076cee823e7996 (diff) | |
| download | patches-01bd5ebddeb41500adcab5d8701bdf9d64d7ef92.tar.gz | |
finally kill the sysfs_attributes!!!
| -rw-r--r-- | driver/kobject-convert-parisc-pdc_stable-to-kobj_attr-interface.patch | 419 | ||||
| -rw-r--r-- | driver/kset-convert-parisc-pdc_stable.c-to-use-kset_create.patch | 104 | ||||
| -rw-r--r-- | driver/kset-kill-subsys-attr.patch (renamed from pending/kset-kill-subsys-attr.patch) | 23 | ||||
| -rw-r--r-- | driver/sysfs-crash-debugging.patch | 16 | ||||
| -rw-r--r-- | pending/sysfs-crash-debugging.patch | 123 | ||||
| -rw-r--r-- | series | 4 |
6 files changed, 541 insertions, 148 deletions
diff --git a/driver/kobject-convert-parisc-pdc_stable-to-kobj_attr-interface.patch b/driver/kobject-convert-parisc-pdc_stable-to-kobj_attr-interface.patch new file mode 100644 index 00000000000000..75393f6deecedc --- /dev/null +++ b/driver/kobject-convert-parisc-pdc_stable-to-kobj_attr-interface.patch @@ -0,0 +1,419 @@ +From foo@baz Tue Apr 9 12:12:43 2002 +Date: Fri, 2 Nov 2007 15:25:00 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: kobject: convert parisc/pdc_stable to kobj_attr interface + +This makes the code a bit simpler and and gets us one step closer to +deleting the deprecated subsys_attr code. + +NOTE, this needs the next patch in the series in order to work properly. +This will build, but the sysfs files will not properly operate. + +Cc: Kay Sievers <kay.sievers@vrfy.org> +Cc: Thibaut VARENE <varenet@parisc-linux.org> +Cc: Matthew Wilcox <matthew@wil.cx> +Cc: Grant Grundler <grundler@parisc-linux.org> +Cc: Kyle McMartin <kyle@parisc-linux.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/parisc/pdc_stable.c | 147 ++++++++++++++++++++------------------------ + 1 file changed, 70 insertions(+), 77 deletions(-) + +--- a/drivers/parisc/pdc_stable.c ++++ b/drivers/parisc/pdc_stable.c +@@ -120,7 +120,7 @@ struct pdcspath_entry pdcspath_entry_##_ + }; + + #define PDCS_ATTR(_name, _mode, _show, _store) \ +-struct subsys_attribute pdcs_attr_##_name = { \ ++struct kobj_attribute pdcs_attr_##_name = { \ + .attr = {.name = __stringify(_name), .mode = _mode}, \ + .show = _show, \ + .store = _store, \ +@@ -523,15 +523,15 @@ static struct pdcspath_entry *pdcspath_e + + /** + * pdcs_size_read - Stable Storage size output. +- * @kset: An allocated and populated struct kset. We don't use it tho. + * @buf: The output buffer to write to. + */ +-static ssize_t +-pdcs_size_read(struct kset *kset, char *buf) ++static ssize_t pdcs_size_read(struct kobject *kobj, ++ struct kobj_attribute *attr, ++ char *buf) + { + char *out = buf; + +- if (!kset || !buf) ++ if (!buf) + return -EINVAL; + + /* show the size of the stable storage */ +@@ -542,17 +542,17 @@ pdcs_size_read(struct kset *kset, char * + + /** + * pdcs_auto_read - Stable Storage autoboot/search flag output. +- * @kset: An allocated and populated struct kset. We don't use it tho. + * @buf: The output buffer to write to. + * @knob: The PF_AUTOBOOT or PF_AUTOSEARCH flag + */ +-static ssize_t +-pdcs_auto_read(struct kset *kset, char *buf, int knob) ++static ssize_t pdcs_auto_read(struct kobject *kobj, ++ struct kobj_attribute *attr, ++ char *buf, int knob) + { + char *out = buf; + struct pdcspath_entry *pathentry; + +- if (!kset || !buf) ++ if (!buf) + return -EINVAL; + + /* Current flags are stored in primary boot path entry */ +@@ -568,40 +568,37 @@ pdcs_auto_read(struct kset *kset, char * + + /** + * pdcs_autoboot_read - Stable Storage autoboot flag output. +- * @kset: An allocated and populated struct kset. We don't use it tho. + * @buf: The output buffer to write to. + */ +-static inline ssize_t +-pdcs_autoboot_read(struct kset *kset, char *buf) ++static ssize_t pdcs_autoboot_read(struct kobject *kobj, ++ struct kobj_attribute *attr, char *buf) + { +- return pdcs_auto_read(kset, buf, PF_AUTOBOOT); ++ return pdcs_auto_read(kobj, attr, buf, PF_AUTOBOOT); + } + + /** + * pdcs_autosearch_read - Stable Storage autoboot flag output. +- * @kset: An allocated and populated struct kset. We don't use it tho. + * @buf: The output buffer to write to. + */ +-static inline ssize_t +-pdcs_autosearch_read(struct kset *kset, char *buf) ++static ssize_t pdcs_autosearch_read(struct kobject *kobj, ++ struct kobj_attribute *attr, char *buf) + { +- return pdcs_auto_read(kset, buf, PF_AUTOSEARCH); ++ return pdcs_auto_read(kobj, attr, buf, PF_AUTOSEARCH); + } + + /** + * pdcs_timer_read - Stable Storage timer count output (in seconds). +- * @kset: An allocated and populated struct kset. We don't use it tho. + * @buf: The output buffer to write to. + * + * The value of the timer field correponds to a number of seconds in powers of 2. + */ +-static ssize_t +-pdcs_timer_read(struct kset *kset, char *buf) ++static ssize_t pdcs_timer_read(struct kobject *kobj, ++ struct kobj_attribute *attr, char *buf) + { + char *out = buf; + struct pdcspath_entry *pathentry; + +- if (!kset || !buf) ++ if (!buf) + return -EINVAL; + + /* Current flags are stored in primary boot path entry */ +@@ -618,15 +615,14 @@ pdcs_timer_read(struct kset *kset, char + + /** + * pdcs_osid_read - Stable Storage OS ID register output. +- * @kset: An allocated and populated struct kset. We don't use it tho. + * @buf: The output buffer to write to. + */ +-static ssize_t +-pdcs_osid_read(struct kset *kset, char *buf) ++static ssize_t pdcs_osid_read(struct kobject *kobj, ++ struct kobj_attribute *attr, char *buf) + { + char *out = buf; + +- if (!kset || !buf) ++ if (!buf) + return -EINVAL; + + out += sprintf(out, "%s dependent data (0x%.4x)\n", +@@ -637,18 +633,17 @@ pdcs_osid_read(struct kset *kset, char * + + /** + * pdcs_osdep1_read - Stable Storage OS-Dependent data area 1 output. +- * @kset: An allocated and populated struct kset. We don't use it tho. + * @buf: The output buffer to write to. + * + * This can hold 16 bytes of OS-Dependent data. + */ +-static ssize_t +-pdcs_osdep1_read(struct kset *kset, char *buf) ++static ssize_t pdcs_osdep1_read(struct kobject *kobj, ++ struct kobj_attribute *attr, char *buf) + { + char *out = buf; + u32 result[4]; + +- if (!kset || !buf) ++ if (!buf) + return -EINVAL; + + if (pdc_stable_read(PDCS_ADDR_OSD1, &result, sizeof(result)) != PDC_OK) +@@ -664,18 +659,17 @@ pdcs_osdep1_read(struct kset *kset, char + + /** + * pdcs_diagnostic_read - Stable Storage Diagnostic register output. +- * @kset: An allocated and populated struct kset. We don't use it tho. + * @buf: The output buffer to write to. + * + * I have NFC how to interpret the content of that register ;-). + */ +-static ssize_t +-pdcs_diagnostic_read(struct kset *kset, char *buf) ++static ssize_t pdcs_diagnostic_read(struct kobject *kobj, ++ struct kobj_attribute *attr, char *buf) + { + char *out = buf; + u32 result; + +- if (!kset || !buf) ++ if (!buf) + return -EINVAL; + + /* get diagnostic */ +@@ -689,18 +683,17 @@ pdcs_diagnostic_read(struct kset *kset, + + /** + * pdcs_fastsize_read - Stable Storage FastSize register output. +- * @kset: An allocated and populated struct kset. We don't use it tho. + * @buf: The output buffer to write to. + * + * This register holds the amount of system RAM to be tested during boot sequence. + */ +-static ssize_t +-pdcs_fastsize_read(struct kset *kset, char *buf) ++static ssize_t pdcs_fastsize_read(struct kobject *kobj, ++ struct kobj_attribute *attr, char *buf) + { + char *out = buf; + u32 result; + +- if (!kset || !buf) ++ if (!buf) + return -EINVAL; + + /* get fast-size */ +@@ -718,13 +711,12 @@ pdcs_fastsize_read(struct kset *kset, ch + + /** + * pdcs_osdep2_read - Stable Storage OS-Dependent data area 2 output. +- * @kset: An allocated and populated struct kset. We don't use it tho. + * @buf: The output buffer to write to. + * + * This can hold pdcs_size - 224 bytes of OS-Dependent data, when available. + */ +-static ssize_t +-pdcs_osdep2_read(struct kset *kset, char *buf) ++static ssize_t pdcs_osdep2_read(struct kobject *kobj, ++ struct kobj_attribute *attr, char *buf) + { + char *out = buf; + unsigned long size; +@@ -736,7 +728,7 @@ pdcs_osdep2_read(struct kset *kset, char + + size = pdcs_size - 224; + +- if (!kset || !buf) ++ if (!buf) + return -EINVAL; + + for (i=0; i<size; i+=4) { +@@ -751,7 +743,6 @@ pdcs_osdep2_read(struct kset *kset, char + + /** + * pdcs_auto_write - This function handles autoboot/search flag modifying. +- * @kset: An allocated and populated struct kset. We don't use it tho. + * @buf: The input buffer to read from. + * @count: The number of bytes to be read. + * @knob: The PF_AUTOBOOT or PF_AUTOSEARCH flag +@@ -760,8 +751,9 @@ pdcs_osdep2_read(struct kset *kset, char + * We expect a precise syntax: + * \"n\" (n == 0 or 1) to toggle AutoBoot Off or On + */ +-static ssize_t +-pdcs_auto_write(struct kset *kset, const char *buf, size_t count, int knob) ++static ssize_t pdcs_auto_write(struct kobject *kobj, ++ struct kobj_attribute *attr, const char *buf, ++ size_t count, int knob) + { + struct pdcspath_entry *pathentry; + unsigned char flags; +@@ -771,7 +763,7 @@ pdcs_auto_write(struct kset *kset, const + if (!capable(CAP_SYS_ADMIN)) + return -EACCES; + +- if (!kset || !buf || !count) ++ if (!buf || !count) + return -EINVAL; + + /* We'll use a local copy of buf */ +@@ -826,7 +818,6 @@ parse_error: + + /** + * pdcs_autoboot_write - This function handles autoboot flag modifying. +- * @kset: An allocated and populated struct kset. We don't use it tho. + * @buf: The input buffer to read from. + * @count: The number of bytes to be read. + * +@@ -834,15 +825,15 @@ parse_error: + * We expect a precise syntax: + * \"n\" (n == 0 or 1) to toggle AutoSearch Off or On + */ +-static inline ssize_t +-pdcs_autoboot_write(struct kset *kset, const char *buf, size_t count) ++static ssize_t pdcs_autoboot_write(struct kobject *kobj, ++ struct kobj_attribute *attr, ++ const char *buf, size_t count) + { +- return pdcs_auto_write(kset, buf, count, PF_AUTOBOOT); ++ return pdcs_auto_write(kset, attr, buf, count, PF_AUTOBOOT); + } + + /** + * pdcs_autosearch_write - This function handles autosearch flag modifying. +- * @kset: An allocated and populated struct kset. We don't use it tho. + * @buf: The input buffer to read from. + * @count: The number of bytes to be read. + * +@@ -850,15 +841,15 @@ pdcs_autoboot_write(struct kset *kset, c + * We expect a precise syntax: + * \"n\" (n == 0 or 1) to toggle AutoSearch Off or On + */ +-static inline ssize_t +-pdcs_autosearch_write(struct kset *kset, const char *buf, size_t count) ++static ssize_t pdcs_autosearch_write(struct kobject *kobj, ++ struct kobj_attribute *attr, ++ const char *buf, size_t count) + { +- return pdcs_auto_write(kset, buf, count, PF_AUTOSEARCH); ++ return pdcs_auto_write(kset, attr, buf, count, PF_AUTOSEARCH); + } + + /** + * pdcs_osdep1_write - Stable Storage OS-Dependent data area 1 input. +- * @kset: An allocated and populated struct kset. We don't use it tho. + * @buf: The input buffer to read from. + * @count: The number of bytes to be read. + * +@@ -866,15 +857,16 @@ pdcs_autosearch_write(struct kset *kset, + * write approach. It's up to userspace to deal with it when constructing + * its input buffer. + */ +-static ssize_t +-pdcs_osdep1_write(struct kset *kset, const char *buf, size_t count) ++static ssize_t pdcs_osdep1_write(struct kobject *kobj, ++ struct kobj_attribute *attr, ++ const char *buf, size_t count) + { + u8 in[16]; + + if (!capable(CAP_SYS_ADMIN)) + return -EACCES; + +- if (!kset || !buf || !count) ++ if (!buf || !count) + return -EINVAL; + + if (unlikely(pdcs_osid != OS_ID_LINUX)) +@@ -895,7 +887,6 @@ pdcs_osdep1_write(struct kset *kset, con + + /** + * pdcs_osdep2_write - Stable Storage OS-Dependent data area 2 input. +- * @kset: An allocated and populated struct kset. We don't use it tho. + * @buf: The input buffer to read from. + * @count: The number of bytes to be read. + * +@@ -903,8 +894,9 @@ pdcs_osdep1_write(struct kset *kset, con + * byte-by-byte write approach. It's up to userspace to deal with it when + * constructing its input buffer. + */ +-static ssize_t +-pdcs_osdep2_write(struct kset *kset, const char *buf, size_t count) ++static ssize_t pdcs_osdep2_write(struct kobject *kobj, ++ struct kobj_attribute *attr, ++ const char *buf, size_t count) + { + unsigned long size; + unsigned short i; +@@ -913,7 +905,7 @@ pdcs_osdep2_write(struct kset *kset, con + if (!capable(CAP_SYS_ADMIN)) + return -EACCES; + +- if (!kset || !buf || !count) ++ if (!buf || !count) + return -EINVAL; + + if (unlikely(pdcs_size <= 224)) +@@ -951,19 +943,23 @@ static PDCS_ATTR(diagnostic, 0400, pdcs_ + static PDCS_ATTR(fastsize, 0400, pdcs_fastsize_read, NULL); + static PDCS_ATTR(osdep2, 0600, pdcs_osdep2_read, pdcs_osdep2_write); + +-static struct subsys_attribute *pdcs_subsys_attrs[] = { +- &pdcs_attr_size, +- &pdcs_attr_autoboot, +- &pdcs_attr_autosearch, +- &pdcs_attr_timer, +- &pdcs_attr_osid, +- &pdcs_attr_osdep1, +- &pdcs_attr_diagnostic, +- &pdcs_attr_fastsize, +- &pdcs_attr_osdep2, ++static struct attribute *pdcs_subsys_attrs[] = { ++ &pdcs_attr_size.attr, ++ &pdcs_attr_autoboot.attr, ++ &pdcs_attr_autosearch.attr, ++ &pdcs_attr_timer.attr, ++ &pdcs_attr_osid.attr, ++ &pdcs_attr_osdep1.attr, ++ &pdcs_attr_diagnostic.attr, ++ &pdcs_attr_fastsize.attr, ++ &pdcs_attr_osdep2.attr, + NULL, + }; + ++static struct attribute_group pdcs_attr_group = { ++ .attrs = pdcs_subsys_attrs, ++}; ++ + static decl_subsys(paths, NULL); + static decl_subsys(stable, NULL); + +@@ -1042,8 +1038,7 @@ pdcs_unregister_pathentries(void) + static int __init + pdc_stable_init(void) + { +- struct subsys_attribute *attr; +- int i, rc = 0, error = 0; ++ int rc = 0, error = 0; + u32 result; + + /* find the size of the stable storage */ +@@ -1068,10 +1063,8 @@ pdc_stable_init(void) + goto fail_firmreg; + + /* Don't forget the root entries */ +- for (i = 0; (attr = pdcs_subsys_attrs[i]) && !error; i++) +- if (attr->show) +- error = subsys_create_file(&stable_subsys, attr); +- ++ error = sysfs_create_group(&stable_subsys.kobj, pdcs_attr_group); ++ + /* register the paths subsys as a subsystem of stable subsys */ + paths_subsys.kobj.kset = &stable_subsys; + if ((rc = subsystem_register(&paths_subsys))) diff --git a/driver/kset-convert-parisc-pdc_stable.c-to-use-kset_create.patch b/driver/kset-convert-parisc-pdc_stable.c-to-use-kset_create.patch new file mode 100644 index 00000000000000..f209ad189fcb56 --- /dev/null +++ b/driver/kset-convert-parisc-pdc_stable.c-to-use-kset_create.patch @@ -0,0 +1,104 @@ +From foo@baz Tue Apr 9 12:12:43 2002 +Date: Fri, 2 Nov 2007 15:25:00 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: kset: convert parisc/pdc_stable.c to use kset_create + +Dynamically create the kset instead of declaring it statically. +This makes the kobject attributes now work properly that I broke in the +previous patch. + +Cc: Kay Sievers <kay.sievers@vrfy.org> +Cc: Thibaut VARENE <varenet@parisc-linux.org> +Cc: Matthew Wilcox <matthew@wil.cx> +Cc: Grant Grundler <grundler@parisc-linux.org> +Cc: Kyle McMartin <kyle@parisc-linux.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/parisc/pdc_stable.c | 40 +++++++++++++++++++++++----------------- + 1 file changed, 23 insertions(+), 17 deletions(-) + +--- a/drivers/parisc/pdc_stable.c ++++ b/drivers/parisc/pdc_stable.c +@@ -960,8 +960,8 @@ static struct attribute_group pdcs_attr_ + .attrs = pdcs_subsys_attrs, + }; + +-static decl_subsys(paths, NULL); +-static decl_subsys(stable, NULL); ++static struct kset *stable_kset; ++static struct kset *paths_kset; + + /** + * pdcs_register_pathentries - Prepares path entries kobjects for sysfs usage. +@@ -993,7 +993,7 @@ pdcs_register_pathentries(void) + + if ((err = kobject_set_name(&entry->kobj, "%s", entry->name))) + return err; +- entry->kobj.kset = &paths_subsys; ++ entry->kobj.kset = paths_kset; + entry->kobj.ktype = &ktype_pdcspath; + if ((err = kobject_register(&entry->kobj))) + return err; +@@ -1058,19 +1058,26 @@ pdc_stable_init(void) + /* the actual result is 16 bits away */ + pdcs_osid = (u16)(result >> 16); + +- /* For now we'll register the stable subsys within this driver */ +- if ((rc = firmware_register(&stable_subsys))) ++ /* For now we'll register the stable kset within this driver */ ++ stable_kset = kset_create_and_register("stable", NULL, NULL, ++ firmware_kset); ++ if (IS_ERR(stable_kset)) { ++ rc = PTR_ERR(stable_kset); + goto fail_firmreg; ++ } + + /* Don't forget the root entries */ +- error = sysfs_create_group(&stable_subsys.kobj, pdcs_attr_group); ++ error = sysfs_create_group(&stable_kset->kobj, pdcs_attr_group); + +- /* register the paths subsys as a subsystem of stable subsys */ +- paths_subsys.kobj.kset = &stable_subsys; +- if ((rc = subsystem_register(&paths_subsys))) +- goto fail_subsysreg; ++ /* register the paths kset as a child of the stable kset */ ++ paths_kset = kset_create_and_register("paths", NULL, NULL, ++ stable_kset); ++ if (IS_ERR(paths_kset)) { ++ rc = PTR_ERR(paths_kset); ++ goto fail_ksetreg; ++ } + +- /* now we create all "files" for the paths subsys */ ++ /* now we create all "files" for the paths kset */ + if ((rc = pdcs_register_pathentries())) + goto fail_pdcsreg; + +@@ -1078,10 +1085,10 @@ pdc_stable_init(void) + + fail_pdcsreg: + pdcs_unregister_pathentries(); +- subsystem_unregister(&paths_subsys); ++ kset_unregister(paths_kset); + +-fail_subsysreg: +- firmware_unregister(&stable_subsys); ++fail_ksetreg: ++ kset_unregister(stable_kset); + + fail_firmreg: + printk(KERN_INFO PDCS_PREFIX " bailing out\n"); +@@ -1092,9 +1099,8 @@ static void __exit + pdc_stable_exit(void) + { + pdcs_unregister_pathentries(); +- subsystem_unregister(&paths_subsys); +- +- firmware_unregister(&stable_subsys); ++ kset_unregister(paths_kset); ++ kset_unregister(stable_kset); + } + + diff --git a/pending/kset-kill-subsys-attr.patch b/driver/kset-kill-subsys-attr.patch index 22f564a7083600..5bd0f925f676e5 100644 --- a/pending/kset-kill-subsys-attr.patch +++ b/driver/kset-kill-subsys-attr.patch @@ -1,26 +1,20 @@ From kay.sievers@vrfy.org Fri Nov 2 08:38:35 2007 From: Kay Sievers <kay.sievers@vrfy.org> -Subject: Driver Core: kill subsys_attribute and default sysfs ops Date: Fri, 02 Nov 2007 13:47:53 +0100 -Message-Id: <1194007673.2194.12.camel@lov.site> -Mime-Version: 1.0 -Content-Transfer-Encoding: 7bit -Status: RO -Content-Length: 4503 +Subject: Driver Core: kill subsys_attribute and default sysfs ops +Message-ID: <1194007673.2194.12.camel@lov.site> Remove the no longer needed subsys_attributes, they are all converted to the more sensical kobj_attributes. There is no longer a magic fallback in sysfs attribute operations, all -kobjects which create simple attributes need explicitely a ktype assigned, -which thells the core what was intended here. - -!!! DO NOT APPLY !!!! - Until this is converted: - drivers/parisc/pdc_stable.c -!!! DO NOT APPLY !!!! +kobjects which create simple attributes need explicitely a ktype +assigned, which tells the core what was intended here. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + + --- fs/sysfs/file.c | 63 +++++++----------------------------------------- include/linux/kobject.h | 9 ------ @@ -115,7 +109,7 @@ Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> * The inode's perms must say it's ok, --- a/include/linux/kobject.h +++ b/include/linux/kobject.h -@@ -208,15 +208,6 @@ extern struct kset *power_kset; +@@ -210,15 +210,6 @@ extern struct kset *firmware_kset; extern int __must_check subsystem_register(struct kset *); extern void subsystem_unregister(struct kset *); @@ -165,4 +159,3 @@ Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> EXPORT_SYMBOL(subsystem_register); EXPORT_SYMBOL(subsystem_unregister); -EXPORT_SYMBOL(subsys_create_file); - diff --git a/driver/sysfs-crash-debugging.patch b/driver/sysfs-crash-debugging.patch index 3bfb957fe6e285..1562a82ffea600 100644 --- a/driver/sysfs-crash-debugging.patch +++ b/driver/sysfs-crash-debugging.patch @@ -47,7 +47,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> add_taint(TAINT_DIE); --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c -@@ -16,12 +16,20 @@ +@@ -16,10 +16,18 @@ #include <linux/poll.h> #include <linux/list.h> #include <linux/mutex.h> @@ -56,8 +56,6 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> #include "sysfs.h" - #define to_sattr(a) container_of(a,struct subsys_attribute, attr) - +/* used in crash dumps to help with debugging */ +static char last_sysfs_file[PATH_MAX]; +void sysfs_printk_last_file(void) @@ -66,12 +64,12 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +} + /* - * Subsystem file operations. - * These operations allow subsystems to have files that can be -@@ -353,6 +361,12 @@ static int sysfs_open_file(struct inode - struct sysfs_buffer * buffer; - struct sysfs_ops * ops = NULL; - int error; + * There's one sysfs_buffer for each open file and one + * sysfs_open_dirent for each sysfs_dirent with one or more open +@@ -316,6 +324,12 @@ static int sysfs_open_file(struct inode + struct sysfs_buffer *buffer; + struct sysfs_ops *ops; + int error = -EACCES; + char *p; + + p = d_path(file->f_dentry, sysfs_mount, last_sysfs_file, diff --git a/pending/sysfs-crash-debugging.patch b/pending/sysfs-crash-debugging.patch deleted file mode 100644 index 1562a82ffea600..00000000000000 --- a/pending/sysfs-crash-debugging.patch +++ /dev/null @@ -1,123 +0,0 @@ -From akpm@linux-foundation.org Fri Aug 24 16:12:31 2007 -From: Andrew Morton <akpm@linux-foundation.org> -Date: Fri, 24 Aug 2007 16:11:54 -0700 -Subject: sysfs: crash debugging -To: mm-commits@vger.kernel.org -Cc: akpm@linux-foundation.org, greg@kroah.com, kay.sievers@vrfy.org, mathieu.desnoyers@polymtl.ca -Message-ID: <200708242311.l7ONBsvq019579@imap1.linux-foundation.org> - - -Print the name of the last-accessed sysfs file when we oops, to help track -down oopses which occur in sysfs store/read handlers. Because these oopses -tend to not leave any trace of the offending code in the stack traces. - -Cc: Kay Sievers <kay.sievers@vrfy.org> -Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> -Signed-off-by: Andrew Morton <akpm@linux-foundation.org> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - arch/x86/kernel/traps_32.c | 1 + - arch/x86/kernel/traps_64.c | 1 + - fs/sysfs/file.c | 14 ++++++++++++++ - fs/sysfs/mount.c | 2 +- - fs/sysfs/sysfs.h | 1 + - include/linux/sysfs.h | 5 +++++ - 6 files changed, 23 insertions(+), 1 deletion(-) - ---- a/arch/x86/kernel/traps_32.c -+++ b/arch/x86/kernel/traps_32.c -@@ -396,6 +396,7 @@ void die(const char * str, struct pt_reg - #endif - printk("\n"); - -+ sysfs_printk_last_file(); - if (notify_die(DIE_OOPS, str, regs, err, - current->thread.trap_no, SIGSEGV) != - NOTIFY_STOP) { ---- a/arch/x86/kernel/traps_64.c -+++ b/arch/x86/kernel/traps_64.c -@@ -517,6 +517,7 @@ void __kprobes __die(const char * str, s - printk("DEBUG_PAGEALLOC"); - #endif - printk("\n"); -+ sysfs_printk_last_file(); - notify_die(DIE_OOPS, str, regs, err, current->thread.trap_no, SIGSEGV); - show_registers(regs); - add_taint(TAINT_DIE); ---- a/fs/sysfs/file.c -+++ b/fs/sysfs/file.c -@@ -16,10 +16,18 @@ - #include <linux/poll.h> - #include <linux/list.h> - #include <linux/mutex.h> -+#include <linux/limits.h> - #include <asm/uaccess.h> - - #include "sysfs.h" - -+/* used in crash dumps to help with debugging */ -+static char last_sysfs_file[PATH_MAX]; -+void sysfs_printk_last_file(void) -+{ -+ printk(KERN_EMERG "last sysfs file: %s\n", last_sysfs_file); -+} -+ - /* - * There's one sysfs_buffer for each open file and one - * sysfs_open_dirent for each sysfs_dirent with one or more open -@@ -316,6 +324,12 @@ static int sysfs_open_file(struct inode - struct sysfs_buffer *buffer; - struct sysfs_ops *ops; - int error = -EACCES; -+ char *p; -+ -+ p = d_path(file->f_dentry, sysfs_mount, last_sysfs_file, -+ sizeof(last_sysfs_file)); -+ if (p) -+ memmove(last_sysfs_file, p, strlen(p) + 1); - - /* need attr_sd for attr and ops, its parent for kobj */ - if (!sysfs_get_active_two(attr_sd)) ---- a/fs/sysfs/mount.c -+++ b/fs/sysfs/mount.c -@@ -22,7 +22,7 @@ - /* Random magic number */ - #define SYSFS_MAGIC 0x62656572 - --static struct vfsmount *sysfs_mount; -+struct vfsmount *sysfs_mount; - struct super_block * sysfs_sb = NULL; - struct kmem_cache *sysfs_dir_cachep; - ---- a/fs/sysfs/sysfs.h -+++ b/fs/sysfs/sysfs.h -@@ -91,6 +91,7 @@ struct sysfs_addrm_cxt { - extern struct sysfs_dirent sysfs_root; - extern struct super_block *sysfs_sb; - extern struct kmem_cache *sysfs_dir_cachep; -+extern struct vfsmount *sysfs_mount; - - /* - * dir.c ---- a/include/linux/sysfs.h -+++ b/include/linux/sysfs.h -@@ -111,6 +111,7 @@ void sysfs_remove_file_from_group(struct - const struct attribute *attr, const char *group); - - void sysfs_notify(struct kobject *kobj, char *dir, char *attr); -+void sysfs_printk_last_file(void); - - extern int __must_check sysfs_init(void); - -@@ -216,6 +217,10 @@ static inline int __must_check sysfs_ini - return 0; - } - -+static inline void sysfs_printk_last_file(void) -+{ -+} -+ - #endif /* CONFIG_SYSFS */ - - #endif /* _SYSFS_H_ */ @@ -74,7 +74,9 @@ driver/kobject-convert-arm-mach-omap1-pm.c-to-kobj_attr-interface.patch driver/kobject-convert-pseries-power.c-to-kobj_attr-interface.patch driver/kobject-convert-s390-ipl.c-to-kobj_attr-interface.patch driver/kset-convert-s390-ipl.c-to-use-kset_create.patch - +driver/kobject-convert-parisc-pdc_stable-to-kobj_attr-interface.patch +driver/kset-convert-parisc-pdc_stable.c-to-use-kset_create.patch +driver/kset-kill-subsys-attr.patch # someday we will get these into mainline... driver/block-device.patch |
