misc: mark write buffer const
PATCH 1/1 misc: mark write buffer const
The write operation in misc_ops already takes a "const void *" buffer, but misc_write() takes a mutable "void *". There's no reason for this, so make misc_write() consistent with the standard write() prototype.
Signed-off-by John Keeping <[email protected]>
--- drivers/misc/misc-uclass.c | 2 +- include/misc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/misc/misc-uclass.c +1 -1
@@ -26,7 +26,7 @@ int misc_read(struct udevice *dev, int offset, void *buf, int size)return ops->read (dev, offset, buf, size); } -int misc_write (struct udevice *dev,int offset,void *buf,int size) +int misc_write (struct udevice *dev,int offset,const void *buf,int size) {const struct misc_ops *ops =device_get_ops (dev);
include/misc.h +1 -1
@@ -28,7 +28,7 @@ int misc_read(struct udevice *dev, int offset, void *buf, int size);* * Return: number of bytes written if OK (may be < @size), -ve on error */ -int misc_write (struct udevice *dev,int offset,void *buf,int size); +int misc_write (struct udevice *dev,int offset,const void *buf,int size);/** * misc_ioctl() - Assert command to the device, optional.
Signature · 1 line
2.34.1
Quoted 10 lines · John Keeping
The write operation in
misc_opsalready takes a "const void *" buffer, butmisc_write()takes a mutable "void *". There's no reason for this, so makemisc_write()consistent with the standardwrite()prototype.Signed-off-by John Keeping <[email protected]>--- drivers/misc/misc-uclass.c | 2 +- include/misc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Reviewed-by Simon Glass <[email protected]>
Quoted 6 lines · John Keeping
The write operation in
misc_opsalready takes a "const void *" buffer, butmisc_write()takes a mutable "void *". There's no reason for this, so makemisc_write()consistent with the standardwrite()prototype.Signed-off-by John Keeping <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom