Re: [PATCH -next] bcma: needs export.h

Andrew Morton
2011-09-20T22:40:43Z

On Tue, 20 Sep 2011 20:45:57 +0200
Rafa__ Mi__ecki <zajec5@gmail.com> wrote:

> 2011/9/20 Randy Dunlap <rdunlap@xenotime.net>:
> > From: Randy Dunlap <rdunlap@xenotime.net>
> >
> > bcma/driver_chipcommon_pmu.c needs to include <linux/export.h>,
> > so add it to the headers that are included by bcma_private.h.
>
> Please take a look at discussion in:
> [PATCH -next] bcma: main.c needs to include <linux/slab.h>
> thread (by Andrew).
>
> I believe that according to the discussion, such a includes should be
> done in .c files.
>
> Andrew: can you comment? Am I right?

Ordinarily, yes, it is preferable to include the needed .h files from
within the .c files. However quite a mumber of kernel subsystems do
take the #include "everything.h" approach.

However, drivers/bcma is a bit odd in that it has bcma_private.h which
includes delay.h (the everything.h approach) but most .c files
explicitly include other things, including export.h.

There's no real pattern here and yes, I agree that the minimal and more
typical approach is better.

--- a/drivers/bcma/driver_chipcommon_pmu.c~bcma-needs-exporth
+++ a/drivers/bcma/driver_chipcommon_pmu.c
@@ -10,6 +10,7 @@

#include "bcma_private.h"
#include <linux/bcma/bcma.h>
+#include <linux/export.h>

static u32 bcma_chipco_pll_read(struct bcma_drv_cc *cc, u32 offset)
{
_