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/

Reply via email to