Re: 2.6.xx - linux/firmware.h - missing include

From: Horst von Brand
Date: Fri Mar 19 2004 - 13:39:13 EST


Russell King <rmk+lkml@xxxxxxxxxxxxxxxx>
> On Fri, Mar 19, 2004 at 04:17:45PM +0100, Margit Schubert-While wrote:
> > The prototype for request_firmware uses a struct device parameter.
> > This is only defined if linux/device.h is included.
> > Fix is simple : include linux/device.h in linux/firmware.h
>
> That way leads to madness in the includes. firmware.h does not need
> the definition of struct device, it only needs to know that struct
> device exists.
>
> You can do this via:
>
> struct device;
>
> before its use - this works much the same way as a function declaration
> vs. function prototype.

Iff it is a _pointer_. If it needs a full struct, this won't work. And if
it is a pointer, a simple:

int foo(struct bar *);

will do for prototype, even if struct bar hasn't been mentioned earlier.

In case the struct is really needed, it is better just to ensure the
respective .h are included in the right order, not nest them.
--
Dr. Horst H. von Brand User #22616 counter.li.org
Departamento de Informatica Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria +56 32 654239
Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513
-
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/