* [PATCH 08/33] drivers/i2c/busses: don't check resource with devm_ioremap_resource
2013-05-16 11:15 [PATCH 00/33] devm improvement series, part 1, take 2 Wolfram Sang
@ 2013-05-16 11:15 ` Wolfram Sang
[not found] ` <1368702961-4325-9-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
2013-05-20 16:40 ` Kukjin Kim
2013-05-16 11:57 ` [PATCH 00/33] devm improvement series, part 1, take 2 Artem Bityutskiy
` (2 subsequent siblings)
3 siblings, 2 replies; 11+ messages in thread
From: Wolfram Sang @ 2013-05-16 11:15 UTC (permalink / raw)
To: linux-kernel
Cc: Wolfram Sang, Ben Dooks, Kukjin Kim, Barry Song, Stephen Warren,
linux-arm-kernel, linux-samsung-soc, linux-i2c, linux-tegra
devm_ioremap_resource does sanity checks on the given resource. No need to
duplicate this in the driver.
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
---
drivers/i2c/busses/i2c-s3c2410.c | 5 -----
drivers/i2c/busses/i2c-sirf.c | 6 ------
drivers/i2c/busses/i2c-tegra.c | 5 -----
3 files changed, 16 deletions(-)
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index 6e8ee92..cab1c91 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -1082,11 +1082,6 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
/* map the registers */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (res == NULL) {
- dev_err(&pdev->dev, "cannot find IO resource\n");
- return -ENOENT;
- }
-
i2c->regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(i2c->regs))
diff --git a/drivers/i2c/busses/i2c-sirf.c b/drivers/i2c/busses/i2c-sirf.c
index 5a7ad24..a63c7d5 100644
--- a/drivers/i2c/busses/i2c-sirf.c
+++ b/drivers/i2c/busses/i2c-sirf.c
@@ -303,12 +303,6 @@ static int i2c_sirfsoc_probe(struct platform_device *pdev)
adap->class = I2C_CLASS_HWMON;
mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (mem_res == NULL) {
- dev_err(&pdev->dev, "Unable to get MEM resource\n");
- err = -EINVAL;
- goto out;
- }
-
siic->base = devm_ioremap_resource(&pdev->dev, mem_res);
if (IS_ERR(siic->base)) {
err = PTR_ERR(siic->base);
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index b60ff90..9aa1b60 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -714,11 +714,6 @@ static int tegra_i2c_probe(struct platform_device *pdev)
int ret = 0;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
- dev_err(&pdev->dev, "no mem resource\n");
- return -EINVAL;
- }
-
base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(base))
return PTR_ERR(base);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 11+ messages in thread[parent not found: <1368702961-4325-9-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>]
* Re: [PATCH 08/33] drivers/i2c/busses: don't check resource with devm_ioremap_resource
[not found] ` <1368702961-4325-9-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
@ 2013-05-16 12:22 ` Barry Song
0 siblings, 0 replies; 11+ messages in thread
From: Barry Song @ 2013-05-16 12:22 UTC (permalink / raw)
To: Wolfram Sang
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, Ben Dooks, Kukjin Kim,
Barry Song, Stephen Warren,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA, DL-SHA-WorkGroupLinux
2013/5/16 Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>:
> devm_ioremap_resource does sanity checks on the given resource. No need to
> duplicate this in the driver.
>
> Signed-off-by: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
Acked-by: Barry Song <Baohua.Song-kQvG35nSl+M@public.gmane.org>
-barry
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 08/33] drivers/i2c/busses: don't check resource with devm_ioremap_resource
2013-05-16 11:15 ` [PATCH 08/33] drivers/i2c/busses: don't check resource with devm_ioremap_resource Wolfram Sang
[not found] ` <1368702961-4325-9-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
@ 2013-05-20 16:40 ` Kukjin Kim
1 sibling, 0 replies; 11+ messages in thread
From: Kukjin Kim @ 2013-05-20 16:40 UTC (permalink / raw)
To: Wolfram Sang
Cc: linux-kernel, Kukjin Kim, Stephen Warren, linux-samsung-soc,
linux-i2c, Ben Dooks, Barry Song, linux-tegra, linux-arm-kernel
On 05/16/13 20:15, Wolfram Sang wrote:
> devm_ioremap_resource does sanity checks on the given resource. No need to
> duplicate this in the driver.
>
> Signed-off-by: Wolfram Sang<wsa@the-dreams.de>
For i2c-s3c2410:
Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Thanks.
- Kukjin
> ---
> drivers/i2c/busses/i2c-s3c2410.c | 5 -----
> drivers/i2c/busses/i2c-sirf.c | 6 ------
> drivers/i2c/busses/i2c-tegra.c | 5 -----
> 3 files changed, 16 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
> index 6e8ee92..cab1c91 100644
> --- a/drivers/i2c/busses/i2c-s3c2410.c
> +++ b/drivers/i2c/busses/i2c-s3c2410.c
> @@ -1082,11 +1082,6 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
> /* map the registers */
>
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - if (res == NULL) {
> - dev_err(&pdev->dev, "cannot find IO resource\n");
> - return -ENOENT;
> - }
> -
> i2c->regs = devm_ioremap_resource(&pdev->dev, res);
>
> if (IS_ERR(i2c->regs))
> diff --git a/drivers/i2c/busses/i2c-sirf.c b/drivers/i2c/busses/i2c-sirf.c
> index 5a7ad24..a63c7d5 100644
> --- a/drivers/i2c/busses/i2c-sirf.c
> +++ b/drivers/i2c/busses/i2c-sirf.c
> @@ -303,12 +303,6 @@ static int i2c_sirfsoc_probe(struct platform_device *pdev)
> adap->class = I2C_CLASS_HWMON;
>
> mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - if (mem_res == NULL) {
> - dev_err(&pdev->dev, "Unable to get MEM resource\n");
> - err = -EINVAL;
> - goto out;
> - }
> -
> siic->base = devm_ioremap_resource(&pdev->dev, mem_res);
> if (IS_ERR(siic->base)) {
> err = PTR_ERR(siic->base);
> diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
> index b60ff90..9aa1b60 100644
> --- a/drivers/i2c/busses/i2c-tegra.c
> +++ b/drivers/i2c/busses/i2c-tegra.c
> @@ -714,11 +714,6 @@ static int tegra_i2c_probe(struct platform_device *pdev)
> int ret = 0;
>
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - if (!res) {
> - dev_err(&pdev->dev, "no mem resource\n");
> - return -EINVAL;
> - }
> -
> base = devm_ioremap_resource(&pdev->dev, res);
> if (IS_ERR(base))
> return PTR_ERR(base);
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 00/33] devm improvement series, part 1, take 2
2013-05-16 11:15 [PATCH 00/33] devm improvement series, part 1, take 2 Wolfram Sang
2013-05-16 11:15 ` [PATCH 08/33] drivers/i2c/busses: don't check resource with devm_ioremap_resource Wolfram Sang
@ 2013-05-16 11:57 ` Artem Bityutskiy
2013-05-16 12:55 ` Viresh Kumar
2013-05-16 18:29 ` Stephen Warren
2013-05-23 20:32 ` Thierry Reding
3 siblings, 1 reply; 11+ messages in thread
From: Artem Bityutskiy @ 2013-05-16 11:57 UTC (permalink / raw)
To: Wolfram Sang
Cc: linux-mips, alsa-devel, Alessandro Zummo, Liam Girdwood,
Alexander Shishkin, Viresh Kumar, Linus Walleij, Thierry Reding,
linux-fbdev, dri-devel, Jaroslav Kysela, linux-ide, linux-mtd,
linux-i2c, Evgeniy Polyakov, ac100, devel, Kukjin Kim,
Russell King, Herbert Xu, Samuel Ortiz, Florian Tobias Schandinat,
Vinod Koul, linux-pm, cpufreq
On Thu, 2013-05-16 at 13:15 +0200, Wolfram Sang wrote:
> Despite various architectures and platform dependencies, I managed to
> compile
> test 45 out of 57 modified files locally using heuristics and
> defconfigs.
> If somebody knows how to create a minimal .config with a certain
> kconfig symbol
> (and its dependencies) set, I'd love to hear about it.
If you find this out, please, share!
--
Best Regards,
Artem Bityutskiy
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 00/33] devm improvement series, part 1, take 2
2013-05-16 11:57 ` [PATCH 00/33] devm improvement series, part 1, take 2 Artem Bityutskiy
@ 2013-05-16 12:55 ` Viresh Kumar
2013-05-16 13:11 ` Artem Bityutskiy
0 siblings, 1 reply; 11+ messages in thread
From: Viresh Kumar @ 2013-05-16 12:55 UTC (permalink / raw)
To: dedekind1
Cc: Wolfram Sang, linux-kernel, linux-mips, alsa-devel, linux-usb,
Alexander Shishkin, Linus Walleij, Matt Mackall, linux-fbdev,
dri-devel, Jaroslav Kysela, linux-ide, Wim Van Sebroeck, netdev,
linux-mtd, linux-i2c, Evgeniy Polyakov, Wan ZongShun, ac100,
devel, Kukjin Kim, Russell King, Herbert Xu, Florian
On 16 May 2013 17:27, Artem Bityutskiy <dedekind1@gmail.com> wrote:
> On Thu, 2013-05-16 at 13:15 +0200, Wolfram Sang wrote:
>> Despite various architectures and platform dependencies, I managed to
>> compile
>> test 45 out of 57 modified files locally using heuristics and
>> defconfigs.
>> If somebody knows how to create a minimal .config with a certain
>> kconfig symbol
>> (and its dependencies) set, I'd love to hear about it.
>
> If you find this out, please, share!
Are you guys looking for "make savedefconfig" ??
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 00/33] devm improvement series, part 1, take 2
2013-05-16 12:55 ` Viresh Kumar
@ 2013-05-16 13:11 ` Artem Bityutskiy
2013-05-16 13:17 ` Tomi Valkeinen
2013-05-16 16:13 ` Wolfram Sang
0 siblings, 2 replies; 11+ messages in thread
From: Artem Bityutskiy @ 2013-05-16 13:11 UTC (permalink / raw)
To: Viresh Kumar
Cc: linux-mips, alsa-devel, Alessandro Zummo, Wolfram Sang,
Alexander Shishkin, Linus Walleij, Thierry Reding, linux-fbdev,
dri-devel, Jaroslav Kysela, linux-ide, linux-mtd, linux-i2c,
Evgeniy Polyakov, ac100, devel, Kukjin Kim, Russell King,
Herbert Xu, Samuel Ortiz, Florian Tobias Schandinat, Vinod Koul,
linux-pm, cpufreq, Eduardo Valentin <eduardo.valentin@
On Thu, 2013-05-16 at 18:25 +0530, Viresh Kumar wrote:
> On 16 May 2013 17:27, Artem Bityutskiy <dedekind1@gmail.com> wrote:
> > On Thu, 2013-05-16 at 13:15 +0200, Wolfram Sang wrote:
> >> Despite various architectures and platform dependencies, I managed to
> >> compile
> >> test 45 out of 57 modified files locally using heuristics and
> >> defconfigs.
> >> If somebody knows how to create a minimal .config with a certain
> >> kconfig symbol
> >> (and its dependencies) set, I'd love to hear about it.
> >
> > If you find this out, please, share!
>
> Are you guys looking for "make savedefconfig" ??
No. It is more like:
I have changed this strange driver.
I want to compile-test my changes.
I need a defconfig which would have this driver enabled. I also want to
know <arch> for my "make ARCH=<arch>" command.
--
Best Regards,
Artem Bityutskiy
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 00/33] devm improvement series, part 1, take 2
2013-05-16 13:11 ` Artem Bityutskiy
@ 2013-05-16 13:17 ` Tomi Valkeinen
2013-05-16 16:13 ` Wolfram Sang
1 sibling, 0 replies; 11+ messages in thread
From: Tomi Valkeinen @ 2013-05-16 13:17 UTC (permalink / raw)
To: dedekind1
Cc: linux-mips, alsa-devel, Alessandro Zummo, Wolfram Sang,
Alexander Shishkin, Viresh Kumar, Linus Walleij, Thierry Reding,
linux-fbdev, dri-devel, Jaroslav Kysela, linux-ide, linux-mtd,
linux-i2c, Evgeniy Polyakov, ac100, devel, Kukjin Kim,
Russell King, Arnd Bergmann, Samuel Ortiz,
Florian Tobias Schandinat, Vinod Koul, linux-pm, cpufreq, Eduar
[-- Attachment #1.1: Type: text/plain, Size: 1568 bytes --]
On 16/05/13 16:11, Artem Bityutskiy wrote:
> On Thu, 2013-05-16 at 18:25 +0530, Viresh Kumar wrote:
>> On 16 May 2013 17:27, Artem Bityutskiy <dedekind1@gmail.com> wrote:
>>> On Thu, 2013-05-16 at 13:15 +0200, Wolfram Sang wrote:
>>>> Despite various architectures and platform dependencies, I managed to
>>>> compile
>>>> test 45 out of 57 modified files locally using heuristics and
>>>> defconfigs.
>>>> If somebody knows how to create a minimal .config with a certain
>>>> kconfig symbol
>>>> (and its dependencies) set, I'd love to hear about it.
>>>
>>> If you find this out, please, share!
>>
>> Are you guys looking for "make savedefconfig" ??
>
> No. It is more like:
>
> I have changed this strange driver.
>
> I want to compile-test my changes.
>
> I need a defconfig which would have this driver enabled. I also want to
> know <arch> for my "make ARCH=<arch>" command.
Not quite the same thing, but I sent this a while ago:
http://lkml.indiana.edu/hypermail/linux/kernel/1304.3/02847.html
My "softdepends" feature is probably not needed, as pointed out in the
thread, as the behavior can be implemented with the current Kconfig
language just fine.
I had a quick look at fbdev drivers, and some of them compile fine on
all (well, arm and x86) archs. But many do have real arch dependencies.
I think it'd be a good long term goal to make drivers arch-independent,
and add CONFIG_SHOW_ALL_DRIVERS or such, which would allow compiling
drivers that are not used on your arch, but still compile fine.
Tomi
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 00/33] devm improvement series, part 1, take 2
2013-05-16 13:11 ` Artem Bityutskiy
2013-05-16 13:17 ` Tomi Valkeinen
@ 2013-05-16 16:13 ` Wolfram Sang
1 sibling, 0 replies; 11+ messages in thread
From: Wolfram Sang @ 2013-05-16 16:13 UTC (permalink / raw)
To: Artem Bityutskiy
Cc: Viresh Kumar, linux-kernel, linux-mips, alsa-devel, linux-usb,
Alexander Shishkin, Linus Walleij, Matt Mackall, linux-fbdev,
dri-devel, Jaroslav Kysela, linux-ide, Wim Van Sebroeck, netdev,
linux-mtd, linux-i2c, Evgeniy Polyakov, Wan ZongShun, ac100,
devel, Kukjin Kim, Russell King, Herbert Xu, Florian
> I need a defconfig which would have this driver enabled.
My wish would be a minimal config. Right now, I try to build the driver
with the current config and when that fails I grep through the
(uncompressed) defconfigs for the symbol needed. Gives me 45/57 success
rate on this series. Not perfect, but the best I could come up with
without writing a .config-generator myself.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 00/33] devm improvement series, part 1, take 2
2013-05-16 11:15 [PATCH 00/33] devm improvement series, part 1, take 2 Wolfram Sang
2013-05-16 11:15 ` [PATCH 08/33] drivers/i2c/busses: don't check resource with devm_ioremap_resource Wolfram Sang
2013-05-16 11:57 ` [PATCH 00/33] devm improvement series, part 1, take 2 Artem Bityutskiy
@ 2013-05-16 18:29 ` Stephen Warren
2013-05-23 20:32 ` Thierry Reding
3 siblings, 0 replies; 11+ messages in thread
From: Stephen Warren @ 2013-05-16 18:29 UTC (permalink / raw)
To: Wolfram Sang
Cc: linux-mips, alsa-devel, linux-usb, Liam Girdwood,
Alexander Shishkin, Viresh Kumar, Linus Walleij, Matt Mackall,
linux-fbdev, dri-devel, Jaroslav Kysela, linux-ide, netdev,
linux-mtd, linux-i2c, Evgeniy Polyakov, Wan ZongShun, ac100,
devel, Kukjin Kim, Russell King, Herbert Xu,
Florian Tobias Schandinat, Rafael J. Wysocki, cpufreq,
Eduardo Valentin <eduardo.v>
On 05/16/2013 05:15 AM, 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 Tegra parts in patches 4, 5, 8, 15, 16, 17, 29 all,
Acked-by: Stephen Warren <swarren@nvidia.com>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 00/33] devm improvement series, part 1, take 2
2013-05-16 11:15 [PATCH 00/33] devm improvement series, part 1, take 2 Wolfram Sang
` (2 preceding siblings ...)
2013-05-16 18:29 ` Stephen Warren
@ 2013-05-23 20:32 ` Thierry Reding
3 siblings, 0 replies; 11+ messages in thread
From: Thierry Reding @ 2013-05-23 20:32 UTC (permalink / raw)
To: Wolfram Sang
Cc: linux-mips, alsa-devel, linux-usb, Liam Girdwood,
Alexander Shishkin, Viresh Kumar, Linus Walleij, Matt Mackall,
linux-fbdev, dri-devel, Jaroslav Kysela, linux-ide, netdev,
linux-mtd, linux-i2c, Evgeniy Polyakov, Wan ZongShun, ac100,
devel, Kukjin Kim, Russell King, Herbert Xu,
Florian Tobias Schandinat, Stephen Warren, Rafael J. Wysocki,
cpufreq
[-- Attachment #1.1: Type: text/plain, Size: 1291 bytes --]
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 #1.2: Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 11+ messages in thread