Linux driver: ioctl or sysfs? : <p>I'm writing a driver to control some custom hardware.</p>

<p>In the old days (i.e. 15yrs ago) I was doing this with <code>ioctls</code>, but am now digging into <code>sysfs</code> as a possible alternative.</p>

<ul>
<li>As I understand it, ioctls aren't totally deprecated, but sysfs is preferred (?)</li>
<li>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 (?)</li>
<li>There needs to be '<code>mutex</code>' 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).</li>
</ul>

<p>Given the above, what would be the best way to proceed - ioctl or sysfs?</p>

<p>If sysfs, then how can I implement exclusive access? </p>

<p>If sysfs, then if the driver has no read/write/ioctl fops, does it need open/release?!</p>

<p>(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!)</p>

<p>Thanks.</p>
