public inbox for kernelnewbies@kernelnewbies.org
 help / color / mirror / Atom feed
From: "Valdis Klētnieks" <valdis.kletnieks@vt.edu>
To: Drew Abbott <abbotta4@gmail.com>
Cc: Greg KH <greg@kroah.com>, kernelnewbies@kernelnewbies.org
Subject: Re: Kernel module that shuts down the device
Date: Sun, 07 Nov 2021 19:38:10 -0500	[thread overview]
Message-ID: <160859.1636331890@turing-police> (raw)
In-Reply-To: <CALY-g84qJTMyQAXc+7-kN_tGgQ6D5kbMCDU1xUp8S=obHHijxA@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 756 bytes --]

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.


[-- Attachment #1.2: Type: application/pgp-signature, Size: 494 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

  reply	other threads:[~2021-11-08  0:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-07  0:54 Kernel module that shuts down the device Drew Abbott
2021-11-07  8:31 ` Greg KH
2021-11-08  0:16   ` Drew Abbott
2021-11-08  0:38     ` Valdis Klētnieks [this message]
2021-11-08  6:12     ` Greg KH
2021-11-08 20:53       ` Drew Abbott
2021-11-09  6:23         ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=160859.1636331890@turing-police \
    --to=valdis.kletnieks@vt.edu \
    --cc=abbotta4@gmail.com \
    --cc=greg@kroah.com \
    --cc=kernelnewbies@kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox