Re: [PATCH 1/2] sysfs: Add sysfs_bin_attr_simple_read() helper

2024-04-11 Thread Greg Kroah-Hartman
On Sat, Apr 06, 2024 at 03:52:01PM +0200, Lukas Wunner wrote: > When drivers expose a bin_attribute in sysfs which is backed by a buffer > in memory, a common pattern is to set the @private and @size members in > struct bin_attribute to the buffer's location and size. > > The ->read() callback the

[PATCH 1/2] sysfs: Add sysfs_bin_attr_simple_read() helper

2024-04-06 Thread Lukas Wunner
When drivers expose a bin_attribute in sysfs which is backed by a buffer in memory, a common pattern is to set the @private and @size members in struct bin_attribute to the buffer's location and size. The ->read() callback then merely consists of a single memcpy() call. It's not even necessary to