On Mon, Jan 02, 2006 at 11:53:19AM -0700, Jim Cromie wrote: > hey folks, > > Having hacked a bit on drivers/hwmon/pc87360, > it has occurred to me that struct sensor_device_attribute > (ie the *_attributes it contains) carry a lot of redundant > info that could be hoisted into a (more) common location. What is redundant in there? There are only 2 fields :) > discussing it backwards somehow seems easier: > > 1. reduce sensor_device_attribute to a single integer. > > 2. partition that integer similar to MAJOR/MINOR for device files. > forex: MAJOR/UNIT_TYPE/UNIT_NUMBER > unit-type would distinguish between in, fan, pwm, pwm_enable, etc... > unit-number selects 0 .. N. Nothing here prevents driver writer > from mapping his own hierarchy into this partitioning. > > 3. driver modules would register show/set handlers for each unit-type. > registration can be static - as currently - using macros to reserve > numbers Hm, I've tried something like this in the past, and ended up with a mess of hairy macros and fun compiler tricks. But we did get this to work in a generic way for other filesystems, look at the debugfs attributes as an example. If you want to submit patches to the driver core to try to do this, please do. Good luck, greg k-h -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/