Kernel module that shuts down the device

Valdis Kl=?utf-8?Q?=c4=93?=tnieks valdis.kletnieks at
Sun Nov 7 19:38:10 EST 2021

On Sun, 07 Nov 2021 18:16:55 -0600, Drew Abbott said:

> You mentioned that this shouldn't be called in an irq context, but the
> unplug event is detected with an irq. Where should I be calling
> kernel_power_off() if not in the irq context? I think one way of doing this
> would be to set a value that a heartbeat function reads in the irq, and
> then the heartbeat function calls the shutdown, but this driver doesn't use
> a heartbeat. Where else would I handle this?

There's a whole bunch of ways to schedule work in the kernel, it doesn't have to be
a heartbeat function.

Plenty of drivers are split into IRQ and non-IRQ parts (sometimes called the top and
bottom parts of the driver).  See how they get info from the IRQ part to the non-IRQ part.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 494 bytes
Desc: not available
URL: <>

More information about the Kernelnewbies mailing list