Subject: Re: power hook and spl level
To: TAKEMURA Shin <>
From: Lennart Augustsson <>
List: tech-kern
Date: 09/10/2000 12:25:48
TAKEMURA Shin wrote:

> Well, could I call tsleep in power hook?

You could, but it would be a bad since then interrupts will get
turned on again.
I don't think any power hook calls tsleep() because it was not
allowed when the power code ran in an interrupt context (does
it still?).

> Some driver might want to
>   - notify user process of the power event
>   - wait until the device transfer into some state
>   - interact with other kernel thread

That's true.

> I propose introducing new power events which are
> processed in lower level like below:
>         dopowerhooks(PWR_SOFTSUSPEND);
>         apm_spl = splhigh();
>         dopowerhooks(PWR_SUSPEND);
>         /* suspned... */
>         dopowerhooks(PWR_RESUME);
>         splx(apm_spl);
>         dopowerhooks(PWR_SOFTRESUME);

Unless someone has a better idea, I think this looks good.

    -- Lennart