[PATCH 2.6.12-rc4] include/linux:(dynamic sysfs callbacks) new attribute macros

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

The following patch adds a new __ATTR_PRIVATE macro and a
DEVICE_ATTR_PRIVATE macro to be used when creating static device
attributes with a void * member.


Signed-off-by: Yani Ioannou <[email protected]>

Thanks,
Yani

---
 device.h |    3 +++
 sysfs.h  |   11 +++++++++++
 2 files changed, 14 insertions(+)
---
diff -uprN -X dontdiff linux-2.6.12-rc4-sysfsdyncallback-deviceattr/include/linux/device.h linux-2.6.12-rc4-sysfsdyncallback-deviceattr-macro/include/linux/device.h
--- linux-2.6.12-rc4-sysfsdyncallback-deviceattr/include/linux/device.h	2005-05-13 01:02:10.000000000 -0400
+++ linux-2.6.12-rc4-sysfsdyncallback-deviceattr-macro/include/linux/device.h	2005-05-13 01:09:27.000000000 -0400
@@ -343,6 +343,9 @@ struct device_attribute {
 #define DEVICE_ATTR(_name,_mode,_show,_store) \
 struct device_attribute dev_attr_##_name = __ATTR(_name,_mode,_show,_store)
 
+#define DEVICE_ATTR_PRIVATE(_name,_mode,_show,_store,_private)	\
+struct device_attribute dev_attr_##_name = 			\
+	__ATTR_PRIVATE(_name,_mode,_show,_store,_private)
 
 extern int device_create_file(struct device *device, struct device_attribute * entry);
 extern void device_remove_file(struct device * dev, struct device_attribute * attr);
diff -uprN -X dontdiff linux-2.6.12-rc4-sysfsdyncallback-deviceattr/include/linux/sysfs.h linux-2.6.12-rc4-sysfsdyncallback-deviceattr-macro/include/linux/sysfs.h
--- linux-2.6.12-rc4-sysfsdyncallback-deviceattr/include/linux/sysfs.h	2005-05-13 01:02:10.000000000 -0400
+++ linux-2.6.12-rc4-sysfsdyncallback-deviceattr-macro/include/linux/sysfs.h	2005-05-13 01:08:09.000000000 -0400
@@ -45,6 +45,17 @@ struct attribute_group {
 	.store	= _store,			\
 }
 
+#define __ATTR_PRIVATE(_name,_mode,_show,_store,_private) {	\
+	.attr = {						\
+		.name = __stringify(_name),			\
+		.mode = _mode,					\
+		.private = _private,				\
+		.owner = THIS_MODULE,				\
+	}, 							\
+	.show	= _show,					\
+	.store	= _store,					\
+}
+
 #define __ATTR_RO(_name) {			\
 	.attr	= {				\
 		.name = __stringify(_name),	\




[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux