Re: linux 2.5.25 (different compilation errors)

Ivan Gyurdiev (ivangurdiev@attbi.com)
Fri, 5 Jul 2002 04:38:48 -0400


Hmm. Haven't received this message. Reading it on LKML.
Please cc, I'm not subscribed.

> iforce-packets.c:252: `IFORCE_USB' undeclared (first use in this function)
> iforce-packets.c:252: (Each undeclared identifier is reported only once
> iforce-packets.c:252: for each function it appears in.)
> iforce-packets.c:282: `IFORCE_232' undeclared (first use in this function)
> iforce-packets.c:278: warning: unreachable code at beginning of switch
> statement

Well, obviously the construct

switch (iforce->bus)

case CONSTANT:

#ifdef CONSTANT
do stuff
#endif

will not work.

Why is all this #ifdef mess necessary.
Those are recognition constants.
How can you compare iforce->bus to IFORCE_USB or IFORCE_232
if those are only defined sometimes, based on config options...

Why not just...
#if defined(CONFIG_JOYSTICK_IFORCE_232)
#define IFORCE_232 1
#endif
#if defined(CONFIG_JOYSTICK_IFORCE_USB)
#define IFORCE_USB 2
#endif

drop the if statements and always define the constants.
The code will get much simpler IMHO.

===========================================

> zr36120.c:1497: unknown field `open' specified in initializer
zr36120.c:1497: warning: initialization makes integer from pointer without a
cast zr36120.c:1498: unknown field `close' specified in initializer
zr36120.c:1498: warning: initialization from incompatible pointer type
>
> [SNIP]
>
> zr36120.c:1839: unknown field `minor' specified in initializer make[3]: ***
[zr36120.o] Error 1

Here's what I found in the 2.4 videodev.h:
/* old, obsolete interface -- dropped in 2.5.x, don't use it */
int (*open)(struct video_device *, int mode);
void (*close)(struct video_device *);
...
/* new interface -- we will use file_operations directly
* like soundcore does.
* kernel_ioctl() will be called by video_generic_ioctl.
* video_generic_ioctl() does the userspace copying of the
* ioctl arguments */

============================================

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