diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2013-10-26 14:40:59 +0200 |
---|---|---|
committer | Hauke Mehrtens <hauke@hauke-m.de> | 2013-10-27 14:11:02 +0100 |
commit | a864231d8745c15ba9dc76305667f7081b59810c (patch) | |
tree | f5c20449020d0515bf38fa9429ee79868b3cda2e /backport/backport-include/linux | |
parent | b24ada80b6a7b69187db20d384afc7dd337569fb (diff) |
backports: use sysfs api backport independent from kernel version
In struct class the new sysfs dev_groups member was added with kernel
3.11, but in other structs, like struct bus_type the new member was
added with kernel 3.12. This backport is now needed on different kernel
versions depending on the struct where is was used.
With this patch ATTRIBUTE_GROUPS() will always be used with the new API
and ATTRIBUTE_GROUPS_BACKPORT() will always be used used with the old
API and the patch has to add a KERNEL_VERSION check to add the correct
macro.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Diffstat (limited to 'backport/backport-include/linux')
-rw-r--r-- | backport/backport-include/linux/device.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/backport/backport-include/linux/device.h b/backport/backport-include/linux/device.h index e659c0c4..e1d7bb7f 100644 --- a/backport/backport-include/linux/device.h +++ b/backport/backport-include/linux/device.h @@ -194,8 +194,9 @@ backport_device_release_driver(struct device *dev) struct device_attribute dev_attr_ ## _name = __ATTR_RO(_name); #define DEVICE_ATTR_RW(_name) \ struct device_attribute dev_attr_ ## _name = __ATTR_RW(_name) +#endif -#define ATTRIBUTE_GROUPS(_name) \ +#define ATTRIBUTE_GROUPS_BACKPORT(_name) \ static struct BP_ATTR_GRP_STRUCT _name##_dev_attrs[ARRAY_SIZE(_name##_attrs)];\ static void init_##_name##_attrs(void) \ { \ @@ -206,7 +207,8 @@ static void init_##_name##_attrs(void) \ struct BP_ATTR_GRP_STRUCT, \ attr); \ } -#else + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0) #undef ATTRIBUTE_GROUPS #define ATTRIBUTE_GROUPS(_name) \ static const struct attribute_group _name##_group = { \ |