[openib-general] Re: [PATCH] Yet more sysfs support

Roland Dreier roland at topspin.com
Wed Sep 8 20:16:44 PDT 2004


    Greg> Try using the __ATTR and __ATTR_RO macros to make these and
    Greg> the places you use it, simpler.

Thanks (I was still looking at 2.6.7 headers so I missed them).  The
only place I found to use the macros was doing:

 #define PORT_ATTR(_name, _mode, _show, _store) 		\
-struct port_attribute port_attr_##_name = { 		\
-	.attr  = { .name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE }, \
-	.show  = _show, 				\
-	.store = _store					\
-}
+struct port_attribute port_attr_##_name = __ATTR(_name, _mode, _show, _store)

Or do you think it's worth defining PORT_ATTR_RO()?  I notice you
didn't bother in linux/device.h.

    Greg> Man, it really would be nice if it was easier to create
    Greg> subdirectories in the driver model without being forced to
    Greg> drop down to the kobject layer, wouldn't it :(

Well, it was a good learning experience once to have to go all the way
down to kobjects.  Next time I'd like a better way, please ;)

 - R.



More information about the general mailing list