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

Felipe Balbi
2012-04-11T11:34:57Z

[-- Attachment #1: Type: text/plain, Size: 1078 bytes --]

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@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()

--
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]