Re: [RFC PATCH -next] Fix printk_once build errors due to __read_mostly

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

 



On Wed, 30 Oct 2013 10:18:21 +0000 James Hogan <james.hogan@xxxxxxxxxx> wrote:

> Commit 3e39c1ab04ba (printk: mark printk_once test variable
> __read_mostly) added __read_mostly to the __print_once bool in the
> printk_once() macro, but __read_mostly is defined in <linux/cache.h>
> which isn't included from <linux/printk.h>. This results in build errors
> like this:
> 
> arch/metag/mm/l2cache.c: In function 'meta_l2c_setup':
> arch/metag/mm/l2cache.c:56: error: '__read_mostly' undeclared
> 
> This is fixed by adding an include of <linux/cache.h> from
> <linux/printk.h> since I don't think printk_once() users should need to
> include <linux/cache.h> for it to work.
> 
> Note that this actually adds a recursive include, since <linux/cache.h>
> includes <linux/kernel.h>, which includes <linux/printk.h>. The actual
> dependencies are all in macros so it doesn't actually seem to result in
> any build failures, but it's clearly less than ideal.

Yitch.

> Signed-off-by: James Hogan <james.hogan@xxxxxxxxxx>
> Cc: Joe Perches <joe@xxxxxxxxxxx>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Cc: linux-metag@xxxxxxxxxxxxxxx
> ---
> This build failure was caught in today's linux-next.
> 
> I'm not too keen on this due to the recursive include. Is it better to
> just workaround the problem by including <linux/cache.h> from the .c
> file that fails to build, or should the original patch be removed
> instead?

Well, these patches make the kernel worse.  We should make it better,
not worse.

One approach would be to add a new printk_once.h, which includes
printk.h and cache.h.

I can't immediately think of a nice solution so I guess for now I'll
drop printk-mark-printk_once-test-variable-__read_mostly.patch.
--
To unsubscribe from this list: send the line "unsubscribe linux-metag" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux ARM Kernel]     [Linux Wireless]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux