mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 11:19:37 +00:00
Input: bcm5974 - only setup button urb for TYPE1 devices
The early generations with this trackpad used the separate mouse interface to produce button events. With the introduction of the button pads, this information was moved to the trackpad interface, leaving the mouse interface unused. The driver is still setting up both interfaces, which has not caused any problems - until now. It turns out that without the CONFIG_USB_EHCI_TT_NEWSCHED option, the driver may return an ENOSPC upon bt_urb submission, resulting in a failure to open the device. This happens everytime on the MacBookPro Retina (and likely on other mid-2012 models), but earlier MacBook models seem to work fine. This patch skips the bt_urb setup for TYPE2 devices, which arguably should have been done in the first place. Tested-by: Benjamin Tissoires <benjamin.tissoires@enac.fr> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
This commit is contained in:
parent
77723e3bc7
commit
43f482b48d
1 changed files with 26 additions and 17 deletions
|
@ -742,9 +742,11 @@ static int bcm5974_start_traffic(struct bcm5974 *dev)
|
||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = usb_submit_urb(dev->bt_urb, GFP_KERNEL);
|
if (dev->bt_urb) {
|
||||||
if (error)
|
error = usb_submit_urb(dev->bt_urb, GFP_KERNEL);
|
||||||
goto err_reset_mode;
|
if (error)
|
||||||
|
goto err_reset_mode;
|
||||||
|
}
|
||||||
|
|
||||||
error = usb_submit_urb(dev->tp_urb, GFP_KERNEL);
|
error = usb_submit_urb(dev->tp_urb, GFP_KERNEL);
|
||||||
if (error)
|
if (error)
|
||||||
|
@ -868,19 +870,23 @@ static int bcm5974_probe(struct usb_interface *iface,
|
||||||
mutex_init(&dev->pm_mutex);
|
mutex_init(&dev->pm_mutex);
|
||||||
|
|
||||||
/* setup urbs */
|
/* setup urbs */
|
||||||
dev->bt_urb = usb_alloc_urb(0, GFP_KERNEL);
|
if (cfg->tp_type == TYPE1) {
|
||||||
if (!dev->bt_urb)
|
dev->bt_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||||
goto err_free_devs;
|
if (!dev->bt_urb)
|
||||||
|
goto err_free_devs;
|
||||||
|
}
|
||||||
|
|
||||||
dev->tp_urb = usb_alloc_urb(0, GFP_KERNEL);
|
dev->tp_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||||
if (!dev->tp_urb)
|
if (!dev->tp_urb)
|
||||||
goto err_free_bt_urb;
|
goto err_free_bt_urb;
|
||||||
|
|
||||||
dev->bt_data = usb_alloc_coherent(dev->udev,
|
if (dev->bt_urb) {
|
||||||
|
dev->bt_data = usb_alloc_coherent(dev->udev,
|
||||||
dev->cfg.bt_datalen, GFP_KERNEL,
|
dev->cfg.bt_datalen, GFP_KERNEL,
|
||||||
&dev->bt_urb->transfer_dma);
|
&dev->bt_urb->transfer_dma);
|
||||||
if (!dev->bt_data)
|
if (!dev->bt_data)
|
||||||
goto err_free_urb;
|
goto err_free_urb;
|
||||||
|
}
|
||||||
|
|
||||||
dev->tp_data = usb_alloc_coherent(dev->udev,
|
dev->tp_data = usb_alloc_coherent(dev->udev,
|
||||||
dev->cfg.tp_datalen, GFP_KERNEL,
|
dev->cfg.tp_datalen, GFP_KERNEL,
|
||||||
|
@ -888,10 +894,11 @@ static int bcm5974_probe(struct usb_interface *iface,
|
||||||
if (!dev->tp_data)
|
if (!dev->tp_data)
|
||||||
goto err_free_bt_buffer;
|
goto err_free_bt_buffer;
|
||||||
|
|
||||||
usb_fill_int_urb(dev->bt_urb, udev,
|
if (dev->bt_urb)
|
||||||
usb_rcvintpipe(udev, cfg->bt_ep),
|
usb_fill_int_urb(dev->bt_urb, udev,
|
||||||
dev->bt_data, dev->cfg.bt_datalen,
|
usb_rcvintpipe(udev, cfg->bt_ep),
|
||||||
bcm5974_irq_button, dev, 1);
|
dev->bt_data, dev->cfg.bt_datalen,
|
||||||
|
bcm5974_irq_button, dev, 1);
|
||||||
|
|
||||||
usb_fill_int_urb(dev->tp_urb, udev,
|
usb_fill_int_urb(dev->tp_urb, udev,
|
||||||
usb_rcvintpipe(udev, cfg->tp_ep),
|
usb_rcvintpipe(udev, cfg->tp_ep),
|
||||||
|
@ -929,8 +936,9 @@ static int bcm5974_probe(struct usb_interface *iface,
|
||||||
usb_free_coherent(dev->udev, dev->cfg.tp_datalen,
|
usb_free_coherent(dev->udev, dev->cfg.tp_datalen,
|
||||||
dev->tp_data, dev->tp_urb->transfer_dma);
|
dev->tp_data, dev->tp_urb->transfer_dma);
|
||||||
err_free_bt_buffer:
|
err_free_bt_buffer:
|
||||||
usb_free_coherent(dev->udev, dev->cfg.bt_datalen,
|
if (dev->bt_urb)
|
||||||
dev->bt_data, dev->bt_urb->transfer_dma);
|
usb_free_coherent(dev->udev, dev->cfg.bt_datalen,
|
||||||
|
dev->bt_data, dev->bt_urb->transfer_dma);
|
||||||
err_free_urb:
|
err_free_urb:
|
||||||
usb_free_urb(dev->tp_urb);
|
usb_free_urb(dev->tp_urb);
|
||||||
err_free_bt_urb:
|
err_free_bt_urb:
|
||||||
|
@ -951,8 +959,9 @@ static void bcm5974_disconnect(struct usb_interface *iface)
|
||||||
input_unregister_device(dev->input);
|
input_unregister_device(dev->input);
|
||||||
usb_free_coherent(dev->udev, dev->cfg.tp_datalen,
|
usb_free_coherent(dev->udev, dev->cfg.tp_datalen,
|
||||||
dev->tp_data, dev->tp_urb->transfer_dma);
|
dev->tp_data, dev->tp_urb->transfer_dma);
|
||||||
usb_free_coherent(dev->udev, dev->cfg.bt_datalen,
|
if (dev->bt_urb)
|
||||||
dev->bt_data, dev->bt_urb->transfer_dma);
|
usb_free_coherent(dev->udev, dev->cfg.bt_datalen,
|
||||||
|
dev->bt_data, dev->bt_urb->transfer_dma);
|
||||||
usb_free_urb(dev->tp_urb);
|
usb_free_urb(dev->tp_urb);
|
||||||
usb_free_urb(dev->bt_urb);
|
usb_free_urb(dev->bt_urb);
|
||||||
kfree(dev);
|
kfree(dev);
|
||||||
|
|
Loading…
Reference in a new issue