[PATCHv7 11/18] I2C: OMAP: use devm_* functions

Shubhrajyoti shubhrajyoti at ti.com
Wed Apr 11 07:56:26 EDT 2012


On Wednesday 11 April 2012 05:04 PM, Felipe Balbi wrote:
> On Wed, Apr 11, 2012 at 04:42:49PM +0530, Shubhrajyoti D wrote:
>> The various devm_ functions allocate memory that is released when a driver
>> detaches. This patch uses devm_kzalloc, devm_request_mem_region and
>> devm_ioremap for data that is allocated in the probe function of a platform
>> device and is only freed in the remove function.
>>
>> Signed-off-by: Shubhrajyoti D <shubhrajyoti at ti.com>
>> ---
>>  drivers/i2c/busses/i2c-omap.c |   29 +++++++++--------------------
>>  1 files changed, 9 insertions(+), 20 deletions(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
>> index 121c52e..86be475 100644
>> --- a/drivers/i2c/busses/i2c-omap.c
>> +++ b/drivers/i2c/busses/i2c-omap.c
>> @@ -995,17 +995,17 @@ omap_i2c_probe(struct platform_device *pdev)
>>  		return -ENODEV;
>>  	}
>>  
>> -	ioarea = request_mem_region(mem->start, resource_size(mem),
>> -			pdev->name);
>> +	ioarea = devm_request_mem_region(&pdev->dev, mem->start,
>> +			resource_size(mem), pdev->name);
> you could use devm_request_and_ioremap()
OK will do that.

thanks,




More information about the linux-arm-kernel mailing list