On Wed, Jun 17, 2020 at 02:35:28PM +0200, Martin Kaiser wrote:
Hello Greg and all,
Thus wrote Greg KH (greg@kroah.com):
Please do not do that. There are valid kernel apis to grant access to registers easily,
the most simple case would be a "reset reason" register within the chip's address space. A hand-crafted driver would ioremap the region and implement a sysfs show method that reads the register.
No, that's not what sysfs is for. You would export this in the proper way that "reset reason" expects.
What do you recommend for providing read access to such a register via sysfs? Is this a job for the userspace I/O (UIO) subsystem?
If all you want is direct memory access to userspace for stuff like this, what's wrong with /dev/mem ? If you want access to memory and interrupts to do it all in userspace, then yes, that's what UIO is for, use that please. thanks, greg k-h