From: Benjamin Valentin <benpicco@googlemail.com>
To: Cameron Gutman <aicommander@gmail.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
linux-input@vger.kernel.org, Lee Jones <lee.jones@linaro.org>
Subject: [PATCH 2/2] Input: xpad - drop checks for XTYPE_UNKNOWN
Date: Tue, 16 Nov 2021 17:25:06 +0100 [thread overview]
Message-ID: <20211116172506.234dbf1d@rechenknecht2k11> (raw)
In-Reply-To: <3b25f4b1-3ec0-0878-99bc-0da06ce7c2f2@gmail.com>
If xtype is XTYPE_UNKNOWN, it will *always* be replaced by the real
detected type in xpad_probe().
It is therefore not possible to encounter the xtype == XTYPE_UNKNOWN
condition anywhere at the run-time of the driver.
That means we can drop those checks.
Signed-off-by: Benjamin Valentin <benpicco@googlemail.com>
---
drivers/input/joystick/xpad.c | 28 +++++++++-------------------
1 file changed, 9 insertions(+), 19 deletions(-)
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 31a268f43b5b..66a12da58619 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -1110,13 +1110,10 @@ static void xpad_irq_out(struct urb *urb)
}
static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad,
- struct usb_endpoint_descriptor *ep_irq_out)
+ struct usb_endpoint_descriptor *ep_irq_out)
{
int error;
- if (xpad->xtype == XTYPE_UNKNOWN)
- return 0;
-
init_usb_anchor(&xpad->irq_out_anchor);
xpad->odata = usb_alloc_coherent(xpad->udev, XPAD_PKT_LEN,
@@ -1148,23 +1145,19 @@ static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad,
static void xpad_stop_output(struct usb_xpad *xpad)
{
- if (xpad->xtype != XTYPE_UNKNOWN) {
- if (!usb_wait_anchor_empty_timeout(&xpad->irq_out_anchor,
- 5000)) {
- dev_warn(&xpad->intf->dev,
- "timed out waiting for output URB to complete, killing\n");
- usb_kill_anchored_urbs(&xpad->irq_out_anchor);
- }
+ if (!usb_wait_anchor_empty_timeout(&xpad->irq_out_anchor,
+ 5000)) {
+ dev_warn(&xpad->intf->dev,
+ "timed out waiting for output URB to complete, killing\n");
+ usb_kill_anchored_urbs(&xpad->irq_out_anchor);
}
}
static void xpad_deinit_output(struct usb_xpad *xpad)
{
- if (xpad->xtype != XTYPE_UNKNOWN) {
- usb_free_urb(xpad->irq_out);
- usb_free_coherent(xpad->udev, XPAD_PKT_LEN,
- xpad->odata, xpad->odata_dma);
- }
+ usb_free_urb(xpad->irq_out);
+ usb_free_coherent(xpad->udev, XPAD_PKT_LEN,
+ xpad->odata, xpad->odata_dma);
}
static int xpad_inquiry_pad_presence(struct usb_xpad *xpad)
@@ -1339,9 +1332,6 @@ static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect
static int xpad_init_ff(struct usb_xpad *xpad)
{
- if (xpad->xtype == XTYPE_UNKNOWN)
- return 0;
-
input_set_capability(xpad->dev, EV_FF, FF_RUMBLE);
return input_ff_create_memless(xpad->dev, NULL, xpad_play_effect);
--
2.32.0
next prev parent reply other threads:[~2021-11-16 16:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-13 13:11 [PATCH] Input: xpad - Poweroff XBOX360W on mode button long press Benjamin Valentin
2021-11-14 1:52 ` Cameron Gutman
2021-11-14 19:23 ` [PATCH v2] " Benjamin Valentin
2021-11-16 16:23 ` [PATCH 1/2] Input: xpad - name unknown gamepads according to device type Benjamin Valentin
2021-11-16 16:25 ` Benjamin Valentin [this message]
2022-01-05 11:53 ` [RESEND][PATCH v2] Input: xpad - Poweroff XBOX360W on mode button long press Benjamin Valentin
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=20211116172506.234dbf1d@rechenknecht2k11 \
--to=benpicco@googlemail.com \
--cc=aicommander@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=lee.jones@linaro.org \
--cc=linux-input@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