On Sat, Apr 25, 2015 at 03:41:46PM +0800, Paul Goyette wrote:
> A quick scan shows that there are about 125-130 sources files which 
> attempt to register with sysmon_{pswitch,wdog,envsys}_register.

Since this is only about early access to the register functions, can't we
just add a static boolean for each of sysmon_envsys_init, sysmon_wdog_init
and sysmon_power_init, and change the functions to just ignore multiple
calls?

Something like:

void
sysmon_wdog_init(void)
{
        static bool passed = false;

        if (passed)
                return;
        passed = true;

        mutex_init(&sysmon_wdog_list_mtx, MUTEX_DEFAULT, IPL_NONE);
        mutex_init(&sysmon_wdog_mtx, MUTEX_DEFAULT, IPL_SOFTCLOCK);
...


And then add sysmon_wdog_init() calls to the *_register() functions?

Martin

Reply via email to