[patch] KERNELVERSION=2.6.12-something make

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

 



Hi Jim,

> I was poking around to see if could grok the sysfs api support
> that would allow replacing the long lists of
>                 device_create_file(&new_client->dev,
>                 &dev_attr_inX_input);
> 
> with something like:
>     for(i=0; i<vpoints_max; i++) {
>                 device_create_file(&new_client->dev,
>                 &dev_attr_in[i].in);
>                 device_create_file(&new_client->dev,
>                 &dev_attr_in[i].max);
>                 device_create_file(&new_client->dev,
>                 &dev_attr_in[i].min);
>     }
> 
> looking at it again now, it appears to hinge upon doing something
> clever with DEVICE_ATTR, and unwinding some of the large-ish macros.
> ... and a bunch of stuff I havent yet understood.

You're correct, things could be done in a more efficient way. There is a
sysfs attribute group API which could be used, or we could use for()
loops like you proposed (and I proposed before you [1]). But you also
have to remember that some drivers will not create all sysfs files
depending on which chip they detected and what features these chips may
have disabled.

So it's a tricky point, and decisions should be taken on a by-driver
basis. And you better know that driver pretty well before you do.

[1] http://lkml.org/lkml/2005/5/19/140

-- 
Jean Delvare




[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux