backports: explicitely include string.h from device.h
PATCH v2 1/2 backports: explicitely include string.h from device.h
string.h is usually included from the asm/ folder in most configuration, but on some older kernels and non-x86 architecture, this inclusion is not necessarily happening. As we're using memcpy() in the code below, we need to be safe and make sure string.h is indeed there.
This issue has been observed on a 3.4 vendor kernels, but may be applicable to other configurations.
--- backport/backport-include/linux/device.h | 7 +++++++ 1 file changed, 7 insertions(+)
Notes:
v2: no changes
backport/backport-include/linux/device.h +7 -0
@@ -5,6 +5,13 @@#include <linux/version.h> +/* +* string.h is usually included from the asm/ folder in most configuration, +* but on some older kernels it doesn't. As we're using memcpy() in the code +* below, we need to be safe and make sure string.h is indeed there. +*/ +#include <linux/string.h> +#if LINUX_VERSION_CODE <KERNEL_VERSION (3 ,9 ,0 )/* backport * commit 9f3b795a626ee79574595e06d1437fe0c7d51d29
Signature · 1 line
1.7.10.4
PATCH v2 2/2 backport: add hwmon group registration functions
hwmon group registration functions have been added in 3.13 kernel. Latest ath10k patches make use of this mechanism, therefore the need for the backport.
--- backport/backport-include/linux/hwmon.h | 34 ++++++++++++++++++++ backport/compat/backport-3.13.c | 52 +++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 backport/backport-include/linux/hwmon.h
Notes:
v2: address the comments reported by Hauke
*make devm_hwmon_release() static and moved it above
devm_hwmon_device_register_with_group()
*moved new includes at the top of the file
*set dev->groups and drvdata in hwmon_device_register_with_groups()
backport/backport-include/linux/hwmon.h new file +34 -0
@@ -0,0 +1,34 @@ +#ifndef __BACKPORT_LINUX_HWMON_H +#define __BACKPORT_LINUX_HWMON_H +#include_next <linux/hwmon.h> +#include <linux/version.h> + +#if LINUX_VERSION_CODE <KERNEL_VERSION (3 ,13 ,0 ) +/* +* Backports +* +* commit bab2243ce1897865e31ea6d59b0478391f51812b +* Author: Guenter Roeck <[email protected]> +* Date: Sat Jul 6 13:57:23 2013 -0700 +* +* hwmon: Introduce hwmon_device_register_with_groups +* +* hwmon_device_register_with_groups() lets callers register a hwmon device +* together with all sysfs attributes in a single call. +* +* When using hwmon_device_register_with_groups(), hwmon attributes are attached +* to the hwmon device directly and no longer with its parent device. +* +* Signed-off-by: Guenter Roeck <[email protected]> +*/ +struct device * +hwmon_device_register_with_groups (struct device *dev,const char *name, +void *drvdata, +const struct attribute_group **groups); +struct device * +devm_hwmon_device_register_with_groups (struct device *dev,const char *name, +void *drvdata, +const struct attribute_group **groups); +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0) */ + +#endif /* __BACKPORT_LINUX_HWMON_H */
backport/compat/backport-3.13.c +52 -0
61 lines not on this page · raw message
Signature · 1 line
1.7.10.4
Re: [PATCH v2 2/2] backport: add hwmon group registration functions
Quoted 12 lines · Mathieu Olivari
hwmon group registration functions have been added in 3.13 kernel. Latest ath10k patches make use of this mechanism, therefore the need for the backport.
Signed-off-by Mathieu Olivari <[email protected]>--- backport/backport-include/linux/hwmon.h | 34 ++++++++++++++++++++ backport/compat/backport-3.13.c | 52 +++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 backport/backport-include/linux/hwmon.h
Quoted 7 lines
Notes:
v2: address the comments reported by Hauke
*makedevm_hwmon_release()static and moved it above
devm_hwmon_device_register_with_group()
*moved new includes at the top of the file
*setdev->groupsand drvdata inhwmon_device_register_with_groups()
Thank you for the patches. Both were applied to backports and added to the latest release.
backport/compat/backport-3.13.c bool pci_device_is_present(struct pci_dev *pdev) · line 268
Quoted 5 lines
backport/compat/backport-3.13.c +5
-0+struct device *hwdev; + + hwdev =hwmon_device_register (dev); + hwdev->groups = groups; +dev_set_drvdata (&hwdev, drvdata);
I did a small change to this line. hwdev should not be given by double reference here. I removed the &.
Hauke