All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Julia Lawall <julia.lawall@lip6.fr>,
	Jonathan Cameron <jic23@cam.ac.uk>,
	kernel-janitors@vger.kernel.org, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers/iio/adc/at91_adc.c: use devm_ functions
Date: Wed, 15 Aug 2012 09:02:07 +0000	[thread overview]
Message-ID: <502B658F.5040100@metafoo.de> (raw)
In-Reply-To: <502AB5F1.3050908@kernel.org>

On 08/14/2012 10:32 PM, Jonathan Cameron wrote:
> Lars-Peter,
> 
> Are you happy with this updated version?  Can't immediately find any response
> from you to it.
> 

I think it is ok, you can add my
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>.

One minor nitpick though.

> Jonathan
>> From: Julia Lawall <Julia.Lawall@lip6.fr>
>>
>> The various devm_ functions allocate memory that is released when a driver
>> detaches.  This patch uses these functions for data that is allocated in
>> the probe function of a platform device and is only freed in the remove
>> function.
>>
>> The call to platform_get_resource(pdev, IORESOURCE_MEM, 0) is moved coser
>> to the call to devm_request_and_ioremap, which is th first use of the
>> result of platform_get_resource.
>>
>> This does not use devm_request_irq to ensure that free_irq is executed
>> before its idev argument is freed.
>>
>> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>>
>> ---
>>  drivers/iio/adc/at91_adc.c |   41 ++++++++---------------------------------
>>  1 file changed, 8 insertions(+), 33 deletions(-)
>>
>> diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
>> index f61780a..3506e3d 100644
>> --- a/drivers/iio/adc/at91_adc.c
>> +++ b/drivers/iio/adc/at91_adc.c
>> @@ -545,13 +545,6 @@ static int __devinit at91_adc_probe(struct platform_device *pdev)
>>  		goto error_free_device;
>>  	}
>>
>> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> -	if (!res) {
>> -		dev_err(&pdev->dev, "No resource defined\n");
>> -		ret = -ENXIO;
>> -		goto error_ret;
>> -	}
>> -
>>  	platform_set_drvdata(pdev, idev);
>>
>>  	idev->dev.parent = &pdev->dev;
>> @@ -566,18 +559,13 @@ static int __devinit at91_adc_probe(struct platform_device *pdev)
>>  		goto error_free_device;
>>  	}
>>
>> -	if (!request_mem_region(res->start, resource_size(res),
>> -				"AT91 adc registers")) {
>> -		dev_err(&pdev->dev, "Resources are unavailable.\n");
>> -		ret = -EBUSY;
>> -		goto error_free_device;
>> -	}
>> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>
>> -	st->reg_base = ioremap(res->start, resource_size(res));
>> +	st->reg_base = devm_request_and_ioremap(&pdev->dev, res);
>>  	if (!st->reg_base) {
>>  		dev_err(&pdev->dev, "Failed to map registers.\n");

devm_request_and_ioremap will already print a error messages on it's own if
something goes wrong. So strictly speaking this one is redundant, but I don't
think it is necessary to do a resend just for this, maybe you can remove the
extra dev_err when you apply the patch.

WARNING: multiple messages have this Message-ID (diff)
From: Lars-Peter Clausen <lars@metafoo.de>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Julia Lawall <julia.lawall@lip6.fr>,
	Jonathan Cameron <jic23@cam.ac.uk>,
	kernel-janitors@vger.kernel.org, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers/iio/adc/at91_adc.c: use devm_ functions
Date: Wed, 15 Aug 2012 11:02:07 +0200	[thread overview]
Message-ID: <502B658F.5040100@metafoo.de> (raw)
In-Reply-To: <502AB5F1.3050908@kernel.org>

On 08/14/2012 10:32 PM, Jonathan Cameron wrote:
> Lars-Peter,
> 
> Are you happy with this updated version?  Can't immediately find any response
> from you to it.
> 

I think it is ok, you can add my
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>.

One minor nitpick though.

> Jonathan
>> From: Julia Lawall <Julia.Lawall@lip6.fr>
>>
>> The various devm_ functions allocate memory that is released when a driver
>> detaches.  This patch uses these functions for data that is allocated in
>> the probe function of a platform device and is only freed in the remove
>> function.
>>
>> The call to platform_get_resource(pdev, IORESOURCE_MEM, 0) is moved coser
>> to the call to devm_request_and_ioremap, which is th first use of the
>> result of platform_get_resource.
>>
>> This does not use devm_request_irq to ensure that free_irq is executed
>> before its idev argument is freed.
>>
>> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>>
>> ---
>>  drivers/iio/adc/at91_adc.c |   41 ++++++++---------------------------------
>>  1 file changed, 8 insertions(+), 33 deletions(-)
>>
>> diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
>> index f61780a..3506e3d 100644
>> --- a/drivers/iio/adc/at91_adc.c
>> +++ b/drivers/iio/adc/at91_adc.c
>> @@ -545,13 +545,6 @@ static int __devinit at91_adc_probe(struct platform_device *pdev)
>>  		goto error_free_device;
>>  	}
>>
>> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> -	if (!res) {
>> -		dev_err(&pdev->dev, "No resource defined\n");
>> -		ret = -ENXIO;
>> -		goto error_ret;
>> -	}
>> -
>>  	platform_set_drvdata(pdev, idev);
>>
>>  	idev->dev.parent = &pdev->dev;
>> @@ -566,18 +559,13 @@ static int __devinit at91_adc_probe(struct platform_device *pdev)
>>  		goto error_free_device;
>>  	}
>>
>> -	if (!request_mem_region(res->start, resource_size(res),
>> -				"AT91 adc registers")) {
>> -		dev_err(&pdev->dev, "Resources are unavailable.\n");
>> -		ret = -EBUSY;
>> -		goto error_free_device;
>> -	}
>> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>
>> -	st->reg_base = ioremap(res->start, resource_size(res));
>> +	st->reg_base = devm_request_and_ioremap(&pdev->dev, res);
>>  	if (!st->reg_base) {
>>  		dev_err(&pdev->dev, "Failed to map registers.\n");

devm_request_and_ioremap will already print a error messages on it's own if
something goes wrong. So strictly speaking this one is redundant, but I don't
think it is necessary to do a resend just for this, maybe you can remove the
extra dev_err when you apply the patch.

  reply	other threads:[~2012-08-15  9:02 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-31 10:09 [PATCH] drivers/iio/adc/at91_adc.c: use devm_ functions Julia Lawall
2012-07-31 10:09 ` Julia Lawall
2012-07-31 12:36 ` Lars-Peter Clausen
2012-07-31 12:36   ` Lars-Peter Clausen
2012-07-31 12:41   ` Julia Lawall
2012-07-31 12:41     ` Julia Lawall
2012-07-31 13:09   ` Julia Lawall
2012-07-31 13:09     ` Julia Lawall
2012-08-14 20:32     ` Jonathan Cameron
2012-08-14 20:32       ` Jonathan Cameron
2012-08-15  9:02       ` Lars-Peter Clausen [this message]
2012-08-15  9:02         ` Lars-Peter Clausen
2012-08-15  9:20         ` Julia Lawall
2012-08-15  9:20           ` Julia Lawall
2012-08-16 19:04           ` Jonathan Cameron
2012-08-16 19:04             ` Jonathan Cameron
2012-07-31 13:54   ` Julia Lawall
2012-07-31 13:54     ` Julia Lawall
2012-07-31 14:23     ` Lars-Peter Clausen
2012-07-31 14:23       ` Lars-Peter Clausen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=502B658F.5040100@metafoo.de \
    --to=lars@metafoo.de \
    --cc=jic23@cam.ac.uk \
    --cc=jic23@kernel.org \
    --cc=julia.lawall@lip6.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.