I'm writing a driver to control some custom hardware.
In the old days (i.e. 15yrs ago) I was doing this with ioctls
, but am now digging into sysfs
as a possible alternative.
- As I understand it, ioctls aren't totally deprecated, but sysfs is preferred (?)
- I need to read/write sets of values simultaneously i.e. through one sysfs entry. I've read that this isn't ideal, but is acceptable if necessary (?)
- There needs to be '
mutex
' protection on the driver, so that only one app can write to it at a time. (I do have some read-only 'info' entries which I'd prefer to keep accessible to all at all times).
Given the above, what would be the best way to proceed - ioctl or sysfs?
If sysfs, then how can I implement exclusive access?
If sysfs, then if the driver has no read/write/ioctl fops, does it need open/release?!
(This is a 'private' driver, so I don't care massively ;), but figured if the new ways are more applicable then I might as well get to grips with them!)
Thanks.