commonlib/region: make buffer argument const for writeat

The buffer for writeat() should be marked as const as
the contents won't be manipulated within the call.

BUG=chrome-os-partner:55932

Change-Id: I968570c1cf80f918a07b97af625a56f11b5889c1
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/16084
Tested-by: build bot (Jenkins)
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
Aaron Durbin 2016-08-04 14:33:58 -05:00 committed by Martin Roth
parent a7b97510ae
commit 258a3507de
2 changed files with 7 additions and 7 deletions

View File

@ -52,8 +52,8 @@ ssize_t rdev_readat(const struct region_device *rd, void *b, size_t offset,
* Returns < 0 on error otherwise returns size of data wrote at provided * Returns < 0 on error otherwise returns size of data wrote at provided
* offset from the buffer passed. * offset from the buffer passed.
*/ */
ssize_t rdev_writeat(const struct region_device *rd, void *b, size_t offset, ssize_t rdev_writeat(const struct region_device *rd, const void *b,
size_t size); size_t offset, size_t size);
/* /*
* Returns < 0 on error otherwise returns size of data erased. * Returns < 0 on error otherwise returns size of data erased.
@ -81,7 +81,7 @@ struct region_device_ops {
void *(*mmap)(const struct region_device *, size_t, size_t); void *(*mmap)(const struct region_device *, size_t, size_t);
int (*munmap)(const struct region_device *, void *); int (*munmap)(const struct region_device *, void *);
ssize_t (*readat)(const struct region_device *, void *, size_t, size_t); ssize_t (*readat)(const struct region_device *, void *, size_t, size_t);
ssize_t (*writeat)(const struct region_device *, void *, size_t, ssize_t (*writeat)(const struct region_device *, const void *, size_t,
size_t); size_t);
ssize_t (*eraseat)(const struct region_device *, size_t, size_t); ssize_t (*eraseat)(const struct region_device *, size_t, size_t);
}; };

View File

@ -103,8 +103,8 @@ ssize_t rdev_readat(const struct region_device *rd, void *b, size_t offset,
return rdev->ops->readat(rdev, b, req.offset, req.size); return rdev->ops->readat(rdev, b, req.offset, req.size);
} }
ssize_t rdev_writeat(const struct region_device *rd, void *b, size_t offset, ssize_t rdev_writeat(const struct region_device *rd, const void *b,
size_t size) size_t offset, size_t size)
{ {
const struct region_device *rdev; const struct region_device *rdev;
struct region req = { struct region req = {
@ -257,7 +257,7 @@ static ssize_t mdev_readat(const struct region_device *rd, void *b,
return size; return size;
} }
static ssize_t mdev_writeat(const struct region_device *rd, void *b, static ssize_t mdev_writeat(const struct region_device *rd, const void *b,
size_t offset, size_t size) size_t offset, size_t size)
{ {
const struct mem_region_device *mdev; const struct mem_region_device *mdev;
@ -380,7 +380,7 @@ static ssize_t xlate_readat(const struct region_device *rd, void *b,
return rdev_readat(xldev->access_dev, b, offset, size); return rdev_readat(xldev->access_dev, b, offset, size);
} }
static ssize_t xlate_writeat(const struct region_device *rd, void *b, static ssize_t xlate_writeat(const struct region_device *rd, const void *b,
size_t offset, size_t size) size_t offset, size_t size)
{ {
struct region req = { struct region req = {