public inbox for kernelnewbies@kernelnewbies.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Drew Abbott <abbotta4@gmail.com>
Cc: kernelnewbies@kernelnewbies.org
Subject: Re: Kernel module that shuts down the device
Date: Sun, 7 Nov 2021 09:31:11 +0100	[thread overview]
Message-ID: <YYeOz2onSzBaNBjt@kroah.com> (raw)
In-Reply-To: <CALY-g84CaJDvQBzQNh30_Xo9GcNO57t=m+rwH8mHCzLquAUOxQ@mail.gmail.com>

On Sat, Nov 06, 2021 at 07:54:39PM -0500, Drew Abbott wrote:
> Hi all,
> 
> I am working on a kernel module that should shut down the device when USB
> is unplugged. I make a call to kernel_power_off(), but I see that it gets
> stuck trying to call blocking_notifier_call_chain(&reboot_notifier_list,
> (state == SYSTEM_HALT) ? SYS_HALT : SYS_POWER_OFF, NULL); in
> kernel_shutdown_prepare().

Where are you calling it from?  Don't call it from irq context, which is
the context that USB urbs are called from.

> There is currently another driver that has the same function, and shuts
> down the device by calling kernel_power_off() successfully. I have tried
> adding prints in blocking_notifier_call_chain, but then the kernel log is
> flooded with calls and I can't really see what is happening.
> Does anyone have any insight into why my call to kernel_power_off() is
> hanging?

Do you have a link to your driver code so it can be reviewed?

thanks,

greg k-h

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

  reply	other threads:[~2021-11-07  8:31 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 [this message]
2021-11-08  0:16   ` Drew Abbott
2021-11-08  0:38     ` Valdis Klētnieks
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=YYeOz2onSzBaNBjt@kroah.com \
    --to=greg@kroah.com \
    --cc=abbotta4@gmail.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