From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Pavel Rojtberg <rojtberg@gmail.com>
Cc: linux-input@vger.kernel.org, pgriffais@valvesoftware.com,
gregkh@linuxfoundation.org
Subject: Re: [PATCH 04/15] Input: xpad: remove needless bulk out URB used for LED setup
Date: Sat, 10 Oct 2015 09:45:10 -0700 [thread overview]
Message-ID: <20151010164510.GE39573@dtor-ws> (raw)
In-Reply-To: <1443733046-29610-5-git-send-email-rojtberg@gmail.com>
On Thu, Oct 01, 2015 at 10:57:15PM +0200, Pavel Rojtberg wrote:
> From: Pavel Rojtberg <rojtberg@gmail.com>
>
> this code was probably wrong ever since and is redundant with
> xpad_send_led_command.
>
> Both try to send a similar command to the xbox360 controller. However
> xpad_send_led_command correctly uses the pad_nr instead of
> bInterfaceNumber to select the led and re-uses the irq_out URB instead
> of creating a new one.
>
> Note that this change only affects the two supported wireless
> controllers. Tested using the xbox360 wireless controller (PC).
Applied, thank you.
>
> Signed-off-by: Pavel Rojtberg <rojtberg@gmail.com>
> ---
> drivers/input/joystick/xpad.c | 79 +-----------------------------------------------------------------
> 1 file changed, 1 insertion(+), 78 deletions(-)
>
> diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
> index ab62d47..a379346 100644
> --- a/drivers/input/joystick/xpad.c
> +++ b/drivers/input/joystick/xpad.c
> @@ -329,9 +329,6 @@ struct usb_xpad {
> unsigned char *idata; /* input data */
> dma_addr_t idata_dma;
>
> - struct urb *bulk_out;
> - unsigned char *bdata;
> -
> struct urb *irq_out; /* urb for interrupt out report */
> unsigned char *odata; /* output data */
> dma_addr_t odata_dma;
> @@ -511,7 +508,6 @@ static void xpad360w_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned cha
> if (data[0] & 0x08) {
> if (data[1] & 0x80) {
> xpad->pad_present = 1;
> - usb_submit_urb(xpad->bulk_out, GFP_ATOMIC);
> xpad_identify_controller(xpad);
> } else
> xpad->pad_present = 0;
> @@ -669,28 +665,6 @@ exit:
> __func__, retval);
> }
>
> -static void xpad_bulk_out(struct urb *urb)
> -{
> - struct usb_xpad *xpad = urb->context;
> - struct device *dev = &xpad->intf->dev;
> -
> - switch (urb->status) {
> - case 0:
> - /* success */
> - break;
> - case -ECONNRESET:
> - case -ENOENT:
> - case -ESHUTDOWN:
> - /* this urb is terminated, clean up */
> - dev_dbg(dev, "%s - urb shutting down with status: %d\n",
> - __func__, urb->status);
> - break;
> - default:
> - dev_dbg(dev, "%s - nonzero urb status received: %d\n",
> - __func__, urb->status);
> - }
> -}
> -
> static void xpad_irq_out(struct urb *urb)
> {
> struct usb_xpad *xpad = urb->context;
> @@ -1216,52 +1190,6 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
>
> if (xpad->xtype == XTYPE_XBOX360W) {
> /*
> - * Setup the message to set the LEDs on the
> - * controller when it shows up
> - */
> - xpad->bulk_out = usb_alloc_urb(0, GFP_KERNEL);
> - if (!xpad->bulk_out) {
> - error = -ENOMEM;
> - goto fail7;
> - }
> -
> - xpad->bdata = kzalloc(XPAD_PKT_LEN, GFP_KERNEL);
> - if (!xpad->bdata) {
> - error = -ENOMEM;
> - goto fail8;
> - }
> -
> - xpad->bdata[2] = 0x08;
> - switch (intf->cur_altsetting->desc.bInterfaceNumber) {
> - case 0:
> - xpad->bdata[3] = 0x42;
> - break;
> - case 2:
> - xpad->bdata[3] = 0x43;
> - break;
> - case 4:
> - xpad->bdata[3] = 0x44;
> - break;
> - case 6:
> - xpad->bdata[3] = 0x45;
> - }
> -
> - ep_irq_in = &intf->cur_altsetting->endpoint[1].desc;
> - if (usb_endpoint_is_bulk_out(ep_irq_in)) {
> - usb_fill_bulk_urb(xpad->bulk_out, udev,
> - usb_sndbulkpipe(udev,
> - ep_irq_in->bEndpointAddress),
> - xpad->bdata, XPAD_PKT_LEN,
> - xpad_bulk_out, xpad);
> - } else {
> - usb_fill_int_urb(xpad->bulk_out, udev,
> - usb_sndintpipe(udev,
> - ep_irq_in->bEndpointAddress),
> - xpad->bdata, XPAD_PKT_LEN,
> - xpad_bulk_out, xpad, 0);
> - }
> -
> - /*
> * Submit the int URB immediately rather than waiting for open
> * because we get status messages from the device whether
> * or not any controllers are attached. In fact, it's
> @@ -1271,13 +1199,11 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
> xpad->irq_in->dev = xpad->udev;
> error = usb_submit_urb(xpad->irq_in, GFP_KERNEL);
> if (error)
> - goto fail9;
> + goto fail7;
> }
>
> return 0;
>
> - fail9: kfree(xpad->bdata);
> - fail8: usb_free_urb(xpad->bulk_out);
> fail7: input_unregister_device(input_dev);
> input_dev = NULL;
> fail6: xpad_led_disconnect(xpad);
> @@ -1301,8 +1227,6 @@ static void xpad_disconnect(struct usb_interface *intf)
> xpad_deinit_output(xpad);
>
> if (xpad->xtype == XTYPE_XBOX360W) {
> - usb_kill_urb(xpad->bulk_out);
> - usb_free_urb(xpad->bulk_out);
> usb_kill_urb(xpad->irq_in);
> }
>
> @@ -1310,7 +1234,6 @@ static void xpad_disconnect(struct usb_interface *intf)
> usb_free_coherent(xpad->udev, XPAD_PKT_LEN,
> xpad->idata, xpad->idata_dma);
>
> - kfree(xpad->bdata);
> kfree(xpad);
>
> usb_set_intfdata(intf, NULL);
> --
> 1.9.1
>
--
Dmitry
next prev parent reply other threads:[~2015-10-10 16:45 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-01 20:57 [PATCH 00/15] Input: xpad: updates Pavel Rojtberg
2015-10-01 20:57 ` [PATCH 01/15] Input: xpad: add Covert Forces edition of the Xbox One controller Pavel Rojtberg
2015-10-10 16:42 ` Dmitry Torokhov
2015-10-01 20:57 ` [PATCH 02/15] Input: xpad: fix Razer Atrox Arcade Stick button mapping Pavel Rojtberg
2015-10-10 16:43 ` Dmitry Torokhov
2015-10-01 20:57 ` [PATCH 03/15] Input: xpad: clarify LED enumeration Pavel Rojtberg
2015-10-10 16:44 ` Dmitry Torokhov
2015-10-01 20:57 ` [PATCH 04/15] Input: xpad: remove needless bulk out URB used for LED setup Pavel Rojtberg
2015-10-10 16:45 ` Dmitry Torokhov [this message]
2015-10-01 20:57 ` [PATCH 05/15] Input: xpad: factor out URB submission in xpad_play_effect Pavel Rojtberg
2015-10-10 16:45 ` Dmitry Torokhov
2015-10-01 20:57 ` [PATCH 06/15] Input: xpad: x360w: report dpad as buttons and axes Pavel Rojtberg
2015-10-10 16:45 ` Dmitry Torokhov
2015-10-01 20:57 ` [PATCH 07/15] Input: xpad: move the input device creation to a new function Pavel Rojtberg
2015-10-10 18:00 ` Dmitry Torokhov
2015-10-15 19:19 ` Pavel Rojtberg
2015-10-17 16:49 ` Dmitry Torokhov
2015-10-17 18:08 ` Pavel Rojtberg
2015-10-01 20:57 ` [PATCH 08/15] Input: xpad: query Wireless controller state at init Pavel Rojtberg
2015-10-01 20:57 ` [PATCH 09/15] Input: xpad: handle "present" and "gone" correctly Pavel Rojtberg
2015-10-10 16:42 ` Dmitry Torokhov
2015-10-01 20:57 ` [PATCH 10/15] Input: xpad: use ida() for finding the pad_nr Pavel Rojtberg
2015-10-01 22:53 ` Pavel Rojtberg
2015-10-10 17:06 ` Dmitry Torokhov
2015-10-01 20:57 ` [PATCH 11/15] Input: xpad: do not submit active URBs Pavel Rojtberg
2015-10-01 20:57 ` [PATCH 12/15] Input: xpad: replace mutex by spinlock Pavel Rojtberg
2015-10-10 18:10 ` Dmitry Torokhov
2015-10-01 20:57 ` [PATCH 13/15] Input: xpad: re-submit pending ff and led requests Pavel Rojtberg
2015-10-01 20:57 ` [PATCH 14/15] Input: xpad: workaround dead irq_out after suspend/ resume Pavel Rojtberg
2015-10-01 20:57 ` [PATCH 15/15] Input: xpad: update Xbox One Force Feedback Support Pavel Rojtberg
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=20151010164510.GE39573@dtor-ws \
--to=dmitry.torokhov@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-input@vger.kernel.org \
--cc=pgriffais@valvesoftware.com \
--cc=rojtberg@gmail.com \
/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).