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

From: Andrew Morton
Date: Tue Sep 20 2011 - 18:40:45 EST


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

> 2011/9/20 Randy Dunlap <rdunlap@xxxxxxxxxxxx>:
> > From: Randy Dunlap <rdunlap@xxxxxxxxxxxx>
> >
> > 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)
{
_

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/