Skip to contentSkip to conversation

PMC-related cleanups

PATCH In review Olof Johansson 2 participants 3 messages Jan 25, 2007 – Jan 29, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 3/4 PMC-related cleanups

Introduce _SYSDEV_ATTR(), to be used to just define the struct, and not a named variable with the attribute. Useful for arrays of sysdev_attributes.

include/linux/sysdev.h +6 -3
Index: powerpc/include/linux/sysdev.h
===================================================================
@@ -98,12 +98,15 @@ struct sysdev_attribute { 
 };
 
 
-#define SYSDEV_ATTR(_name,_mode,_show,_store) 		\
-struct sysdev_attribute attr_##_name = { 			\
+#define _SYSDEV_ATTR(_name,_mode,_show,_store)			\
+{								\
 	.attr = {.name = __stringify(_name), .mode = _mode },	\
 	.show	= _show,					\
 	.store	= _store,					\
-};
+}
+
+#define SYSDEV_ATTR(_name,_mode,_show,_store)		\
+struct sysdev_attribute attr_##_name = _SYSDEV_ATTR(_name,_mode,_show,_store);
 
 extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *);
 extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *);
#1 lore raw
Quoted 13 lines · Olof Johansson

Introduce _SYSDEV_ATTR(), to be used to just define the struct, and not a named variable with the attribute. Useful for arrays of sysdev_attributes.

Index: powerpc/include/linux/sysdev.h
===================================================================

include/linux/sysdev.h +0 -0
@@ -98,12 +98,15 @@ struct sysdev_attribute { 
 };
 

include/linux/sysdev.h struct sysdev_attribute { · line 106

Quoted 10 lines
include/linux/sysdev.h +3 -3
 
-#define SYSDEV_ATTR(_name,_mode,_show,_store) 		\
-struct sysdev_attribute attr_##_name = { 			\
+#define _SYSDEV_ATTR(_name,_mode,_show,_store)			\
+{								\
 	.attr = {.name = __stringify(_name), .mode = _mode },	\
 	.show	= _show,					\
 	.store	= _store,					\
-};
+}

Oops, you need to add '.owner' to that attribute structure. In all fairness, it's a bug, not caused by anything that you did.

If you add that, feel free to add my:

to the patch and send it through Paul.

thanks,

greg k-h

#2 lore raw
Quoted 15 lines · Greg KH
Quoted 14 lines · Olof Johansson

Introduce _SYSDEV_ATTR(), to be used to just define the struct, and not a named variable with the attribute. Useful for arrays of sysdev_attributes.

Index: powerpc/include/linux/sysdev.h
===================================================================

include/linux/sysdev.h +0 -0
@@ -98,12 +98,15 @@ struct sysdev_attribute { 
 };
 
 
Quoted 12 lines

include/linux/sysdev.h struct sysdev_attribute { · line 106

Quoted 9 lines
include/linux/sysdev.h +3 -3
-#define SYSDEV_ATTR(_name,_mode,_show,_store) 		\
-struct sysdev_attribute attr_##_name = { 			\
+#define _SYSDEV_ATTR(_name,_mode,_show,_store)			\
+{								\
 	.attr = {.name = __stringify(_name), .mode = _mode },	\
 	.show	= _show,					\
 	.store	= _store,					\
-};
+}

Oops, you need to add '.owner' to that attribute structure. In all fairness, it's a bug, not caused by anything that you did.

Got it, see repost.

Quoted 4 lines

If you add that, feel free to add my:

to the patch and send it through Paul.

Thanks!

-Olof