linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dmaengine: edma: fix build without CONFIG_OF
@ 2015-11-03 14:00 Arnd Bergmann
  2015-11-04  7:42 ` Peter Ujfalusi
  2015-11-16  3:36 ` Vinod Koul
  0 siblings, 2 replies; 6+ messages in thread
From: Arnd Bergmann @ 2015-11-03 14:00 UTC (permalink / raw)
  To: Vinod Koul, dmaengine
  Cc: Dan Williams, linux-kernel, Peter Ujfalusi, linux-arm-kernel,
	Sekhar Nori, Kevin Hilman, linux-omap

During the edma rework, a build error was introduced for the
case that CONFIG_OF is disabled:

drivers/built-in.o: In function `edma_tc_set_pm_state':
:(.text+0x43bf0): undefined reference to `of_find_device_by_node'

As the edma_tc_set_pm_state() function does nothing in case
we are running without OF, this adds an IS_ENABLED() check
that turns the function into an empty stub then and avoids the
link error.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: ca304fa9bb76 ("ARM/dmaengine: edma: Public API to use private struct pointer")
---
Found on ARM randconfig builds with today's linux-next

diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
index 31722d436a42..16713a93da10 100644
--- a/drivers/dma/edma.c
+++ b/drivers/dma/edma.c
@@ -1560,7 +1560,7 @@ static void edma_tc_set_pm_state(struct edma_tc *tc, bool enable)
 	struct platform_device *tc_pdev;
 	int ret;
 
-	if (!tc)
+	if (!IS_ENABLED(CONFIG_OF) || !tc)
 		return;
 
 	tc_pdev = of_find_device_by_node(tc->node);

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] dmaengine: edma: fix build without CONFIG_OF
  2015-11-03 14:00 [PATCH] dmaengine: edma: fix build without CONFIG_OF Arnd Bergmann
@ 2015-11-04  7:42 ` Peter Ujfalusi
  2015-11-04  8:46   ` Arnd Bergmann
  2015-11-16  3:36 ` Vinod Koul
  1 sibling, 1 reply; 6+ messages in thread
From: Peter Ujfalusi @ 2015-11-04  7:42 UTC (permalink / raw)
  To: Arnd Bergmann, Vinod Koul, dmaengine
  Cc: Dan Williams, linux-kernel, linux-arm-kernel, Sekhar Nori,
	Kevin Hilman, linux-omap

On 11/03/2015 04:00 PM, Arnd Bergmann wrote:
> During the edma rework, a build error was introduced for the
> case that CONFIG_OF is disabled:
> 
> drivers/built-in.o: In function `edma_tc_set_pm_state':
> :(.text+0x43bf0): undefined reference to `of_find_device_by_node'
> 
> As the edma_tc_set_pm_state() function does nothing in case
> we are running without OF, this adds an IS_ENABLED() check
> that turns the function into an empty stub then and avoids the
> link error.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: ca304fa9bb76 ("ARM/dmaengine: edma: Public API to use private struct pointer")

The actual commit this patch is fixing is:
1be5336bc7ba dmaengine: edma: New device tree binding

> ---
> Found on ARM randconfig builds with today's linux-next

I have sanity built the kernel with omap2plus_defconfig and
davinci_all_defconfig since eDMA is used by these platforms and did not faced
with this issue, as obviously these defconfigs will result OF to be enabled.

> diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
> index 31722d436a42..16713a93da10 100644
> --- a/drivers/dma/edma.c
> +++ b/drivers/dma/edma.c
> @@ -1560,7 +1560,7 @@ static void edma_tc_set_pm_state(struct edma_tc *tc, bool enable)
>  	struct platform_device *tc_pdev;
>  	int ret;
>  
> -	if (!tc)
> +	if (!IS_ENABLED(CONFIG_OF) || !tc)
>  		return;

Should we instead put the function inside of:
#if IS_ENABLED(CONFIG_OF)
static void edma_tc_set_pm_state(struct edma_tc *tc, bool enable)
{
...
}
#else
static inline void edma_tc_set_pm_state(struct edma_tc *tc, bool enable)
{
}
#endif /* IS_ENABLED(CONFIG_OF) */


>  
>  	tc_pdev = of_find_device_by_node(tc->node);
> 

-- 
Péter

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] dmaengine: edma: fix build without CONFIG_OF
  2015-11-04  7:42 ` Peter Ujfalusi
@ 2015-11-04  8:46   ` Arnd Bergmann
  2015-11-04  9:05     ` Peter Ujfalusi
  0 siblings, 1 reply; 6+ messages in thread
From: Arnd Bergmann @ 2015-11-04  8:46 UTC (permalink / raw)
  To: Peter Ujfalusi
  Cc: Vinod Koul, dmaengine, Dan Williams, linux-kernel,
	linux-arm-kernel, Sekhar Nori, Kevin Hilman, linux-omap

