Simplify generic_memmap_ro() by re-implementing it using generic_memmap_rw(). Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx> --- drivers/base/driver.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/base/driver.c b/drivers/base/driver.c index 1941a972c..c74fee99f 100644 --- a/drivers/base/driver.c +++ b/drivers/base/driver.c @@ -440,29 +440,23 @@ void __iomem *dev_request_mem_region(struct device_d *dev, int num) } EXPORT_SYMBOL(dev_request_mem_region); -int generic_memmap_ro(struct cdev *cdev, void **map, int flags) +int generic_memmap_rw(struct cdev *cdev, void **map, int flags) { if (!cdev->dev) return -EINVAL; - if (flags & PROT_WRITE) - return -EACCES; *map = dev_get_mem_region(cdev->dev, 0); if (IS_ERR(*map)) return PTR_ERR(*map); return 0; } -int generic_memmap_rw(struct cdev *cdev, void **map, int flags) +int generic_memmap_ro(struct cdev *cdev, void **map, int flags) { - if (!cdev->dev) - return -EINVAL; - - *map = dev_get_mem_region(cdev->dev, 0); - if (IS_ERR(*map)) - return PTR_ERR(*map); + if (flags & PROT_WRITE) + return -EACCES; - return 0; + return generic_memmap_rw(cdev, map, flags); } int dummy_probe(struct device_d *dev) -- 2.17.1 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox