Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

Pull input fixes from Dmitry Torokhov:

- add sanity checks to USB endpoints in various dirvers

- max77650-onkey was missing an OF table which was preventing module
autoloading

- a revert and a different fix for F54 handling in Synaptics dirver

- a fixup for handling register in pm8xxx vibrator driver

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
Input: pm8xxx-vib - fix handling of separate enable register
Input: keyspan-remote - fix control-message timeouts
Input: max77650-onkey - add of_match table
Input: rmi_f54 - read from FIFO in 32 byte blocks
Revert "Input: synaptics-rmi4 - don't increment rmiaddr for SMBus transfers"
Input: sur40 - fix interface sanity checks
Input: gtco - drop redundant variable reinit
Input: gtco - fix extra-descriptor debug message
Input: gtco - fix endpoint sanity check
Input: aiptek - use descriptors of current altsetting
Input: aiptek - fix endpoint sanity check
Input: pegasus_notetaker - fix endpoint sanity check
Input: sun4i-ts - add a check for devm_thermal_zone_of_sensor_register
Input: evdev - convert kzalloc()/vzalloc() to kvzalloc()

+1 -4
drivers/input/evdev.c
··· 484 484 struct evdev_client *client; 485 485 int error; 486 486 487 - client = kzalloc(struct_size(client, buffer, bufsize), 488 - GFP_KERNEL | __GFP_NOWARN); 489 - if (!client) 490 - client = vzalloc(struct_size(client, buffer, bufsize)); 487 + client = kvzalloc(struct_size(client, buffer, bufsize), GFP_KERNEL); 491 488 if (!client) 492 489 return -ENOMEM; 493 490
+6 -3
drivers/input/misc/keyspan_remote.c
··· 336 336 int retval = 0; 337 337 338 338 retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 339 - 0x11, 0x40, 0x5601, 0x0, NULL, 0, 0); 339 + 0x11, 0x40, 0x5601, 0x0, NULL, 0, 340 + USB_CTRL_SET_TIMEOUT); 340 341 if (retval) { 341 342 dev_dbg(&dev->dev, "%s - failed to set bit rate due to error: %d\n", 342 343 __func__, retval); ··· 345 344 } 346 345 347 346 retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 348 - 0x44, 0x40, 0x0, 0x0, NULL, 0, 0); 347 + 0x44, 0x40, 0x0, 0x0, NULL, 0, 348 + USB_CTRL_SET_TIMEOUT); 349 349 if (retval) { 350 350 dev_dbg(&dev->dev, "%s - failed to set resume sensitivity due to error: %d\n", 351 351 __func__, retval); ··· 354 352 } 355 353 356 354 retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 357 - 0x22, 0x40, 0x0, 0x0, NULL, 0, 0); 355 + 0x22, 0x40, 0x0, 0x0, NULL, 0, 356 + USB_CTRL_SET_TIMEOUT); 358 357 if (retval) { 359 358 dev_dbg(&dev->dev, "%s - failed to turn receive on due to error: %d\n", 360 359 __func__, retval);
+7
drivers/input/misc/max77650-onkey.c
··· 108 108 return input_register_device(onkey->input); 109 109 } 110 110 111 + static const struct of_device_id max77650_onkey_of_match[] = { 112 + { .compatible = "maxim,max77650-onkey" }, 113 + { } 114 + }; 115 + MODULE_DEVICE_TABLE(of, max77650_onkey_of_match); 116 + 111 117 static struct platform_driver max77650_onkey_driver = { 112 118 .driver = { 113 119 .name = "max77650-onkey", 120 + .of_match_table = max77650_onkey_of_match, 114 121 }, 115 122 .probe = max77650_onkey_probe, 116 123 };
+1 -1
drivers/input/misc/pm8xxx-vibrator.c
··· 90 90 91 91 if (regs->enable_mask) 92 92 rc = regmap_update_bits(vib->regmap, regs->enable_addr, 93 - on ? regs->enable_mask : 0, val); 93 + regs->enable_mask, on ? ~0 : 0); 94 94 95 95 return rc; 96 96 }
+27 -16
drivers/input/rmi4/rmi_f54.c
··· 24 24 #define F54_NUM_TX_OFFSET 1 25 25 #define F54_NUM_RX_OFFSET 0 26 26 27 + /* 28 + * The smbus protocol can read only 32 bytes max at a time. 29 + * But this should be fine for i2c/spi as well. 30 + */ 31 + #define F54_REPORT_DATA_SIZE 32 32 + 27 33 /* F54 commands */ 28 34 #define F54_GET_REPORT 1 29 35 #define F54_FORCE_CAL 2 ··· 532 526 int report_size; 533 527 u8 command; 534 528 int error; 529 + int i; 535 530 536 531 report_size = rmi_f54_get_report_size(f54); 537 532 if (report_size == 0) { ··· 565 558 566 559 rmi_dbg(RMI_DEBUG_FN, &fn->dev, "Get report command completed, reading data\n"); 567 560 568 - fifo[0] = 0; 569 - fifo[1] = 0; 570 - error = rmi_write_block(fn->rmi_dev, 571 - fn->fd.data_base_addr + F54_FIFO_OFFSET, 572 - fifo, sizeof(fifo)); 573 - if (error) { 574 - dev_err(&fn->dev, "Failed to set fifo start offset\n"); 575 - goto abort; 576 - } 561 + for (i = 0; i < report_size; i += F54_REPORT_DATA_SIZE) { 562 + int size = min(F54_REPORT_DATA_SIZE, report_size - i); 577 563 578 - error = rmi_read_block(fn->rmi_dev, fn->fd.data_base_addr + 579 - F54_REPORT_DATA_OFFSET, f54->report_data, 580 - report_size); 581 - if (error) { 582 - dev_err(&fn->dev, "%s: read [%d bytes] returned %d\n", 583 - __func__, report_size, error); 584 - goto abort; 564 + fifo[0] = i & 0xff; 565 + fifo[1] = i >> 8; 566 + error = rmi_write_block(fn->rmi_dev, 567 + fn->fd.data_base_addr + F54_FIFO_OFFSET, 568 + fifo, sizeof(fifo)); 569 + if (error) { 570 + dev_err(&fn->dev, "Failed to set fifo start offset\n"); 571 + goto abort; 572 + } 573 + 574 + error = rmi_read_block(fn->rmi_dev, fn->fd.data_base_addr + 575 + F54_REPORT_DATA_OFFSET, 576 + f54->report_data + i, size); 577 + if (error) { 578 + dev_err(&fn->dev, "%s: read [%d bytes] returned %d\n", 579 + __func__, size, error); 580 + goto abort; 581 + } 585 582 } 586 583 587 584 abort:
+2
drivers/input/rmi4/rmi_smbus.c
··· 163 163 /* prepare to write next block of bytes */ 164 164 cur_len -= SMB_MAX_COUNT; 165 165 databuff += SMB_MAX_COUNT; 166 + rmiaddr += SMB_MAX_COUNT; 166 167 } 167 168 exit: 168 169 mutex_unlock(&rmi_smb->page_mutex); ··· 215 214 /* prepare to read next block of bytes */ 216 215 cur_len -= SMB_MAX_COUNT; 217 216 databuff += SMB_MAX_COUNT; 217 + rmiaddr += SMB_MAX_COUNT; 218 218 } 219 219 220 220 retval = 0;
+4 -4
drivers/input/tablet/aiptek.c
··· 1713 1713 1714 1714 aiptek->inputdev = inputdev; 1715 1715 aiptek->intf = intf; 1716 - aiptek->ifnum = intf->altsetting[0].desc.bInterfaceNumber; 1716 + aiptek->ifnum = intf->cur_altsetting->desc.bInterfaceNumber; 1717 1717 aiptek->inDelay = 0; 1718 1718 aiptek->endDelay = 0; 1719 1719 aiptek->previousJitterable = 0; ··· 1802 1802 input_set_abs_params(inputdev, ABS_WHEEL, AIPTEK_WHEEL_MIN, AIPTEK_WHEEL_MAX - 1, 0, 0); 1803 1803 1804 1804 /* Verify that a device really has an endpoint */ 1805 - if (intf->altsetting[0].desc.bNumEndpoints < 1) { 1805 + if (intf->cur_altsetting->desc.bNumEndpoints < 1) { 1806 1806 dev_err(&intf->dev, 1807 1807 "interface has %d endpoints, but must have minimum 1\n", 1808 - intf->altsetting[0].desc.bNumEndpoints); 1808 + intf->cur_altsetting->desc.bNumEndpoints); 1809 1809 err = -EINVAL; 1810 1810 goto fail3; 1811 1811 } 1812 - endpoint = &intf->altsetting[0].endpoint[0].desc; 1812 + endpoint = &intf->cur_altsetting->endpoint[0].desc; 1813 1813 1814 1814 /* Go set up our URB, which is called when the tablet receives 1815 1815 * input.
+4 -9
drivers/input/tablet/gtco.c
··· 875 875 } 876 876 877 877 /* Sanity check that a device has an endpoint */ 878 - if (usbinterface->altsetting[0].desc.bNumEndpoints < 1) { 878 + if (usbinterface->cur_altsetting->desc.bNumEndpoints < 1) { 879 879 dev_err(&usbinterface->dev, 880 880 "Invalid number of endpoints\n"); 881 881 error = -EINVAL; 882 882 goto err_free_urb; 883 883 } 884 884 885 - /* 886 - * The endpoint is always altsetting 0, we know this since we know 887 - * this device only has one interrupt endpoint 888 - */ 889 - endpoint = &usbinterface->altsetting[0].endpoint[0].desc; 885 + endpoint = &usbinterface->cur_altsetting->endpoint[0].desc; 890 886 891 887 /* Some debug */ 892 888 dev_dbg(&usbinterface->dev, "gtco # interfaces: %d\n", usbinterface->num_altsetting); ··· 892 896 if (usb_endpoint_xfer_int(endpoint)) 893 897 dev_dbg(&usbinterface->dev, "endpoint: we have interrupt endpoint\n"); 894 898 895 - dev_dbg(&usbinterface->dev, "endpoint extra len:%d\n", usbinterface->altsetting[0].extralen); 899 + dev_dbg(&usbinterface->dev, "interface extra len:%d\n", 900 + usbinterface->cur_altsetting->extralen); 896 901 897 902 /* 898 903 * Find the HID descriptor so we can find out the size of the ··· 970 973 input_dev->dev.parent = &usbinterface->dev; 971 974 972 975 /* Setup the URB, it will be posted later on open of input device */ 973 - endpoint = &usbinterface->altsetting[0].endpoint[0].desc; 974 - 975 976 usb_fill_int_urb(gtco->urbinfo, 976 977 udev, 977 978 usb_rcvintpipe(udev,
+1 -1
drivers/input/tablet/pegasus_notetaker.c
··· 275 275 return -ENODEV; 276 276 277 277 /* Sanity check that the device has an endpoint */ 278 - if (intf->altsetting[0].desc.bNumEndpoints < 1) { 278 + if (intf->cur_altsetting->desc.bNumEndpoints < 1) { 279 279 dev_err(&intf->dev, "Invalid number of endpoints\n"); 280 280 return -EINVAL; 281 281 }
+5 -1
drivers/input/touchscreen/sun4i-ts.c
··· 237 237 struct device *dev = &pdev->dev; 238 238 struct device_node *np = dev->of_node; 239 239 struct device *hwmon; 240 + struct thermal_zone_device *thermal; 240 241 int error; 241 242 u32 reg; 242 243 bool ts_attached; ··· 356 355 if (IS_ERR(hwmon)) 357 356 return PTR_ERR(hwmon); 358 357 359 - devm_thermal_zone_of_sensor_register(ts->dev, 0, ts, &sun4i_ts_tz_ops); 358 + thermal = devm_thermal_zone_of_sensor_register(ts->dev, 0, ts, 359 + &sun4i_ts_tz_ops); 360 + if (IS_ERR(thermal)) 361 + return PTR_ERR(thermal); 360 362 361 363 writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC); 362 364
+1 -1
drivers/input/touchscreen/sur40.c
··· 661 661 int error; 662 662 663 663 /* Check if we really have the right interface. */ 664 - iface_desc = &interface->altsetting[0]; 664 + iface_desc = interface->cur_altsetting; 665 665 if (iface_desc->desc.bInterfaceClass != 0xFF) 666 666 return -ENODEV; 667 667