aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Rojtberg <rojtberg@gmail.com>2015-10-06 20:07:31 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2015-10-10 14:27:28 -0400
commita306a65f46acb040d208523592a2d34f67d47a61 (patch)
tree27b7549b63393028f3f8d4c5f42f1a47f58d03f1
parente3b651745a03810efffd7ebf2a9b5be65fb70ec3 (diff)
Input: xpad - remove needless bulk out URB used for LED setup
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). Signed-off-by: Pavel Rojtberg <rojtberg@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r--drivers/input/joystick/xpad.c79
1 files changed, 1 insertions, 78 deletions
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 9e85a234d5f1..946bf3c74834 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -328,9 +328,6 @@ struct usb_xpad {
328 unsigned char *idata; /* input data */ 328 unsigned char *idata; /* input data */
329 dma_addr_t idata_dma; 329 dma_addr_t idata_dma;
330 330
331 struct urb *bulk_out;
332 unsigned char *bdata;
333
334 struct urb *irq_out; /* urb for interrupt out report */ 331 struct urb *irq_out; /* urb for interrupt out report */
335 unsigned char *odata; /* output data */ 332 unsigned char *odata; /* output data */
336 dma_addr_t odata_dma; 333 dma_addr_t odata_dma;
@@ -510,7 +507,6 @@ static void xpad360w_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned cha
510 if (data[0] & 0x08) { 507 if (data[0] & 0x08) {
511 if (data[1] & 0x80) { 508 if (data[1] & 0x80) {
512 xpad->pad_present = 1; 509 xpad->pad_present = 1;
513 usb_submit_urb(xpad->bulk_out, GFP_ATOMIC);
514 /* 510 /*
515 * Light up the segment corresponding to 511 * Light up the segment corresponding to
516 * controller number. 512 * controller number.
@@ -672,28 +668,6 @@ exit:
672 __func__, retval); 668 __func__, retval);
673} 669}
674 670
675static void xpad_bulk_out(struct urb *urb)
676{
677 struct usb_xpad *xpad = urb->context;
678 struct device *dev = &xpad->intf->dev;
679
680 switch (urb->status) {
681 case 0:
682 /* success */
683 break;
684 case -ECONNRESET:
685 case -ENOENT:
686 case -ESHUTDOWN:
687 /* this urb is terminated, clean up */
688 dev_dbg(dev, "%s - urb shutting down with status: %d\n",
689 __func__, urb->status);
690 break;
691 default:
692 dev_dbg(dev, "%s - nonzero urb status received: %d\n",
693 __func__, urb->status);
694 }
695}
696
697static void xpad_irq_out(struct urb *urb) 671static void xpad_irq_out(struct urb *urb)
698{ 672{
699 struct usb_xpad *xpad = urb->context; 673 struct usb_xpad *xpad = urb->context;
@@ -1230,52 +1204,6 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
1230 1204
1231 if (xpad->xtype == XTYPE_XBOX360W) { 1205 if (xpad->xtype == XTYPE_XBOX360W) {
1232 /* 1206 /*
1233 * Setup the message to set the LEDs on the
1234 * controller when it shows up
1235 */
1236 xpad->bulk_out = usb_alloc_urb(0, GFP_KERNEL);
1237 if (!xpad->bulk_out) {
1238 error = -ENOMEM;
1239 goto fail7;
1240 }
1241
1242 xpad->bdata = kzalloc(XPAD_PKT_LEN, GFP_KERNEL);
1243 if (!xpad->bdata) {
1244 error = -ENOMEM;
1245 goto fail8;
1246 }
1247
1248 xpad->bdata[2] = 0x08;
1249 switch (intf->cur_altsetting->desc.bInterfaceNumber) {
1250 case 0:
1251 xpad->bdata[3] = 0x42;
1252 break;
1253 case 2:
1254 xpad->bdata[3] = 0x43;
1255 break;
1256 case 4:
1257 xpad->bdata[3] = 0x44;
1258 break;
1259 case 6:
1260 xpad->bdata[3] = 0x45;
1261 }
1262
1263 ep_irq_in = &intf->cur_altsetting->endpoint[1].desc;
1264 if (usb_endpoint_is_bulk_out(ep_irq_in)) {
1265 usb_fill_bulk_urb(xpad->bulk_out, udev,
1266 usb_sndbulkpipe(udev,
1267 ep_irq_in->bEndpointAddress),
1268 xpad->bdata, XPAD_PKT_LEN,
1269 xpad_bulk_out, xpad);
1270 } else {
1271 usb_fill_int_urb(xpad->bulk_out, udev,
1272 usb_sndintpipe(udev,
1273 ep_irq_in->bEndpointAddress),
1274 xpad->bdata, XPAD_PKT_LEN,
1275 xpad_bulk_out, xpad, 0);
1276 }
1277
1278 /*
1279 * Submit the int URB immediately rather than waiting for open 1207 * Submit the int URB immediately rather than waiting for open
1280 * because we get status messages from the device whether 1208 * because we get status messages from the device whether
1281 * or not any controllers are attached. In fact, it's 1209 * or not any controllers are attached. In fact, it's
@@ -1285,13 +1213,11 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
1285 xpad->irq_in->dev = xpad->udev; 1213 xpad->irq_in->dev = xpad->udev;
1286 error = usb_submit_urb(xpad->irq_in, GFP_KERNEL); 1214 error = usb_submit_urb(xpad->irq_in, GFP_KERNEL);
1287 if (error) 1215 if (error)
1288 goto fail9; 1216 goto fail7;
1289 } 1217 }
1290 1218
1291 return 0; 1219 return 0;
1292 1220
1293 fail9: kfree(xpad->bdata);
1294 fail8: usb_free_urb(xpad->bulk_out);
1295 fail7: input_unregister_device(input_dev); 1221 fail7: input_unregister_device(input_dev);
1296 input_dev = NULL; 1222 input_dev = NULL;
1297 fail6: xpad_led_disconnect(xpad); 1223 fail6: xpad_led_disconnect(xpad);
@@ -1315,8 +1241,6 @@ static void xpad_disconnect(struct usb_interface *intf)
1315 xpad_deinit_output(xpad); 1241 xpad_deinit_output(xpad);
1316 1242
1317 if (xpad->xtype == XTYPE_XBOX360W) { 1243 if (xpad->xtype == XTYPE_XBOX360W) {
1318 usb_kill_urb(xpad->bulk_out);
1319 usb_free_urb(xpad->bulk_out);
1320 usb_kill_urb(xpad->irq_in); 1244 usb_kill_urb(xpad->irq_in);
1321 } 1245 }
1322 1246
@@ -1324,7 +1248,6 @@ static void xpad_disconnect(struct usb_interface *intf)
1324 usb_free_coherent(xpad->udev, XPAD_PKT_LEN, 1248 usb_free_coherent(xpad->udev, XPAD_PKT_LEN,
1325 xpad->idata, xpad->idata_dma); 1249 xpad->idata, xpad->idata_dma);
1326 1250
1327 kfree(xpad->bdata);
1328 kfree(xpad); 1251 kfree(xpad);
1329 1252
1330 usb_set_intfdata(intf, NULL); 1253 usb_set_intfdata(intf, NULL);