* [PATCH 1/3] pwm-core: fix compilation when OF is not selected
@ 2012-04-29 15:28 Eric Bénard
2012-04-29 15:28 ` [PATCH 2/3] pwm-imx: set chip.dev to prevent probe failure Eric Bénard
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Eric Bénard @ 2012-04-29 15:28 UTC (permalink / raw)
To: linux-arm-kernel
else we get the following error :
drivers/pwm/core.c: In function 'pwm_get':
drivers/pwm/core.c:538:3: error: implicit declaration of function 'of_pwm_request' [-Werror=implicit-function-declaration]
Signed-off-by: Eric B?nard <eric@eukrea.com>
---
drivers/pwm/core.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index e5ab7cd..a7be0bc 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -533,9 +533,11 @@ struct pwm_device *pwm_get(struct device *dev, const char *con_id)
unsigned int index;
unsigned int match;
+#ifdef CONFIG_OF
/* look up via DT first */
if (dev && dev->of_node)
return of_pwm_request(dev->of_node, con_id);
+#endif
/*
* We look up the provider in the static table typically provided by
--
1.7.7.6
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/3] pwm-imx: set chip.dev to prevent probe failure
2012-04-29 15:28 [PATCH 1/3] pwm-core: fix compilation when OF is not selected Eric Bénard
@ 2012-04-29 15:28 ` Eric Bénard
2012-04-29 17:07 ` Thierry Reding
2012-04-29 15:28 ` [PATCH 3/3] pwm-core: fix registration of several pwm Eric Bénard
2012-04-29 17:04 ` [PATCH 1/3] pwm-core: fix compilation when OF is not selected Thierry Reding
2 siblings, 1 reply; 9+ messages in thread
From: Eric Bénard @ 2012-04-29 15:28 UTC (permalink / raw)
To: linux-arm-kernel
else pwmchip_add fails
Signed-off-by: Eric B?nard <eric@eukrea.com>
---
drivers/pwm/pwm-imx.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/pwm/pwm-imx.c b/drivers/pwm/pwm-imx.c
index ef9c51b..d69275f 100644
--- a/drivers/pwm/pwm-imx.c
+++ b/drivers/pwm/pwm-imx.c
@@ -175,6 +175,7 @@ static int __devinit imx_pwm_probe(struct platform_device *pdev)
imx->chip.ops = &imx_pwm_ops;
imx->chip.base = -1;
imx->chip.npwm = 1;
+ imx->chip.dev = &pdev->dev;
imx->clk_enabled = 0;
--
1.7.7.6
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/3] pwm-core: fix registration of several pwm
2012-04-29 15:28 [PATCH 1/3] pwm-core: fix compilation when OF is not selected Eric Bénard
2012-04-29 15:28 ` [PATCH 2/3] pwm-imx: set chip.dev to prevent probe failure Eric Bénard
@ 2012-04-29 15:28 ` Eric Bénard
2012-04-29 17:14 ` Thierry Reding
2012-04-29 17:04 ` [PATCH 1/3] pwm-core: fix compilation when OF is not selected Thierry Reding
2 siblings, 1 reply; 9+ messages in thread
From: Eric Bénard @ 2012-04-29 15:28 UTC (permalink / raw)
To: linux-arm-kernel
* after a pwm is allocated using alloc_pwms, ret contains the number
of the pwm and is returned by pwmchip_add so the calling driver
(pwm-imx in my case) fails with the following log :
mxc_pwm: probe of mxc_pwm.1 failed with error 1
mxc_pwm: probe of mxc_pwm.2 failed with error 2
mxc_pwm: probe of mxc_pwm.3 failed with error 3
* this patch fix error handling in pwmchip_add
Signed-off-by: Eric B?nard <eric@eukrea.com>
---
drivers/pwm/core.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index a7be0bc..d3438e4 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -216,8 +216,10 @@ int pwmchip_add(struct pwm_chip *chip)
goto out;
chip->pwms = kzalloc(chip->npwm * sizeof(*pwm), GFP_KERNEL);
- if (!chip->pwms)
- return -ENOMEM;
+ if (!chip->pwms) {
+ ret = -ENOMEM;
+ goto out;
+ }
chip->base = ret;
@@ -239,6 +241,7 @@ int pwmchip_add(struct pwm_chip *chip)
if (IS_ENABLED(CONFIG_OF))
of_pwmchip_add(chip);
+ ret = 0;
out:
mutex_unlock(&pwm_lock);
return ret;
--
1.7.7.6
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 1/3] pwm-core: fix compilation when OF is not selected
2012-04-29 15:28 [PATCH 1/3] pwm-core: fix compilation when OF is not selected Eric Bénard
2012-04-29 15:28 ` [PATCH 2/3] pwm-imx: set chip.dev to prevent probe failure Eric Bénard
2012-04-29 15:28 ` [PATCH 3/3] pwm-core: fix registration of several pwm Eric Bénard
@ 2012-04-29 17:04 ` Thierry Reding
2012-04-29 17:32 ` Eric Bénard
2012-04-29 18:59 ` Eric Bénard
2 siblings, 2 replies; 9+ messages in thread
From: Thierry Reding @ 2012-04-29 17:04 UTC (permalink / raw)
To: linux-arm-kernel
* Eric B?nard wrote:
> else we get the following error :
> drivers/pwm/core.c: In function 'pwm_get':
> drivers/pwm/core.c:538:3: error: implicit declaration of function 'of_pwm_request' [-Werror=implicit-function-declaration]
>
> Signed-off-by: Eric B?nard <eric@eukrea.com>
This is solved a little differently in the latest patches. That no longer has
the of_pwm_request() function protected by #ifdef CONFIG_OF, but rather calls
it in a IS_ENABLED(CONFIG_OF)-protected block so that it will still receive
compile coverage in !OF configurations but at the same time will be removed
by the compiler's dead code elimination.
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120429/60616669/attachment.sig>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/3] pwm-imx: set chip.dev to prevent probe failure
2012-04-29 15:28 ` [PATCH 2/3] pwm-imx: set chip.dev to prevent probe failure Eric Bénard
@ 2012-04-29 17:07 ` Thierry Reding
0 siblings, 0 replies; 9+ messages in thread
From: Thierry Reding @ 2012-04-29 17:07 UTC (permalink / raw)
To: linux-arm-kernel
* Eric B?nard wrote:
> else pwmchip_add fails
>
> Signed-off-by: Eric B?nard <eric@eukrea.com>
Are you okay with me folding your patch into the i.MX patch in the existing
series?
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120429/43c92787/attachment.sig>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/3] pwm-core: fix registration of several pwm
2012-04-29 15:28 ` [PATCH 3/3] pwm-core: fix registration of several pwm Eric Bénard
@ 2012-04-29 17:14 ` Thierry Reding
0 siblings, 0 replies; 9+ messages in thread
From: Thierry Reding @ 2012-04-29 17:14 UTC (permalink / raw)
To: linux-arm-kernel
* Eric B?nard wrote:
> * after a pwm is allocated using alloc_pwms, ret contains the number
> of the pwm and is returned by pwmchip_add so the calling driver
> (pwm-imx in my case) fails with the following log :
> mxc_pwm: probe of mxc_pwm.1 failed with error 1
> mxc_pwm: probe of mxc_pwm.2 failed with error 2
> mxc_pwm: probe of mxc_pwm.3 failed with error 3
>
> * this patch fix error handling in pwmchip_add
>
> Signed-off-by: Eric B?nard <eric@eukrea.com>
> ---
> drivers/pwm/core.c | 7 +++++--
> 1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
> index a7be0bc..d3438e4 100644
> --- a/drivers/pwm/core.c
> +++ b/drivers/pwm/core.c
> @@ -216,8 +216,10 @@ int pwmchip_add(struct pwm_chip *chip)
> goto out;
>
> chip->pwms = kzalloc(chip->npwm * sizeof(*pwm), GFP_KERNEL);
> - if (!chip->pwms)
> - return -ENOMEM;
> + if (!chip->pwms) {
> + ret = -ENOMEM;
> + goto out;
> + }
Good catch!
>
> chip->base = ret;
>
> @@ -239,6 +241,7 @@ int pwmchip_add(struct pwm_chip *chip)
> if (IS_ENABLED(CONFIG_OF))
> of_pwmchip_add(chip);
>
> + ret = 0;
> out:
> mutex_unlock(&pwm_lock);
> return ret;
pwmchip_add() is meant to return a negative error-code on failure, so a
positive return values would still indicate success, therefore any callers
should check explicitly for (ret < 0) instead of just (ret). However in this
case it might be safer to make the return value explicitly 0 in case of
success.
I'd like to fold this into the existing series as well, if that's okay with
you.
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120429/9288c84e/attachment.sig>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/3] pwm-core: fix compilation when OF is not selected
2012-04-29 17:04 ` [PATCH 1/3] pwm-core: fix compilation when OF is not selected Thierry Reding
@ 2012-04-29 17:32 ` Eric Bénard
2012-04-29 18:59 ` Eric Bénard
1 sibling, 0 replies; 9+ messages in thread
From: Eric Bénard @ 2012-04-29 17:32 UTC (permalink / raw)
To: linux-arm-kernel
Le Sun, 29 Apr 2012 19:04:31 +0200,
Thierry Reding <thierry.reding@avionic-design.de> a ?crit :
> * Eric B?nard wrote:
> > else we get the following error :
> > drivers/pwm/core.c: In function 'pwm_get':
> > drivers/pwm/core.c:538:3: error: implicit declaration of function 'of_pwm_request' [-Werror=implicit-function-declaration]
> >
> > Signed-off-by: Eric B?nard <eric@eukrea.com>
>
> This is solved a little differently in the latest patches. That no longer has
> the of_pwm_request() function protected by #ifdef CONFIG_OF, but rather calls
> it in a IS_ENABLED(CONFIG_OF)-protected block so that it will still receive
> compile coverage in !OF configurations but at the same time will be removed
> by the compiler's dead code elimination.
>
OK, this was based on de8eba0b1e53ee0d2e3270c12d6482971e2beb4b in your
tree dated the 27th march. I now see you updated it on friday.
Eric
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/3] pwm-core: fix compilation when OF is not selected
2012-04-29 17:04 ` [PATCH 1/3] pwm-core: fix compilation when OF is not selected Thierry Reding
2012-04-29 17:32 ` Eric Bénard
@ 2012-04-29 18:59 ` Eric Bénard
2012-04-29 19:04 ` Thierry Reding
1 sibling, 1 reply; 9+ messages in thread
From: Eric Bénard @ 2012-04-29 18:59 UTC (permalink / raw)
To: linux-arm-kernel
Le Sun, 29 Apr 2012 19:04:31 +0200,
Thierry Reding <thierry.reding@avionic-design.de> a ?crit :
> * Eric B?nard wrote:
> > else we get the following error :
> > drivers/pwm/core.c: In function 'pwm_get':
> > drivers/pwm/core.c:538:3: error: implicit declaration of function 'of_pwm_request' [-Werror=implicit-function-declaration]
> >
> > Signed-off-by: Eric B?nard <eric@eukrea.com>
>
> This is solved a little differently in the latest patches. That no longer has
> the of_pwm_request() function protected by #ifdef CONFIG_OF, but rather calls
> it in a IS_ENABLED(CONFIG_OF)-protected block so that it will still receive
> compile coverage in !OF configurations but at the same time will be removed
> by the compiler's dead code elimination.
>
OK this still doesn't work (using linux-2.6 at :
f7b006931751f029620ad2f8310ac7a1484fbdb4 ) leads to :
CC drivers/pwm/core.o drivers/pwm/core.c: In function
'of_pwm_request': drivers/pwm/core.c:447:3: error: implicit
declaration of function
'of_property_match_string' [-Werror=implicit-function-declaration]
drivers/pwm/core.c:452:2: error: implicit declaration of function
'of_parse_phandle_with_args' [-Werror=implicit-function-declaration]
in include/linux/of.h the declaration of these function is inside
a #ifdef CONFIG_OF / #endif so I don't see how this can compile.
Eric
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/3] pwm-core: fix compilation when OF is not selected
2012-04-29 18:59 ` Eric Bénard
@ 2012-04-29 19:04 ` Thierry Reding
0 siblings, 0 replies; 9+ messages in thread
From: Thierry Reding @ 2012-04-29 19:04 UTC (permalink / raw)
To: linux-arm-kernel
* Eric B?nard wrote:
> Le Sun, 29 Apr 2012 19:04:31 +0200,
> Thierry Reding <thierry.reding@avionic-design.de> a ?crit :
>
> > * Eric B?nard wrote:
> > > else we get the following error :
> > > drivers/pwm/core.c: In function 'pwm_get':
> > > drivers/pwm/core.c:538:3: error: implicit declaration of function 'of_pwm_request' [-Werror=implicit-function-declaration]
> > >
> > > Signed-off-by: Eric B?nard <eric@eukrea.com>
> >
> > This is solved a little differently in the latest patches. That no longer has
> > the of_pwm_request() function protected by #ifdef CONFIG_OF, but rather calls
> > it in a IS_ENABLED(CONFIG_OF)-protected block so that it will still receive
> > compile coverage in !OF configurations but at the same time will be removed
> > by the compiler's dead code elimination.
> >
> OK this still doesn't work (using linux-2.6 at :
> f7b006931751f029620ad2f8310ac7a1484fbdb4 ) leads to :
> CC drivers/pwm/core.o drivers/pwm/core.c: In function
> 'of_pwm_request': drivers/pwm/core.c:447:3: error: implicit
> declaration of function
> 'of_property_match_string' [-Werror=implicit-function-declaration]
> drivers/pwm/core.c:452:2: error: implicit declaration of function
> 'of_parse_phandle_with_args' [-Werror=implicit-function-declaration]
>
> in include/linux/of.h the declaration of these function is inside
> a #ifdef CONFIG_OF / #endif so I don't see how this can compile.
I've already posted patches to the devicetree-discuss mailing list. I hope
they'll be queued soon.
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120429/d0104846/attachment.sig>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-04-29 19:04 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-29 15:28 [PATCH 1/3] pwm-core: fix compilation when OF is not selected Eric Bénard
2012-04-29 15:28 ` [PATCH 2/3] pwm-imx: set chip.dev to prevent probe failure Eric Bénard
2012-04-29 17:07 ` Thierry Reding
2012-04-29 15:28 ` [PATCH 3/3] pwm-core: fix registration of several pwm Eric Bénard
2012-04-29 17:14 ` Thierry Reding
2012-04-29 17:04 ` [PATCH 1/3] pwm-core: fix compilation when OF is not selected Thierry Reding
2012-04-29 17:32 ` Eric Bénard
2012-04-29 18:59 ` Eric Bénard
2012-04-29 19:04 ` Thierry Reding
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).