Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I haven't worked with sysfs much, but I found a simple-looking example that's pretty similar to what you are doing (naturally, it's also under ARM). Take a look at <code>arch/arm/mach-omap1/pm.c</code>, specifically the <code>idle_show</code>/<code>idle_store</code> sysfs file. It gets registered (using <code>sysfs_create_file()</code>) as <code>/sys/power/sleep_while_idle</code> and uses the global <code>/sys/power</code> kobj (defined in <code>include/linux/kobject.h</code>). There are a few other global kobj's defined there that you could use, although I'm don't think any are a good fit for your driver. </p> <p>Is this going to be a platform driver? As a driver that doesn't fit under any bus, it seems like a good fit. Platform drivers get their own directory under /sys/devices/platform, and can have attributes there. Take a look at <code>drivers/hwmon/coretemp.c</code>, which has <code>temp1_crit</code>, <code>temp1_crit_alarm</code>, <code>temp1_input</code>, etc. as attributes. It looks fairly simple: create the attributes (maybe with <code>__ATTR()</code>?), list them all in an array, define an <code>attribute_group</code>, register it with <code>sysfs_create_group()</code> in the <code>probe()</code> function, and unregister it with <code>sysfs_remove_group()</code> in the <code>remove()</code> function.</p> <p>There are probably other platform drivers that define attributes (search for <code>sysfs_create_group</code>) if you need other examples. Hope this helps!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload