backports: adjustments: fix devcoredump patch for class_groups
PATCH 1/1 backports: adjustments: fix devcoredump patch for class_groups
Since...
commit f76d25275c314defb684fdd692239507001774bc
Author: Greg Kroah-Hartman <[email protected]>
Date: Mon Nov 28 16:41:58 2016 +0100
driver core: devcoredump: convert to use class_groups
it is using struct class::class_groups. Update the devcoredump patch file accordingly.
--- patches/backport-adjustments/devcoredump.patch | 43 +++++++++++++++++++++----- 1 file changed, 35 insertions(+), 8 deletions(-)
patches/backport-adjustments/devcoredump.patch +35 -8
@@ -10,7 +10,7 @@ index 240374f..8bb376b 100644 static struct class devcd_class; -@@ -40,6 +41,10 @@ static bool devcd_disabled; +@@ -40,6 +41,10 @@ /* if data isn't read by userspace after 5 minutes then delete it */ #define DEVCD_TIMEOUT (HZ * 60 * 5)
@@ -41,7 +41,7 @@ index 240374f..8bb376b 100644 device_del(&devcd->devcd_dev); put_device(&devcd->devcd_dev); } -@@ -115,6 +122,7 @@ static struct bin_attribute devcd_attr_data = { +@@ -115,6 +122,7 @@ static ssize_t devcd_data_write(struct file *filp, struct kobject *kobj, .write = devcd_data_write, };
@@ -49,7 +49,7 @@ index 240374f..8bb376b 100644 static struct bin_attribute *devcd_dev_bin_attrs[] = { &devcd_attr_data, NULL, }; -@@ -126,6 +134,7 @@ static const struct attribute_group devcd_dev_group = { +@@ -126,6 +134,7 @@ static ssize_t devcd_data_write(struct file *filp, struct kobject *kobj, static const struct attribute_group *devcd_dev_groups[] = { &devcd_dev_group, NULL, };
@@ -57,17 +57,44 @@ index 240374f..8bb376b 100644 static int devcd_free(struct device *dev, void *data) { -@@ -170,7 +179,9 @@ static struct class devcd_class = { +@@ -160,20 +169,35 @@ static ssize_t disabled_store(struct class *class, struct class_attribute *attr, + + return count; + } ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) ++static struct class_attribute devcd_class_attrs[] = { ++ __ATTR_RW(disabled), ++ __ATTR_NULL ++}; ++#else + static CLASS_ATTR_RW(disabled); + + static struct attribute *devcd_class_attrs[] = { + &class_attr_disabled.attr, + NULL, + }; +-ATTRIBUTE_GROUPS(devcd_class); ++static const struct attribute_group devcd_class_group = { ++ .attrs = devcd_class_attrs, ++}; ++#endif + + static struct class devcd_class = { .name = "devcoredump", .owner = THIS_MODULE, .dev_release = devcd_dev_release, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0) .dev_groups = devcd_dev_groups, +#endif - .class_attrs = devcd_class_attrs, ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) ++ .class_attrs = devcd_class_attrs, ++#else + .class_groups = devcd_class_groups, ++#endif }; -@@ -231,6 +242,14 @@ static void devcd_free_sgtable(void *data) + static ssize_t devcd_readv(char *buffer, loff_t offset, size_t count, +@@ -233,6 +257,14 @@ static void devcd_free_sgtable(void *data) _devcd_free_sgtable(data); }
@@ -82,7 +109,7 @@ index 240374f..8bb376b 100644 /** * devcd_read_from_table - copy data from sg_table to a given buffer * and return the number of bytes read -@@ -314,6 +333,11 @@ void dev_coredumpm(struct device *dev, struct module *owner, +@@ -316,6 +348,11 @@ void dev_coredumpm(struct device *dev, struct module *owner, if (device_add(&devcd->devcd_dev)) goto put_device;
@@ -94,7 +121,7 @@ index 240374f..8bb376b 100644 if (sysfs_create_link(&devcd->devcd_dev.kobj, &dev->kobj, "failing_device")) /* nothing - symlink will be missing */; -@@ -356,15 +380,13 @@ void dev_coredumpsg(struct device *dev, struct scatterlist *table, +@@ -358,15 +395,13 @@ void dev_coredumpsg(struct device *dev, struct scatterlist *table, } EXPORT_SYMBOL_GPL(dev_coredumpsg);
Signature · 4 lines
1.9.1 -- To unsubscribe from this list: send the line "unsubscribe backports" in
Quoted 62 lines · Arend van Spriel
Since...
commit
f76d25275c314defb684fdd692239507001774bc
Author: Greg Kroah-Hartman <[email protected]>
Date: Mon Nov 28 16:41:58 2016 +0100driver core: devcoredump: convert to use
class_groupsit is using struct
class::class_groups. Update the devcoredump patch file accordingly.Signed-off-by Arend van Spriel <[email protected]>--- patches/backport-adjustments/devcoredump.patch | 43 +++++++++++++++++++++----- 1 file changed, 35 insertions(+), 8 deletions(-)patches/backport-adjustments/devcoredump.patch +13
-4@@ -10,7 +10,7 @@ index 240374f..8bb376b 100644 static struct class devcd_class; -@@ -40,6 +41,10 @@ static bool devcd_disabled; +@@ -40,6 +41,10 @@ /* if data isn't read by userspace after 5 minutes then delete it */ #define DEVCD_TIMEOUT (HZ * 60 * 5)@@ -41,7 +41,7 @@ index 240374f..8bb376b 100644 device_del(&devcd->devcd_dev); put_device(&devcd->devcd_dev); } -@@ -115,6 +122,7 @@ static struct bin_attribute devcd_attr_data = { +@@ -115,6 +122,7 @@ static ssize_t devcd_data_write(struct file *filp, struct kobject *kobj, .write = devcd_data_write, };@@ -49,7 +49,7 @@ index 240374f..8bb376b 100644 static struct bin_attribute *devcd_dev_bin_attrs[] = { &devcd_attr_data, NULL, }; -@@ -126,6 +134,7 @@ static const struct attribute_group devcd_dev_group = { +@@ -126,6 +134,7 @@ static ssize_t devcd_data_write(struct file *filp, struct kobject *kobj, static const struct attribute_group *devcd_dev_groups[] = { &devcd_dev_group, NULL, };@@ -57,17 +57,44 @@ index 240374f..8bb376b 100644 static int devcd_free(struct device *dev, void *data) { -@@ -170,7 +179,9 @@ static struct class devcd_class = { +@@ -160,20 +169,35 @@ static ssize_t disabled_store(struct class *class, struct class_attribute *attr, + + return count; + } ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) ++static struct class_attribute devcd_class_attrs[] = { ++ __ATTR_RW(disabled), ++ __ATTR_NULL ++}; ++#else
patches/backport-adjustments/devcoredump.patch index 240374f..8bb376b 100644 · line 79
Quoted 10 lines
patches/backport-adjustments/devcoredump.patch +10
-0+ static CLASS_ATTR_RW(disabled); + + static struct attribute *devcd_class_attrs[] = { + &class_attr_disabled.attr, + NULL, + }; +-ATTRIBUTE_GROUPS(devcd_class); ++static const struct attribute_group devcd_class_group = { ++ .attrs = devcd_class_attrs, ++};
This is actually not sufficient. Also need to add expansion of __ATTRIBUTE_GROUPS() macro. Did not hit this as it kicks in when backporting to 4.10+, which is not on my list yet ;-p
Regards,
Arend
Quoted 34 lines
patches/backport-adjustments/devcoredump.patch +11
-3++#endif + + static struct class devcd_class = { .name = "devcoredump", .owner = THIS_MODULE, .dev_release = devcd_dev_release, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0) .dev_groups = devcd_dev_groups, +#endif - .class_attrs = devcd_class_attrs, ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) ++ .class_attrs = devcd_class_attrs, ++#else + .class_groups = devcd_class_groups, ++#endif }; -@@ -231,6 +242,14 @@ static void devcd_free_sgtable(void *data) + static ssize_t devcd_readv(char *buffer, loff_t offset, size_t count, +@@ -233,6 +257,14 @@ static void devcd_free_sgtable(void *data) _devcd_free_sgtable(data); }@@ -82,7 +109,7 @@ index 240374f..8bb376b 100644 /** * devcd_read_from_table - copy data from sg_table to a given buffer * and return the number of bytes read -@@ -314,6 +333,11 @@ void dev_coredumpm(struct device *dev, struct module *owner, +@@ -316,6 +348,11 @@ void dev_coredumpm(struct device *dev, struct module *owner, if (device_add(&devcd->devcd_dev)) goto put_device;
patches/backport-adjustments/devcoredump.patch index 240374f..8bb376b 100644 · line 127
Quoted 8 lines
patches/backport-adjustments/devcoredump.patch +1
-1@@ -94,7 +121,7 @@ index 240374f..8bb376b 100644 if (sysfs_create_link(&devcd->devcd_dev.kobj, &dev->kobj, "failing_device")) /* nothing - symlink will be missing */; -@@ -356,15 +380,13 @@ void dev_coredumpsg(struct device *dev, struct scatterlist *table, +@@ -358,15 +395,13 @@ void dev_coredumpsg(struct device *dev, struct scatterlist *table, } EXPORT_SYMBOL_GPL(dev_coredumpsg);
--
To unsubscribe from this list: send the line "unsubscribe backports" in
Quoted 69 lines · Arend Van Spriel
Quoted 68 lines · Arend van Spriel
Since...
commit
f76d25275c314defb684fdd692239507001774bc
Author: Greg Kroah-Hartman <[email protected]>
Date: Mon Nov 28 16:41:58 2016 +0100driver core: devcoredump: convert to use
class_groupsit is using struct
class::class_groups. Update the devcoredump patch file accordingly.Signed-off-by Arend van Spriel <[email protected]>--- patches/backport-adjustments/devcoredump.patch | 43 +++++++++++++++++++++----- 1 file changed, 35 insertions(+), 8 deletions(-)patches/backport-adjustments/devcoredump.patch +19
-4@@ -10,7 +10,7 @@ index 240374f..8bb376b 100644 static struct class devcd_class; -@@ -40,6 +41,10 @@ static bool devcd_disabled; +@@ -40,6 +41,10 @@ /* if data isn't read by userspace after 5 minutes then delete it */ #define DEVCD_TIMEOUT (HZ * 60 * 5)@@ -41,7 +41,7 @@ index 240374f..8bb376b 100644 device_del(&devcd->devcd_dev); put_device(&devcd->devcd_dev); } -@@ -115,6 +122,7 @@ static struct bin_attribute devcd_attr_data = { +@@ -115,6 +122,7 @@ static ssize_t devcd_data_write(struct file *filp, struct kobject *kobj, .write = devcd_data_write, };@@ -49,7 +49,7 @@ index 240374f..8bb376b 100644 static struct bin_attribute *devcd_dev_bin_attrs[] = { &devcd_attr_data, NULL, }; -@@ -126,6 +134,7 @@ static const struct attribute_group devcd_dev_group = { +@@ -126,6 +134,7 @@ static ssize_t devcd_data_write(struct file *filp, struct kobject *kobj, static const struct attribute_group *devcd_dev_groups[] = { &devcd_dev_group, NULL, };@@ -57,17 +57,44 @@ index 240374f..8bb376b 100644 static int devcd_free(struct device *dev, void *data) { -@@ -170,7 +179,9 @@ static struct class devcd_class = { +@@ -160,20 +169,35 @@ static ssize_t disabled_store(struct class *class, struct class_attribute *attr, + + return count; + } ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) ++static struct class_attribute devcd_class_attrs[] = { ++ __ATTR_RW(disabled), ++ __ATTR_NULL ++}; ++#else + static CLASS_ATTR_RW(disabled); + + static struct attribute *devcd_class_attrs[] = { + &class_attr_disabled.attr, + NULL, + };
Quoted 8 lines
patches/backport-adjustments/devcoredump.patch index 240374f..8bb376b 100644 · line 79
Quoted 4 lines
patches/backport-adjustments/devcoredump.patch +4
-0+-ATTRIBUTE_GROUPS(devcd_class); ++static const struct attribute_group devcd_class_group = { ++ .attrs = devcd_class_attrs, ++};This is actually not sufficient. Also need to add expansion of
__ATTRIBUTE_GROUPS()macro. Did not hit this as it kicks in when backporting to 4.10+, which is not on my list yet ;-p
Thanks, Arend! I had something to "fix" this, but it was completely b0rked for (at least) <= 3.14. I'll try your patch now (at the moment I don't care much about 4.10+ either).
--
Cheers,
Luca.
--
To unsubscribe from this list: send the line "unsubscribe backports" in
Quoted 79 lines · Luca Coelho
Quoted 69 lines · Arend Van Spriel
Quoted 68 lines · Arend van Spriel
Since...
commit
f76d25275c314defb684fdd692239507001774bc
Author: Greg Kroah-Hartman <[email protected]>
Date: Mon Nov 28 16:41:58 2016 +0100driver core: devcoredump: convert to use
class_groupsit is using struct
class::class_groups. Update the devcoredump patch file accordingly.Signed-off-by Arend van Spriel <[email protected]>--- patches/backport-adjustments/devcoredump.patch | 43 +++++++++++++++++++++----- 1 file changed, 35 insertions(+), 8 deletions(-)patches/backport-adjustments/devcoredump.patch +19
-4@@ -10,7 +10,7 @@ index 240374f..8bb376b 100644 static struct class devcd_class; -@@ -40,6 +41,10 @@ static bool devcd_disabled; +@@ -40,6 +41,10 @@ /* if data isn't read by userspace after 5 minutes then delete it */ #define DEVCD_TIMEOUT (HZ * 60 * 5)@@ -41,7 +41,7 @@ index 240374f..8bb376b 100644 device_del(&devcd->devcd_dev); put_device(&devcd->devcd_dev); } -@@ -115,6 +122,7 @@ static struct bin_attribute devcd_attr_data = { +@@ -115,6 +122,7 @@ static ssize_t devcd_data_write(struct file *filp, struct kobject *kobj, .write = devcd_data_write, };@@ -49,7 +49,7 @@ index 240374f..8bb376b 100644 static struct bin_attribute *devcd_dev_bin_attrs[] = { &devcd_attr_data, NULL, }; -@@ -126,6 +134,7 @@ static const struct attribute_group devcd_dev_group = { +@@ -126,6 +134,7 @@ static ssize_t devcd_data_write(struct file *filp, struct kobject *kobj, static const struct attribute_group *devcd_dev_groups[] = { &devcd_dev_group, NULL, };@@ -57,17 +57,44 @@ index 240374f..8bb376b 100644 static int devcd_free(struct device *dev, void *data) { -@@ -170,7 +179,9 @@ static struct class devcd_class = { +@@ -160,20 +169,35 @@ static ssize_t disabled_store(struct class *class, struct class_attribute *attr, + + return count; + } ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) ++static struct class_attribute devcd_class_attrs[] = { ++ __ATTR_RW(disabled), ++ __ATTR_NULL ++}; ++#else + static CLASS_ATTR_RW(disabled); + + static struct attribute *devcd_class_attrs[] = { + &class_attr_disabled.attr, + NULL, + };Quoted 8 lines
patches/backport-adjustments/devcoredump.patch index 240374f..8bb376b 100644 · line 79
Quoted 4 lines
patches/backport-adjustments/devcoredump.patch +4
-0+-ATTRIBUTE_GROUPS(devcd_class); ++static const struct attribute_group devcd_class_group = { ++ .attrs = devcd_class_attrs, ++};This is actually not sufficient. Also need to add expansion of
__ATTRIBUTE_GROUPS()macro. Did not hit this as it kicks in when backporting to 4.10+, which is not on my list yet ;-p
Quoted 3 lines
Thanks, Arend! I had something to "fix" this, but it was completely b0rked for (at least) <= 3.14. I'll try your patch now (at the moment I don't care much about 4.10+ either).
Looks like Johannes submitted another option to check ;-)
Regards,
Arend
--
To unsubscribe from this list: send the line "unsubscribe backports" in
Quoted 11 lines · Arend Van Spriel
Quoted 8 lines · Luca Coelho
Quoted 3 lines · Arend Van Spriel
This is actually not sufficient. Also need to add expansion of
__ATTRIBUTE_GROUPS()macro. Did not hit this as it kicks in when backporting to 4.10+, which is not on my list yet ;-pThanks, Arend! I had something to "fix" this, but it was completely b0rked for (at least) <= 3.14. I'll try your patch now (at the moment I don't care much about 4.10+ either).
Looks like Johannes submitted another option to check ;-)
Yeah, I've been working with Johannes on this (mostly as a guinea pig). It works with our iwlwifi driver's contents.
--
Cheers,
Luca.
--
To unsubscribe from this list: send the line "unsubscribe backports" in