[1/3] pwm-core: fix compilation when OF is not selected

Submitted by Eric Benard on April 29, 2012, 3:28 p.m.

Details

Message ID 1335713330-6488-1-git-send-email-eric@eukrea.com
State New
Headers show

Commit Message

Eric Benard April 29, 2012, 3:28 p.m.
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(-)

Comments

Thierry Reding April 29, 2012, 5:04 p.m.
* 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
Eric Benard April 29, 2012, 5:32 p.m.
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
Eric Benard April 29, 2012, 6:59 p.m.
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
Thierry Reding April 29, 2012, 7:04 p.m.
* 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

Patch hide | download patch | download mbox

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