m68k: Struggling to resolve circular #include of bitops.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Geert,

I'm working on some patches to implement asm-generic/bitops/lock.h using
the atomic_long_* API, since this offers finer-grained control over the
memory ordering semantics than the current implementation:

https://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git/log/?h=atomics

However, on m68k I'm running into a problem with circular #includes due
to asm/irqflags.h pulling in linux/preeempt.h for hardirq_count(). For
example:


In file included from ./include/asm-generic/getorder.h:8:0,
                 from ./arch/m68k/include/asm/page.h:58,
                 from ./arch/m68k/include/asm/thread_info.h:6,
                 from ./include/linux/thread_info.h:38,
                 from ./include/asm-generic/preempt.h:5,
                 from ./arch/m68k/include/generated/asm/preempt.h:1,
                 from ./include/linux/preempt.h:81,
                 from ./arch/m68k/include/asm/irqflags.h:6,
                 from ./include/linux/irqflags.h:16,
                 from ./arch/m68k/include/asm/atomic.h:6,
                 from ./include/linux/atomic.h:5,
                 from ./include/asm-generic/bitops/lock.h:5,
                 from ./arch/m68k/include/asm/bitops.h:523,
                 from ./include/linux/bitops.h:38,
                 from ./include/linux/kernel.h:11,
                 from ./include/asm-generic/bug.h:18,
                 from ./arch/m68k/include/asm/bug.h:29,
                 from ./include/linux/bug.h:5,
                 from ./include/linux/page-flags.h:10,
                 from kernel/bounds.c:10:
./include/linux/log2.h: In function '__roundup_pow_of_two':
./include/linux/log2.h:61:16: error: implicit declaration of function 'fls_long' [-Werror=implicit-function-declaration]
  return 1UL << fls_long(n - 1);


breaks because linux/log2.h ends up being pulled in by asm/bitops.h before
we have a definition of fls_long and:


In file included from ./include/asm-generic/preempt.h:5:0,
                 from ./arch/m68k/include/generated/asm/preempt.h:1,
                 from ./include/linux/preempt.h:81,
                 from ./arch/m68k/include/asm/irqflags.h:6,
                 from ./include/linux/irqflags.h:16,
                 from ./arch/m68k/include/asm/atomic.h:6,
                 from ./include/linux/atomic.h:5,
                 from ./include/asm-generic/bitops/lock.h:5,
                 from ./arch/m68k/include/asm/bitops.h:523,
                 from ./include/linux/bitops.h:38,
                 from ./include/linux/kernel.h:11,
                 from ./include/asm-generic/bug.h:18,
                 from ./arch/m68k/include/asm/bug.h:29,
                 from ./include/linux/bug.h:5,
                 from ./include/linux/page-flags.h:10,
                 from kernel/bounds.c:10:
./include/linux/thread_info.h: In function 'copy_overflow':
./include/linux/thread_info.h:127:2: error: implicit declaration of function 'WARN' [-Werror=implicit-function-declaration]
  WARN(1, "Buffer overflow detected (%d < %lu)!\n", size, count);


breaks because of a similar issue with WARN and asm-generic/bug.h.

My ideas for fixing this so far are one of:

1. Inline the old asm-generic/bitops/lock.h code directly into m68k's
   asm/bitops.h

2. Continue implementing asm-generic/bitops/lock.h purely as macros without
   any #includes

3. Remove the hardirqs_count thing from m6k's asm/irqflags.h

Any ideas? (1) is my preference at the moment.

Will
--
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Video for Linux]     [Yosemite News]     [Linux S/390]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux