linux-mips
[Top] [All Lists]

Re: [PATCH 00/33] devm improvement series, part 1, take 2

To: Wolfram Sang <wsa@the-dreams.de>
Subject: Re: [PATCH 00/33] devm improvement series, part 1, take 2
From: Thierry Reding <thierry.reding@avionic-design.de>
Date: Thu, 23 May 2013 22:32:43 +0200
Cc: linux-kernel@vger.kernel.org, ac100@lists.launchpad.net, Alan Stern <stern@rowland.harvard.edu>, Alessandro Zummo <a.zummo@towertech.it>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, alsa-devel@alsa-project.org, Arnd Bergmann <arnd@arndb.de>, Barry Song <baohua.song@csr.com>, Ben Dooks <ben-linux@fluff.org>, cpufreq@vger.kernel.org, Dan Williams <djbw@fb.com>, David Airlie <airlied@linux.ie>, David Woodhouse <dwmw2@infradead.org>, Deepak Saxena <dsaxena@plexity.net>, devel@driverdev.osuosl.org, dri-devel@lists.freedesktop.org, Eduardo Valentin <eduardo.valentin@ti.com>, Evgeniy Polyakov <zbr@ioremap.net>, Felipe Balbi <balbi@ti.com>, Florian Tobias Schandinat <FlorianSchandinat@gmx.de>, Grant Likely <grant.likely@linaro.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Herbert Xu <herbert@gondor.apana.org.au>, Inki Dae <inki.dae@samsung.com>, Jaroslav Kysela <perex@perex.cz>, Joonyoung Shim <jy0922.shim@samsung.com>, Julian Andres Klode <jak@jak-linux.org>, Kukjin Kim <kgene.kim@samsung.com>, Kyungmin Park <kyungmin.park@samsung.com>, Liam Girdwood <lgirdwood@gmail.com>, Linus Torvalds <torvalds@linux-foundation.org>, Linus Walleij <linus.walleij@linaro.org>, linux-arm-kernel@lists.infradead.org, linux-fbdev@vger.kernel.org, linux-i2c@vger.kernel.org, linux-ide@vger.kernel.org, linux-mips@linux-mips.org, linux-mtd@lists.infradead.org, linux-omap@vger.kernel.org, linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org, linux-watchdog@vger.kernel.org, Marc Dietrich <marvin24@gmx.de>, Mark Brown <broonie@kernel.org>, Matt Mackall <mpm@selenic.com>, netdev@vger.kernel.org, Paul Zimmerman <paulz@synopsys.com>, "Rafael J. Wysocki" <rjw@sisk.pl>, Ralf Baechle <ralf@linux-mips.org>, rtc-linux@googlegroups.com, Russell King <linux@arm.linux.org.uk>, Samuel Ortiz <sameo@linux.intel.com>, Seung-Woo Kim <sw0312.kim@samsung.com>, spi-devel-general@lists.sourceforge.net, Stephen Warren <swarren@wwwdotorg.org>, Takashi Iwai <tiwai@suse.de>, Tejun Heo <tj@kernel.org>, Tomi Valkeinen <tomi.valkeinen@ti.com>, Tony Prisk <linux@prisktech.co.nz>, Vinod Koul <vinod.koul@intel.com>, Viresh Kumar <viresh.kumar@linaro.org>, Wan ZongShun <mcuos.com@gmail.com>, Wim Van Sebroeck <wim@iguana.be>, Zhang Rui <rui.zhang@intel.com>
In-reply-to: <1368702961-4325-1-git-send-email-wsa@the-dreams.de>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1368702961-4325-1-git-send-email-wsa@the-dreams.de>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.21 (2010-09-15)
On Thu, May 16, 2013 at 01:15:28PM +0200, Wolfram Sang wrote:
> Lately, I have been experimenting how to improve the devm interface to make
> writing device drivers easier and less error prone while also getting rid of
> its subtle issues. I think it has more potential but still needs work and
> definately conistency, especiall in its usage.
> 
> The first thing I come up with is a low hanging fruit regarding
> devm_ioremap_resouce(). This function already checks if the passed resource is
> valid and gives an error message if not. So, we can remove similar checks from
> the drivers and get rid of a bit of code and a number of inconsistent error
> strings.

Sorry for jumping in so late. I generally like the idea. One small
inconvenience is that devm_ioremap_resource() returns -EINVAL if
res == NULL, which means that drivers will now also return -EINVAL
in cases where no resource was returned. Typically drivers handle
this by returning something like -ENODEV, -ENXIO, -ENOENT. Some do
return -EINVAL but perhaps having a separate error code (and maybe
error message as well) for a missing resource would be helpful.

Doing this would be rather easy now that you've paved the way by
making devm_ioremap_resource() usage consistent across drivers.

Thierry

Attachment: pgpzWgPnNz92Z.pgp
Description: PGP signature

<Prev in Thread] Current Thread [Next in Thread>