Re: [PATCH] ISA PnP (2.4.0-test9)

From: Jaroslav Kysela (perex@suse.cz)
Date: Mon Oct 09 2000 - 07:51:35 EST


On Mon, 9 Oct 2000, Keith Owens wrote:

> On Mon, 9 Oct 2000 12:55:28 +0200 (MEST),
> Jaroslav Kysela <perex@suse.cz> wrote:
> >I fully understand your point, but I don't want to have a special
> >case for ISA PnP. What about this change:
> >
> >#define MODULE_GENERIC_TABLE(gtype,name) \
> >const struct gtype##_id * __module_##gtype##_table = name
> >
> >to
> >
> >#define MODULE_GENERIC_TABLE(gtype,name) \
> >const unsigned long __module_##gtype_size = sizeof(struct gtype##_id); \
> >const struct gtype##_id * __module_##gtype##_table = name
>
> Make that
>
> #define MODULE_GENERIC_TABLE(gtype,name) \
> static const unsigned long __module_##gtype##_size \
> __attribute__ ((unused)) = sizeof(struct gtype##_id); \
> static const struct gtype##_id * __module_##gtype##_table = name
>
> and you've got a deal. The _size must be static to avoid name clashes
> when two or more objects that use MODULE_GENERIC_TABLE(sametype,..) are
> linked together. __attribute__ ((unused)) stops the compiler
> complaining about unused static variables; we know that they are used
> by modutils, not by the code itself.

Regarding static: Are you sure, that I'll have to do this change?
I think that MODULE_GENERIC_TABLE(gtype,...) may be only one per kernel
module, so we can leave this variable as global. The scope of this
variable should be same as __this_module symbol.

                                                Jaroslav

-----
Jaroslav Kysela <perex@suse.cz>
SuSE Linux http://www.suse.com
ALSA project http://www.alsa-project.org

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



This archive was generated by hypermail 2b29 : Sun Oct 15 2000 - 21:00:12 EST