Re: [PATCH 1/6] drivers: base: Simplify generic_memmap_ro()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Andrey.

On Fri, Oct 26, 2018 at 06:32:25PM -0700, Andrey Smirnov wrote:
> 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;

Use PTR_ERR_OR_ZERO()?
The same result, just a bit shorter.

	Sam

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux