[PATCH] ARM: OMAP2+: Prevent redefinition errors for soc.h

Tony Lindgren tony at atomide.com
Fri Nov 9 18:50:06 EST 2012


* Jon Hunter <jon-hunter at ti.com> [121109 15:44]:
> 
> On 11/09/2012 03:10 PM, Tony Lindgren wrote:
> > * Jon Hunter <jon-hunter at ti.com> [121109 08:31]:
> >>
> >> On 11/09/2012 10:22 AM, Tony Lindgren wrote:
> >>> * Jon Hunter <jon-hunter at ti.com> [121109 08:21]:
> >>>> If the header soc.h is included more than once in a source (for example
> >>>> once directly by the source file and once indirectly by another header
> >>>> file), then the compiler will generate redefintion errors for the macros
> >>>> in soc.h. Prevent this by only allowing the content in soc.h to be
> >>>> included once.
> >>>>
> >>>> Signed-off-by: Jon Hunter <jon-hunter at ti.com>
> >>>> ---
> >>>>
> >>>> Please note that I ran into this problem when rebasing my dmtimer fixes
> >>>> series [1] on Tony's Linux-OMAP master branch. I am including plat/cpu.h
> >>>> in dmtimer.h and I found several other files including dmtimer.h are also
> >>>> including soc.h and so generate a lot of errors.
> >>>>
> >>>> [1] http://marc.info/?l=linux-omap&m=135231490218361&w=2
> >>>
> >>> As these headers are private to mach-omap2, I'd rather not allow including
> >>> them more than once so we can eventually clean up the includes further.
> >>>
> >>> We should include the headers directly where used, except for the
> >>> legacy board-*.c files that will be going away anyways.
> >>>
> >>> Including the files directly should fix this easily, if not let me
> >>> know.
> >>
> >> The alternative fix is to ensure anyone including dmtimer.h also
> >> includes soc.h. However, I did not know if we should have such a
> >> dependency. If you are ok with that then that is what I will do for now.
> >> It is not a massive change.
> > 
> > Do you mean anything under mach-omap2/*.c including dmtimer.h also
> > needs to also include soc.h? If sounds OK to me as long as we don't
> > need to include soc.h outside mach-omap2.
> 
> Yes exactly. Right now dmtimer.h is including plat/cpu.h and so is
> indirectly including soc.h. The function omap_dm_timer_populate_errata()
> is using the cpu_is_xxxx macros. So maybe I should move this to into
> platform data. Is that better?

I think I already fixed that up in the cleanup branch. I've now
merged that into the omap-for-v3.8/dt branch. The only remaining
cpu_is_omap usage there is:

$ grep cpu_is_omap arch/arm/plat-omap/*.[chS]

arch/arm/plat-omap/fb.c:        if (cpu_is_omap24xx()) {
arch/arm/plat-omap/fb.c:        } else if (cpu_is_omap34xx()) {

So maybe see what needs to be patches on top of omap-for-v3.8/dt?

Regards,

Tony



More information about the linux-arm-kernel mailing list