From: Stephen Douthit <stephen.douthit@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Stephen Douthit <stephen.douthit@gmail.com>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] Input: xpad - Turn off wireless controllers on shutdown
Date: Thu, 24 Mar 2022 10:53:08 -0400 [thread overview]
Message-ID: <20220324145308.2372-1-stephen.douthit@gmail.com> (raw)
We already do this on suspend, makes sense for shutdown as well
Signed-off-by: Stephen Douthit <stephen.douthit@gmail.com>
---
drivers/input/joystick/xpad.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 18190b529bca..8be79f91ba56 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -1738,6 +1738,16 @@ static int xpad_init_input(struct usb_xpad *xpad)
return error;
}
+static void xpad360w_shutdown(struct device *dev)
+{
+ struct usb_interface *intf = to_usb_interface(dev);
+ struct usb_xpad *xpad = usb_get_intfdata(intf);
+
+ xpad360w_stop_input(xpad);
+ if (xpad->pad_present)
+ xpad360w_poweroff_controller(xpad);
+}
+
static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id)
{
struct usb_device *udev = interface_to_usbdev(intf);
@@ -1863,6 +1873,12 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
* here in this driver and in usb core.
*/
udev->quirks |= USB_QUIRK_RESET_RESUME;
+
+ /*
+ * Populate shutdown callback so wireless controllers turn off
+ * when the machine turns off
+ */
+ intf->dev.driver->shutdown = xpad360w_shutdown;
} else {
error = xpad_init_input(xpad);
if (error)
--
2.35.1
reply other threads:[~2022-03-24 14:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220324145308.2372-1-stephen.douthit@gmail.com \
--to=stephen.douthit@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).