[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGsJ_4wyJ6Wymy4AWoW1eHubZX=W7GT_Fbow9ofXoY1RrcHzgA@mail.gmail.com>
Date: Tue, 31 Jan 2012 19:04:34 +0800
From: Barry Song <21cnbao@...il.com>
To: Wolfram Sang <w.sang@...gutronix.de>
Cc: Barry Song <Barry.Song@....com>,
Linus Walleij <linus.walleij@...aro.org>,
Greg Kroah-Hartman <gregkh@...e.de>,
linux-kernel@...r.kernel.org, workgroup.linux@....com,
Erik Gilling <konkers@...gle.com>,
Grant Likely <grant.likely@...retlab.ca>,
linux-mtd@...ts.infradead.org, Barry Song <Baohua.Song@....com>,
David Woodhouse <dwmw2@...radead.org>,
Atsushi Nemoto <anemo@....ocn.ne.jp>
Subject: Re: [PATCH 1/3] platform: add common resource requesting and mapping helper
2012/1/31 Wolfram Sang <w.sang@...gutronix.de>:
> On Tue, Jan 31, 2012 at 06:00:00PM +0800, Barry Song wrote:
>> From: Barry Song <Baohua.Song@....com>
>>
>> this patch helps to move the common pattern from
>>
>> "
>> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> if (!res) {
>> ret = -ENODEV;
>> goto err;
>> }
>
> You don't need to do the error checking for 'res'. You can simply do
>
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> base = devm_request_and_ioremap(&dev->dev, res);
i do know devm_request_and_ioremap() does res checking. but that is
implicit, confused and not a smart way actually.
actually, no people by now really use the implicit checking. that
shows people don't really think that is a good programming way.
>
> devm_request_and_ioremap() will check res. Given that, I don't think
> we can save a lot with another wrapper.
i think we can save some.
The story begins from Grant's feedback in:
http://www.spinics.net/lists/arm-kernel/msg157644.html
>
> Thanks,
>
> Wolfram
>
> --
> Pengutronix e.K. | Wolfram Sang |
> Industrial Linux Solutions | http://www.pengutronix.de/ |
-barry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists