[PATCH 2/8] mtd: ixp4xx: Use devm_*() functions

Brian Norris computersforpeace at gmail.com
Thu Jan 2 20:19:08 EST 2014


On Fri, Dec 20, 2013 at 01:56:58PM +0900, Jingoo Han wrote:
> --- a/drivers/mtd/maps/ixp4xx.c
> +++ b/drivers/mtd/maps/ixp4xx.c
> @@ -220,20 +214,9 @@ static int ixp4xx_flash_probe(struct platform_device *dev)
>  	info->map.write = ixp4xx_probe_write16;
>  	info->map.copy_from = ixp4xx_copy_from;
>  
> -	info->res = request_mem_region(dev->resource->start,
> -			resource_size(dev->resource),
> -			"IXP4XXFlash");
> -	if (!info->res) {
> -		printk(KERN_ERR "IXP4XXFlash: Could not reserve memory region\n");
> -		err = -ENOMEM;
> -		goto Error;
> -	}
> -
> -	info->map.virt = ioremap(dev->resource->start,
> -				 resource_size(dev->resource));
> -	if (!info->map.virt) {
> -		printk(KERN_ERR "IXP4XXFlash: Failed to ioremap region\n");
> -		err = -EIO;
> +	info->map.virt = devm_ioremap_resource(&dev->dev, dev->resource);
> +	if (IS_ERR(info->map.virt)) {
> +		err = PTR_ERR(info->map.virt);

I don't have a defconfig on hand for compiling this one yet, but I
assume this has the same problem as the plat_nand one (missing
<linux/err.h>), so I'm not taking it yet.

>  		goto Error;
>  	}
>  

Brian



More information about the linux-mtd mailing list