On Wednesday 04 November 2015 09:42:35 Peter Ujfalusi wrote:
> On 11/03/2015 04:00 PM, Arnd Bergmann wrote:
> > During the edma rework, a build error was introduced for the
> > case that CONFIG_OF is disabled:
> > 
> > drivers/built-in.o: In function `edma_tc_set_pm_state':
> > :(.text+0x43bf0): undefined reference to `of_find_device_by_node'
> > 
> > As the edma_tc_set_pm_state() function does nothing in case
> > we are running without OF, this adds an IS_ENABLED() check
> > that turns the function into an empty stub then and avoids the
> > link error.
> > 
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > Fixes: ca304fa9bb76 ("ARM/dmaengine: edma: Public API to use private struct pointer")
> 
> The actual commit this patch is fixing is:
> 1be5336bc7ba dmaengine: edma: New device tree binding

That's what I first thought, but it seems to just move around the
call to of_find_device_by_node that was first introduced in the
commit I mentioned. Did you build-test it successfully with
ca304fa9bb76 and CONFIG_OF enabled? I have to admit that I
was just guessing from the contents and did not bisect this
fully.

> > ---
> > Found on ARM randconfig builds with today's linux-next
> 
> I have sanity built the kernel with omap2plus_defconfig and
> davinci_all_defconfig since eDMA is used by these platforms and did not faced
> with this issue, as obviously these defconfigs will result OF to be enabled.

Right. The defconfigs were all fine, and this is hard to hit
even in the randconfig builds.

> > diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
> > index 31722d436a42..16713a93da10 100644
> > --- a/drivers/dma/edma.c
> > +++ b/drivers/dma/edma.c
> > @@ -1560,7 +1560,7 @@ static void edma_tc_set_pm_state(struct edma_tc *tc, bool enable)
> >       struct platform_device *tc_pdev;
> >       int ret;
> >  
> > -     if (!tc)
> > +     if (!IS_ENABLED(CONFIG_OF) || !tc)
> >               return;
> 
> Should we instead put the function inside of:
> #if IS_ENABLED(CONFIG_OF)
> static void edma_tc_set_pm_state(struct edma_tc *tc, bool enable)
> {
> ...
> }
> #else
> static inline void edma_tc_set_pm_state(struct edma_tc *tc, bool enable)
> {
> }
> #endif /* IS_ENABLED(CONFIG_OF) */

I think that would be less readable, and gives no compile-time coverage
to the contents of the edma_tc_set_pm_state function.

The effect is the same, so I'd rather stay with my version.

	Arnd

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] dmaengine: edma: fix build without CONFIG_OF
  2015-11-04  8:46   ` Arnd Bergmann
@ 2015-11-04  9:05     ` Peter Ujfalusi
  2015-11-04 10:29       ` Arnd Bergmann
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Ujfalusi @ 2015-11-04  9:05 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Vinod Koul, dmaengine, Dan Williams, linux-kernel,
	linux-arm-kernel, Sekhar Nori, Kevin Hilman, linux-omap

On 11/04/2015 10:46 AM, Arnd Bergmann wrote:
> On Wednesday 04 November 2015 09:42:35 Peter Ujfalusi wrote:
>> On 11/03/2015 04:00 PM, Arnd Bergmann wrote:
>>> During the edma rework, a build error was introduced for the
>>> case that CONFIG_OF is disabled:
>>>
>>> drivers/built-in.o: In function `edma_tc_set_pm_state':
>>> :(.text+0x43bf0): undefined reference to `of_find_device_by_node'
>>>
>>> As the edma_tc_set_pm_state() function does nothing in case
>>> we are running without OF, this adds an IS_ENABLED() check
>>> that turns the function into an empty stub then and avoids the
>>> link error.
>>>
>>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>>> Fixes: ca304fa9bb76 ("ARM/dmaengine: edma: Public API to use private struct pointer")
>>
>> The actual commit this patch is fixing is:
>> 1be5336bc7ba dmaengine: edma: New device tree binding
> 
> That's what I first thought, but it seems to just move around the
> call to of_find_device_by_node that was first introduced in the
> commit I mentioned. Did you build-test it successfully with
> ca304fa9bb76 and CONFIG_OF enabled? I have to admit that I
> was just guessing from the contents and did not bisect this
> fully.

Ah, I see. That of_find_device_by_node() was used by the function used to
build the unused channel list for the legacy old code. The whole unused
channel list has been removed by the new DT binding patch since it was bogus
to start with and there is no need for it anymore.

> 
>>> ---
>>> Found on ARM randconfig builds with today's linux-next
>>
>> I have sanity built the kernel with omap2plus_defconfig and
>> davinci_all_defconfig since eDMA is used by these platforms and did not faced
>> with this issue, as obviously these defconfigs will result OF to be enabled.
> 
> Right. The defconfigs were all fine, and this is hard to hit
> even in the randconfig builds.

I just did a sanity clean _defconfig builds and they both built fine (even w/o
this patch), phew.

>>> diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
>>> index 31722d436a42..16713a93da10 100644
>>> --- a/drivers/dma/edma.c
>>> +++ b/drivers/dma/edma.c
>>> @@ -1560,7 +1560,7 @@ static void edma_tc_set_pm_state(struct edma_tc *tc, bool enable)
>>>       struct platform_device *tc_pdev;
>>>       int ret;
>>>  
>>> -     if (!tc)
>>> +     if (!IS_ENABLED(CONFIG_OF) || !tc)
>>>               return;
>>
>> Should we instead put the function inside of:
>> #if IS_ENABLED(CONFIG_OF)
>> static void edma_tc_set_pm_state(struct edma_tc *tc, bool enable)
>> {
>> ...
>> }
>> #else
>> static inline void edma_tc_set_pm_state(struct edma_tc *tc, bool enable)
>> {
>> }
>> #endif /* IS_ENABLED(CONFIG_OF) */
> 
> I think that would be less readable, and gives no compile-time coverage
> to the contents of the edma_tc_set_pm_state function.

Hrm, if the compiler knows that there is no need to compile the code after the:
if (!IS_ENABLED(CONFIG_OF) || !tc)
when OF is disabled, then it does not give more compile coverage then have
empty inline function in case of !OF.
Not sure about it, but if we disable all optimization in gcc, then we might
get the same missing symbol?

> The effect is the same, so I'd rather stay with my version.

I'm fine with both. It is up to Vinod to decide which one he prefers (I prefer
the #if #else #endif version).

Anyways:
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] dmaengine: edma: fix build without CONFIG_OF
  2015-11-04  9:05     ` Peter Ujfalusi
