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) \
{ \
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 = { \
-diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c
-index b0f49b0..461e3e1 100644
--- a/drivers/media/v4l2-core/v4l2-dev.c
+++ b/drivers/media/v4l2-core/v4l2-dev.c
-@@ -86,6 +86,7 @@ static struct attribute *video_device_at
+@@ -86,7 +86,12 @@ static struct attribute *video_device_at
&dev_attr_index.attr,
NULL,
};
-+#define BP_ATTR_GRP_STRUCT device_attribute
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
ATTRIBUTE_GROUPS(video_device);
++#else
++#define BP_ATTR_GRP_STRUCT device_attribute
++ATTRIBUTE_GROUPS_BACKPORT(video_device);
++#endif
/*
-@@ -221,7 +222,11 @@ static void v4l2_device_release(struct d
+ * Active devices
+@@ -221,7 +226,11 @@ static void v4l2_device_release(struct d
static struct class video_class = {
.name = VIDEO_NAME,
};
struct video_device *video_devdata(struct file *file)
-@@ -990,6 +995,7 @@ static int __init videodev_init(void)
+@@ -990,6 +999,7 @@ static int __init videodev_init(void)
return ret;
}
--- a/net/ieee802154/wpan-class.c
+++ b/net/ieee802154/wpan-class.c
-@@ -77,6 +77,7 @@ static struct attribute *pmib_attrs[] =
+@@ -77,7 +77,12 @@ static struct attribute *pmib_attrs[] =
&dev_attr_cca_mode.attr,
NULL,
};
-+#define BP_ATTR_GRP_STRUCT device_attribute
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
ATTRIBUTE_GROUPS(pmib);
++#else
++#define BP_ATTR_GRP_STRUCT device_attribute
++ATTRIBUTE_GROUPS_BACKPORT(pmib);
++#endif
static void wpan_phy_release(struct device *d)
-@@ -88,7 +89,11 @@ static void wpan_phy_release(struct devi
+ {
+@@ -88,7 +93,11 @@ static void wpan_phy_release(struct devi
static struct class wpan_phy_class = {
.name = "ieee802154",
.dev_release = wpan_phy_release,
};
static DEFINE_MUTEX(wpan_phy_mutex);
-@@ -199,6 +204,7 @@ EXPORT_SYMBOL(wpan_phy_free);
+@@ -199,6 +208,7 @@ EXPORT_SYMBOL(wpan_phy_free);
static int __init wpan_phy_class_init(void)
{
int rc;
--- a/net/wireless/sysfs.c
+++ b/net/wireless/sysfs.c
-@@ -71,6 +71,7 @@ static struct attribute *ieee80211_attrs
+@@ -71,7 +71,12 @@ static struct attribute *ieee80211_attrs
&dev_attr_name.attr,
NULL,
};
-+#define BP_ATTR_GRP_STRUCT device_attribute
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
ATTRIBUTE_GROUPS(ieee80211);
++#else
++#define BP_ATTR_GRP_STRUCT device_attribute
++ATTRIBUTE_GROUPS_BACKPORT(ieee80211);
++#endif
static void wiphy_dev_release(struct device *dev)
-@@ -151,7 +152,11 @@ struct class ieee80211_class = {
+ {
+@@ -151,7 +156,11 @@ struct class ieee80211_class = {
.name = "ieee80211",
.owner = THIS_MODULE,
.dev_release = wiphy_dev_release,
.dev_uevent = wiphy_uevent,
#ifdef CONFIG_PM
.suspend = wiphy_suspend,
-@@ -165,6 +170,7 @@ struct class ieee80211_class = {
+@@ -165,6 +174,7 @@ struct class ieee80211_class = {
int wiphy_sysfs_init(void)
{