linux kernel - How to implement timer expire function in sysfs of driver.? -
scenario: suppose if doing echo 1 > sysfs_entry
- start doing i/o operation until echo 0 > sysfs_entry
. here, wanted implement timer in sysfs_entry
should stop i/o operation after t seconds , if not give echo 0 > sysfs_entry
.
ps: not want use busy wait methods.
preferred: deferred/delayed work
please me resolve scenario.
you can use add_timer()
, del_timer()
api this. event queue might work (depends on context). more details, please read chapter 7 «time, delays, , deferred work» of linux device drivers (aka ldd) book available free of charge right here. timer api described on page 198.
Comments
Post a Comment