I think we're getting confused. What I'm advocating is something like this:
init_module()
{
struct mixer_levels *levels;
levels = inter_module_get("mysoundcard_mixerlevels");
if (!levels)
/* We haven't been loaded before. Default to zero */
levels = &default_levels;
init_hardware(levels);
}
cleanup_module()
{
struct mixer_levels *levels = kmalloc(sizeof *levels);
if (levels) {
/* Record current the levels so we can init the hardware
to the same next time we're loaded */
memcpy(levels, current_levels, sizeof(*levels));
inter_module_register("mysoundcard_mixerlevels", levels);
}
}
(Note it's pseudocode. I _know_ it doesn't compile and that the name we
pass to inter_module_register is removed when the module is unloaded. Oh
and that inter_module_register will panic() and kill the whole system on
the second unload because a registration with that name already exists.)
--
dwmw2
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/
- Re: Persistent module storage [was Linux 2.4 Status /... Jeff Garzik
- Re: Persistent module storage [was Linux 2.4 Status /... Jeff Garzik
- Re: Persistent module storage [was Linux 2.4 Status /... David Woodhouse
- Re: Persistent module storage [was Linux 2.4 Status /... Jeff Garzik
- Re: Persistent module storage [was Linux 2.4 Status /... David Woodhouse
- Re: Persistent module storage [was Linux 2.4 Status /... Jeff Garzik
- Re: Persistent module storage [was Linux 2.4 Status /... Alan Cox
- Re: Persistent module storage [was Linux 2.4 Status /... David Woodhouse
- Re: Persistent module storage [was Linux 2.4 Status /... Jeff Garzik
- Re: Persistent module storage [was Linux 2.4 Status /... David Woodhouse
- Re: Persistent module storage [was Linux 2.4 Status /... David Woodhouse
- Re: Persistent module storage [was Linux 2.4 Status /... James A . Sutherland
- Re: Persistent module storage [was Linux 2.4 Status /... Alan Cox
- Re: Persistent module storage [was Linux 2.4 Status /... James A . Sutherland
- Re: Persistent module storage [was Linux 2.4 Status /... Paul Jakma
- Re: Persistent module storage [was Linux 2.4 Status /... Alan Cox
- Re: Persistent module storage [was Linux 2.4 Status /... Dan Hollis
- Re: Persistent module storage [was Linux 2.4 Status /... James A . Sutherland
- Re: Persistent module storage [was Linux 2.4 Status /... Alan Cox
- Re: Persistent module storage [was Linux 2.4 Status /... James A . Sutherland
- Re: Persistent module storage [was Linux 2.4 Status /... Alan Cox

