linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: peter.ujfalusi@ti.com (Peter Ujfalusi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/5] drivers: bus: omap_l3: Convert to use devm_request_and_ioremap()
Date: Tue, 4 Mar 2014 12:50:34 +0200	[thread overview]
Message-ID: <5315AFFA.40101@ti.com> (raw)
In-Reply-To: <1393924359.866301359@f148.i.mail.ru>

On 03/04/2014 11:12 AM, Alexander Shiyan wrote:
> ???????,  4 ????? 2014, 11:01 +02:00 ?? Peter Ujfalusi <peter.ujfalusi@ti.com>:
>> We can then remove the iounmap() calls from probe and remove.
>> Since the driver requests the resources via index we can do the mem resource
>> request within a for loop.
>>
>> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
>> Reviewed-by: Santosh Shilimkar <santosh.shilimkar@ti>
>> ---
> 
>> +	/* Get mem resources */
>> +	for (i = 0; i < 3; i++) {
>> +		struct resource	*res = platform_get_resource(pdev,
>> +							     IORESOURCE_MEM, i);
>> +		if (!res) {
>> +			dev_err(&pdev->dev, "couldn't find resource %d\n", i);
>> +			return -ENODEV;
>> +		}
> 
> No need to check "res". devm_request_and_ioremap() do all for us.
> 
>> -	l3->l3_base[2] = ioremap(res->start, resource_size(res));
>> -	if (!l3->l3_base[2]) {
>> -		dev_err(&pdev->dev, "ioremap failed\n");
>> -		ret = -ENOMEM;
>> -		goto err2;
>> +		l3->l3_base[i] = devm_request_and_ioremap(&pdev->dev, res);
>> +		if (!l3->l3_base[i]) {
> 
> if (IS_ERR(l3->l3_base[i]))
> 
>> +			dev_err(&pdev->dev, "ioremap %d failed\n", i);
> 
> Unnecessary.

I'm going to keep this since it tells which resource of the three has failed.

> 
>> +			return -ENOMEM;
> 
> return PTR_ERR(l3->l3_base[i]);
> 
> ---
> 


-- 
P?ter

  parent reply	other threads:[~2014-03-04 10:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-04  9:01 [PATCH 0/5] drivers: bus: omap_l3: Conversion to devm_* Peter Ujfalusi
2014-03-04  9:01 ` [PATCH 1/5] drivers: bus: omap_l3: Convert to use devm_kzalloc Peter Ujfalusi
2014-03-04  9:07   ` Peter Ujfalusi
2014-03-04  9:01 ` [PATCH 2/5] drivers: bus: omap_l3: Convert to use devm_request_and_ioremap() Peter Ujfalusi
2014-03-04  9:12   ` Alexander Shiyan
2014-03-04  9:23     ` Alexander Shiyan
2014-03-04  9:42       ` Peter Ujfalusi
2014-03-04  9:42     ` Peter Ujfalusi
2014-03-04 10:50     ` Peter Ujfalusi [this message]
2014-03-04  9:01 ` [PATCH 3/5] drivers: bus: omap_l3: Convert to use devm_request_irq() Peter Ujfalusi
2014-03-04  9:01 ` [PATCH 4/5] drivers: bus: omap_l3: Remove the platform driver's remove function Peter Ujfalusi
2014-03-04  9:01 ` [PATCH 5/5] drivers: bus: omap_l3: Change pr_crit() to dev_err() when IRQ request fails Peter Ujfalusi

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=5315AFFA.40101@ti.com \
    --to=peter.ujfalusi@ti.com \
    --cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).