Skip to contentSkip to conversation

Creation of driver-specific sysfs attributes

DISCUSSION Marcelo Tosatti 2 participants 2 messages Jul 7, 2004

lore
Share & tools
lore
#0 lore raw

Hi Greg, others,

Hope this is not a FAQ.

I want to export some read-only attributes (statistics) from cyclades.c char driver to userspace via sysfs.

I can't figure out the right place to do it - I could create a class under /sys/class/cyclades for example, but that doesnt sound right since this is not a "class" of device, but a device itself.

Hooking the statistics into /sys/class/tty/ttyC$/ sounds reasonable, but its not possible it seems because "tty" is a class_simple class, which only implements the "dev" attribute.

What is the appropriate place for such driver-specific attributes?

TIA

#1 lore raw
Quoted 10 lines · Marcelo Tosatti

Hi Greg, others,

Hope this is not a FAQ.

I want to export some read-only attributes (statistics) from cyclades.c char driver to userspace via sysfs.

I can't figure out the right place to do it - I could create a class under /sys/class/cyclades for example, but that doesnt sound right since this is not a "class" of device, but a device itself.

For a driver only attribute, you want them to show up in the place for the driver (like under /sys/bus/pci/driver/MY_FOO_DRIVER/). To do that use the DRIVER_ATTR() and the driver_add_file() functions. For examples, see the other drivers that use these functions.

Hope this helps,

greg k-h