Thread (5 messages) read the whole thread 5 messages, 1 author, 2007-01-29
STALE7126d

[PATCH] [3/4] Introduce _SYSDEV_ATTR

From: Olof Johansson <hidden>
Date: 2007-01-29 03:18:35

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.

Signed-off-by: Olof Johansson <redacted>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>                                              


Index: merge/include/linux/sysdev.h
===================================================================
--- merge.orig/include/linux/sysdev.h
+++ merge/include/linux/sysdev.h
@@ -98,12 +98,16 @@ struct sysdev_attribute { 
 };
 
 
-#define SYSDEV_ATTR(_name,_mode,_show,_store) 		\
-struct sysdev_attribute attr_##_name = { 			\
-	.attr = {.name = __stringify(_name), .mode = _mode },	\
+#define _SYSDEV_ATTR(_name,_mode,_show,_store)			\
+{								\
+	.attr = { .name = __stringify(_name), .mode = _mode,	\
+		 .owner = THIS_MODULE },			\
 	.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 *);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help