aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse/bcm5974.c
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2012-08-12 18:18:44 -0400
committerHenrik Rydberg <rydberg@euromail.se>2012-09-19 13:50:21 -0400
commit43f482b48d0322df7c0cc6f97d0ec7c77db6777b (patch)
tree42e678f056b16544a4b181a734d1f784ec70cd59 /drivers/input/mouse/bcm5974.c
parent77723e3bc71a221a732a21700975c066a4ae06e2 (diff)
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>
Diffstat (limited to 'drivers/input/mouse/bcm5974.c')
-rw-r--r--drivers/input/mouse/bcm5974.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c
index d528c23e194f..39ac9ff3da81 100644
--- a/drivers/input/mouse/bcm5974.c
+++ b/drivers/input/mouse/bcm5974.c
@@ -742,9 +742,11 @@ static int bcm5974_start_traffic(struct bcm5974 *dev)
742 goto err_out; 742 goto err_out;
743 } 743 }
744 744
745 error = usb_submit_urb(dev->bt_urb, GFP_KERNEL); 745 if (dev->bt_urb) {
746 if (error) 746 error = usb_submit_urb(dev->bt_urb, GFP_KERNEL);
747 goto err_reset_mode; 747 if (error)
748 goto err_reset_mode;
749 }
748 750
749 error = usb_submit_urb(dev->tp_urb, GFP_KERNEL); 751 error = usb_submit_urb(dev->tp_urb, GFP_KERNEL);
750 if (error) 752 if (error)
@@ -868,19 +870,23 @@ static int bcm5974_probe(struct usb_interface *iface,
868 mutex_init(&dev->pm_mutex); 870 mutex_init(&dev->pm_mutex);
869 871
870 /* setup urbs */ 872 /* setup urbs */
871 dev->bt_urb = usb_alloc_urb(0, GFP_KERNEL); 873 if (cfg->tp_type == TYPE1) {
872 if (!dev->bt_urb) 874 dev->bt_urb = usb_alloc_urb(0, GFP_KERNEL);
873 goto err_free_devs; 875 if (!dev->bt_urb)
876 goto err_free_devs;
877 }
874 878
875 dev->tp_urb = usb_alloc_urb(0, GFP_KERNEL); 879 dev->tp_urb = usb_alloc_urb(0, GFP_KERNEL);
876 if (!dev->tp_urb) 880 if (!dev->tp_urb)
877 goto err_free_bt_urb; 881 goto err_free_bt_urb;
878 882
879 dev->bt_data = usb_alloc_coherent(dev->udev, 883 if (dev->bt_urb) {
884 dev->bt_data = usb_alloc_coherent(dev->udev,
880 dev->cfg.bt_datalen, GFP_KERNEL, 885 dev->cfg.bt_datalen, GFP_KERNEL,
881 &dev->bt_urb->transfer_dma); 886 &dev->bt_urb->transfer_dma);
882 if (!dev->bt_data) 887 if (!dev->bt_data)
883 goto err_free_urb; 888 goto err_free_urb;
889 }
884 890
885 dev->tp_data = usb_alloc_coherent(dev->udev, 891 dev->tp_data = usb_alloc_coherent(dev->udev,
886 dev->cfg.tp_datalen, GFP_KERNEL, 892 dev->cfg.tp_datalen, GFP_KERNEL,
@@ -888,10 +894,11 @@ static int bcm5974_probe(struct usb_interface *iface,
888 if (!dev->tp_data) 894 if (!dev->tp_data)
889 goto err_free_bt_buffer; 895 goto err_free_bt_buffer;
890 896
891 usb_fill_int_urb(dev->bt_urb, udev, 897 if (dev->bt_urb)
892 usb_rcvintpipe(udev, cfg->bt_ep), 898 usb_fill_int_urb(dev->bt_urb, udev,
893 dev->bt_data, dev->cfg.bt_datalen, 899 usb_rcvintpipe(udev, cfg->bt_ep),
894 bcm5974_irq_button, dev, 1); 900 dev->bt_data, dev->cfg.bt_datalen,
901 bcm5974_irq_button, dev, 1);
895 902
896 usb_fill_int_urb(dev->tp_urb, udev, 903 usb_fill_int_urb(dev->tp_urb, udev,
897 usb_rcvintpipe(udev, cfg->tp_ep), 904 usb_rcvintpipe(udev, cfg->tp_ep),
@@ -929,8 +936,9 @@ err_free_buffer:
929 usb_free_coherent(dev->udev, dev->cfg.tp_datalen, 936 usb_free_coherent(dev->udev, dev->cfg.tp_datalen,
930 dev->tp_data, dev->tp_urb->transfer_dma); 937 dev->tp_data, dev->tp_urb->transfer_dma);
931err_free_bt_buffer: 938err_free_bt_buffer:
932 usb_free_coherent(dev->udev, dev->cfg.bt_datalen, 939 if (dev->bt_urb)
933 dev->bt_data, dev->bt_urb->transfer_dma); 940 usb_free_coherent(dev->udev, dev->cfg.bt_datalen,
941 dev->bt_data, dev->bt_urb->transfer_dma);
934err_free_urb: 942err_free_urb:
935 usb_free_urb(dev->tp_urb); 943 usb_free_urb(dev->tp_urb);
936err_free_bt_urb: 944err_free_bt_urb:
@@ -951,8 +959,9 @@ static void bcm5974_disconnect(struct usb_interface *iface)
951 input_unregister_device(dev->input); 959 input_unregister_device(dev->input);
952 usb_free_coherent(dev->udev, dev->cfg.tp_datalen, 960 usb_free_coherent(dev->udev, dev->cfg.tp_datalen,
953 dev->tp_data, dev->tp_urb->transfer_dma); 961 dev->tp_data, dev->tp_urb->transfer_dma);
954 usb_free_coherent(dev->udev, dev->cfg.bt_datalen, 962 if (dev->bt_urb)
955 dev->bt_data, dev->bt_urb->transfer_dma); 963 usb_free_coherent(dev->udev, dev->cfg.bt_datalen,
964 dev->bt_data, dev->bt_urb->transfer_dma);
956 usb_free_urb(dev->tp_urb); 965 usb_free_urb(dev->tp_urb);
957 usb_free_urb(dev->bt_urb); 966 usb_free_urb(dev->bt_urb);
958 kfree(dev); 967 kfree(dev);