All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
	John Crispin <blogic@openwrt.org>,
	Ralf Baechle <ralf@linux-mips.org>,
	Linux-MIPS <linux-mips@linux-mips.org>
Subject: Re: [PATCH 2/4] MIPS: lantiq: adds minimal dcdc driver
Date: Thu, 08 Aug 2013 13:50:01 +0200	[thread overview]
Message-ID: <520385E9.9000906@metafoo.de> (raw)
In-Reply-To: <CAGVrzcY8NAu0BZBNXVC-sJk7_=40GmepG30ff4+wJQPr4A8J6w@mail.gmail.com>

On 08/08/2013 01:17 PM, Florian Fainelli wrote:
> 2013/8/8 Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>:
>> Hello.
>>
>>
>> On 08-08-2013 13:07, John Crispin wrote:
>>
>>> This driver so far only reads the core voltage.
>>
>>
>>> Signed-off-by: John Crispin <blogic@openwrt.org>
>>
>> [...]
>>
>>
>>> diff --git a/arch/mips/lantiq/xway/dcdc.c b/arch/mips/lantiq/xway/dcdc.c
>>> new file mode 100644
>>> index 0000000..6361c30
>>> --- /dev/null
>>> +++ b/arch/mips/lantiq/xway/dcdc.c
>>> @@ -0,0 +1,75 @@
>>
>> [...]
>>
>>> +static int dcdc_probe(struct platform_device *pdev)
>>> +{
>>> +       struct resource *res;
>>> +
>>> +       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>> +       if (!res) {
>>> +               dev_err(&pdev->dev, "Failed to get resource\n");
>>> +               return -ENOMEM;
>>> +       }
>>
>>
>>     You do not need to check this with devm_request_and_ioremap() or
>> devm_ioremap_resource().
>>
>>
>>> +
>>> +       /* remap dcdc register range */
>>> +       dcdc_membase = devm_request_and_ioremap(&pdev->dev, res);
>>
>>
>>     Use devm_ioremap_resource().
>>
>>
>>> +       if (!dcdc_membase) {
>>> +               dev_err(&pdev->dev, "Failed to remap resource\n");
>>
>>
>>     Error messages are already printed by devm_request_and_ioremap()
>> ordevm_ioremap_resource().
>>
>>> +               return -ENOMEM;
>>
>>
>>     -EADDRNOTAVAIL is the right code for devm_request_and_ioremap().
>
> This is the first time that I read this, lib/devres.c internal returns
> -ENOMEM when an ioremap() call fails (see devm_ioremap_resource),
> -EADDRNOTAVAIL really is for networking matter, this is not.
>

You shouldn't need worry about the return code in this case anyway. This is the 
correct pattern for situations like this:

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(base))
	return PTR_ERR(base);

- Lars

  reply	other threads:[~2013-08-08 11:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-08  9:07 [PATCH 1/4] MIPS: lantiq: adds 4dword burst length for dma John Crispin
2013-08-08  9:07 ` [PATCH 2/4] MIPS: lantiq: adds minimal dcdc driver John Crispin
2013-08-08 10:58   ` Sergei Shtylyov
2013-08-08 11:17     ` Florian Fainelli
2013-08-08 11:50       ` Lars-Peter Clausen [this message]
2013-08-08 12:04       ` Sergei Shtylyov
2013-08-08  9:07 ` [PATCH 3/4] MIPS: lantiq: falcon: add cpu-feature-override.h John Crispin
2013-08-08  9:07 ` [PATCH 4/4] MIPS: lantiq: falcon: fix asc clock definition John Crispin
2013-08-08  9:49 ` [PATCH 1/4] MIPS: lantiq: adds 4dword burst length for dma Thomas Bogendoerfer

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=520385E9.9000906@metafoo.de \
    --to=lars@metafoo.de \
    --cc=blogic@openwrt.org \
    --cc=f.fainelli@gmail.com \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    --cc=sergei.shtylyov@cogentembedded.com \
    /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.