[openib-general] Re: [PATCH] Yet more sysfs support
Greg KH
greg at kroah.com
Wed Sep 8 22:13:18 PDT 2004
On Wed, Sep 08, 2004 at 08:16:44PM -0700, Roland Dreier wrote:
> 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)
Yes, that's a good place for it. Especially if we rework the attribute
code, as will happen pretty soon...
> Or do you think it's worth defining PORT_ATTR_RO()? I notice you
> didn't bother in linux/device.h.
As it looks like that's pretty much all you use it for, wouldn't it make
sense for your situation? :)
> 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 ;)
Yes, it's on my list of things to do...
greg k-h
More information about the general
mailing list