@ 2015-11-04 10:29       ` Arnd Bergmann
  0 siblings, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2015-11-04 10:29 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Peter Ujfalusi, Vinod Koul, Sekhar Nori, linux-kernel,
	Kevin Hilman, dmaengine, Dan Williams, linux-omap

On Wednesday 04 November 2015 11:05:54 Peter Ujfalusi wrote:
> > 
> > I think that would be less readable, and gives no compile-time coverage
> > to the contents of the edma_tc_set_pm_state function.
> 
> Hrm, if the compiler knows that there is no need to compile the code after the:
> if (!IS_ENABLED(CONFIG_OF) || !tc)
> when OF is disabled, then it does not give more compile coverage then have
> empty inline function in case of !OF.

No, the way it works (simplified but close enough here) is that gcc parses
all the source code first and throws warnings or errors for everything that
looks wrong to it, and only later throws out all code that it knows is never
used before emitting the object code.

The difference to the #ifdef is that the preprocessor here throws out all
disabled code before it gets parsed, so we don't get warnings for it.

> Not sure about it, but if we disable all optimization in gcc, then we might
> get the same missing symbol?

It's impossible to build the kernel with inlining disabled, because we
rely on the same kind of optimization in lots of places.

> > The effect is the same, so I'd rather stay with my version.
> 
> I'm fine with both. It is up to Vinod to decide which one he prefers (I prefer
> the #if #else #endif version).
> 
> Anyways:
> Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

Thanks!

	Arnd

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] dmaengine: edma: fix build without CONFIG_OF
  2015-11-03 14:00 [PATCH] dmaengine: edma: fix build without CONFIG_OF Arnd Bergmann
  2015-11-04  7:42 ` Peter Ujfalusi
@ 2015-11-16  3:36 ` Vinod Koul
  1 sibling, 0 replies; 6+ messages in thread
From: Vinod Koul @ 2015-11-16  3:36 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: dmaengine, Dan Williams, linux-kernel, Peter Ujfalusi,
	linux-arm-kernel, Sekhar Nori, Kevin Hilman, linux-omap

On Tue, Nov 03, 2015 at 03:00:57PM +0100, Arnd Bergmann wrote:
> During the edma rework, a build error was introduced for the
> case that CONFIG_OF is disabled:
> 
> drivers/built-in.o: In function `edma_tc_set_pm_state':
> :(.text+0x43bf0): undefined reference to `of_find_device_by_node'
> 
> As the edma_tc_set_pm_state() function does nothing in case
> we are running without OF, this adds an IS_ENABLED() check
> that turns the function into an empty stub then and avoids the
> link error.

Applied, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-11-16  3:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-03 14:00 [PATCH] dmaengine: edma: fix build without CONFIG_OF Arnd Bergmann
2015-11-04  7:42 ` Peter Ujfalusi
2015-11-04  8:46   ` Arnd Bergmann
2015-11-04  9:05     ` Peter Ujfalusi
2015-11-04 10:29       ` Arnd Bergmann
2015-11-16  3:36 ` Vinod Koul

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).