Re: [PATCH] four warnings and a patch

lars brinkhoff (lars@nocrew.org)
29 Oct 1999 18:44:36 +0200


Eli Carter wrote:
> Solution 2
> in 8390.h:
> #if defined(CONFIG_MAC) || defined(CONFIG_AMIGA_PCMCIA) || \
> defined(CONFIG_ARIADNE2) || defined(CONFIG_ARIADNE2_MODULE)
> #define EI_SHIFT(x) (ei_local->reg_offset[x])
> #define NEED_EI_LOCAL
> #else
> #define EI_SHIFT(x) (x)
> #endif
>
> and in 8390.c:
> #ifdef NEED_EI_LOCAL
> struct ei_device *ei_local = (struct ei_device *) dev->priv;
> #endif
> Pros: the dependency is automatically propogated to the variable
> declaration. Cons: introduces another #define.

Solution 3

in 8390.h:
#if defined(CONFIG_MAC) || defined(CONFIG_AMIGA_PCMCIA) || \
defined(CONFIG_ARIADNE2) || defined(CONFIG_ARIADNE2_MODULE)
#define EI_SHIFT(x) (ei_local->reg_offset[x])
#define DECLARE_EI_LOCAL \
struct ei_device *ei_local = (struct ei_device *) dev->priv;
/* or, if similar declarations appear in many places:
DECLARE_EI_LOCAL(var, dev) \
struct ei_device *var = (struct ei_device *) (dev)->priv; */
#else
#define EI_SHIFT(x) (x)
#define DECLARE_EI_LOCAL
#endif

in 8390.c:
DECLARE_EI_LOCAL

Pros: no #ifdef in the .c file.

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