commonlib/region: allow empty mmap()/munmap() in region_device_ops
Instead of assuming all region_devices have an mmap() and munmap() implementation fail those calls when one isn't provided. BUG=chrome-os-partner:56151 Change-Id: I9b03e084aa604d52d6b5bab47c0bf99d9fbcd422 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/16190 Reviewed-by: Furquan Shaikh <furquan@google.com> Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
This commit is contained in:
parent
e56191e8ec
commit
edd79590b0
|
@ -74,6 +74,9 @@ void *rdev_mmap(const struct region_device *rd, size_t offset, size_t size)
|
||||||
|
|
||||||
rdev = rdev_root(rd);
|
rdev = rdev_root(rd);
|
||||||
|
|
||||||
|
if (rdev->ops->mmap == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
return rdev->ops->mmap(rdev, req.offset, req.size);
|
return rdev->ops->mmap(rdev, req.offset, req.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,6 +86,9 @@ int rdev_munmap(const struct region_device *rd, void *mapping)
|
||||||
|
|
||||||
rdev = rdev_root(rd);
|
rdev = rdev_root(rd);
|
||||||
|
|
||||||
|
if (rdev->ops->munmap == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
return rdev->ops->munmap(rdev, mapping);
|
return rdev->ops->munmap(rdev, mapping);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue