Commit c155c749 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull more input updates from Dmitry Torokhov:
 "Second round of updates for the input subsystem.

  The BYD PS/2 protocol driver now uses absolute reporting mode and
  should behave more like other touchpads; Synaptics driver needed to
  extend one of its quirks to a newer firmware version, and a few USB
  drivers got tightened up checks for the contents of their descriptors"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: sur40 - fix DMA on stack
  Input: ati_remote2 - fix crashes on detecting device with invalid descriptor
  Input: synaptics - handle spurious release of trackstick buttons, again
  Input: synaptics-rmi4 - remove check of Non-NULL array
  Input: byd - enable absolute mode
  Input: ims-pcu - sanity check against missing interfaces
  Input: melfas_mip4 - add hw_version sysfs attribute
parents 1701f680 d314e9e8
......@@ -817,26 +817,49 @@ static int ati_remote2_probe(struct usb_interface *interface, const struct usb_d
ar2->udev = udev;
/* Sanity check, first interface must have an endpoint */
if (alt->desc.bNumEndpoints < 1 || !alt->endpoint) {
dev_err(&interface->dev,
"%s(): interface 0 must have an endpoint\n", __func__);
r = -ENODEV;
goto fail1;
}
ar2->intf[0] = interface;
ar2->ep[0] = &alt->endpoint[0].desc;
/* Sanity check, the device must have two interfaces */
ar2->intf[1] = usb_ifnum_to_if(udev, 1);
if ((udev->actconfig->desc.bNumInterfaces < 2) || !ar2->intf[1]) {
dev_err(&interface->dev, "%s(): need 2 interfaces, found %d\n",
__func__, udev->actconfig->desc.bNumInterfaces);
r = -ENODEV;
goto fail1;
}
r = usb_driver_claim_interface(&ati_remote2_driver, ar2->intf[1], ar2);
if (r)
goto fail1;
/* Sanity check, second interface must have an endpoint */
alt = ar2->intf[1]->cur_altsetting;
if (alt->desc.bNumEndpoints < 1 || !alt->endpoint) {
dev_err(&interface->dev,
"%s(): interface 1 must have an endpoint\n", __func__);
r = -ENODEV;
goto fail2;
}
ar2->ep[1] = &alt->endpoint[0].desc;
r = ati_remote2_urb_init(ar2);
if (r)
goto fail2;
goto fail3;
ar2->channel_mask = channel_mask;
ar2->mode_mask = mode_mask;
r = ati_remote2_setup(ar2, ar2->channel_mask);
if (r)
goto fail2;
goto fail3;
usb_make_path(udev, ar2->phys, sizeof(ar2->phys));
strlcat(ar2->phys, "/input0", sizeof(ar2->phys));
......@@ -845,11 +868,11 @@ static int ati_remote2_probe(struct usb_interface *interface, const struct usb_d
r = sysfs_create_group(&udev->dev.kobj, &ati_remote2_attr_group);
if (r)
goto fail2;
goto fail3;
r = ati_remote2_input_init(ar2);
if (r)
goto fail3;
goto fail4;
usb_set_intfdata(interface, ar2);
......@@ -857,10 +880,11 @@ static int ati_remote2_probe(struct usb_interface *interface, const struct usb_d
return 0;
fail3:
fail4:
sysfs_remove_group(&udev->dev.kobj, &ati_remote2_attr_group);
fail2:
fail3:
ati_remote2_urb_cleanup(ar2);
fail2:
usb_driver_release_interface(&ati_remote2_driver, ar2->intf[1]);
fail1:
kfree(ar2);
......
......@@ -1663,6 +1663,8 @@ static int ims_pcu_parse_cdc_data(struct usb_interface *intf, struct ims_pcu *pc
pcu->ctrl_intf = usb_ifnum_to_if(pcu->udev,
union_desc->bMasterInterface0);
if (!pcu->ctrl_intf)
return -EINVAL;
alt = pcu->ctrl_intf->cur_altsetting;
pcu->ep_ctrl = &alt->endpoint[0].desc;
......@@ -1670,6 +1672,8 @@ static int ims_pcu_parse_cdc_data(struct usb_interface *intf, struct ims_pcu *pc
pcu->data_intf = usb_ifnum_to_if(pcu->udev,
union_desc->bSlaveInterface0);
if (!pcu->data_intf)
return -EINVAL;
alt = pcu->data_intf->cur_altsetting;
if (alt->desc.bNumEndpoints != 2) {
......
This diff is collapsed.
......@@ -846,7 +846,7 @@ static const struct psmouse_protocol psmouse_protocols[] = {
#ifdef CONFIG_MOUSE_PS2_BYD
{
.type = PSMOUSE_BYD,
.name = "BydPS/2",
.name = "BYDPS/2",
.alias = "byd",
.detect = byd_detect,
.init = byd_init,
......
......@@ -862,8 +862,9 @@ static void synaptics_report_ext_buttons(struct psmouse *psmouse,
if (!SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap))
return;
/* Bug in FW 8.1, buttons are reported only when ExtBit is 1 */
if (SYN_ID_FULL(priv->identity) == 0x801 &&
/* Bug in FW 8.1 & 8.2, buttons are reported only when ExtBit is 1 */
if ((SYN_ID_FULL(priv->identity) == 0x801 ||
SYN_ID_FULL(priv->identity) == 0x802) &&
!((psmouse->packet[0] ^ psmouse->packet[3]) & 0x02))
return;
......
......@@ -126,7 +126,7 @@ static void process_one_interrupt(struct rmi_driver_data *data,
return;
fh = to_rmi_function_handler(fn->dev.driver);
if (fn->irq_mask && fh->attention) {
if (fh->attention) {
bitmap_and(data->fn_irq_bits, data->irq_status, fn->irq_mask,
data->irq_count);
if (!bitmap_empty(data->fn_irq_bits, data->irq_count))
......@@ -172,8 +172,7 @@ int rmi_process_interrupt_requests(struct rmi_device *rmi_dev)
* use irq_chip.
*/
list_for_each_entry(entry, &data->function_list, node)
if (entry->irq_mask)
process_one_interrupt(data, entry);
process_one_interrupt(data, entry);
if (data->input)
input_sync(data->input);
......
......@@ -1310,8 +1310,34 @@ static ssize_t mip4_sysfs_read_fw_version(struct device *dev,
static DEVICE_ATTR(fw_version, S_IRUGO, mip4_sysfs_read_fw_version, NULL);
static ssize_t mip4_sysfs_read_hw_version(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct i2c_client *client = to_i2c_client(dev);
struct mip4_ts *ts = i2c_get_clientdata(client);
size_t count;
/* Take lock to prevent racing with firmware update */
mutex_lock(&ts->input->mutex);
/*
* product_name shows the name or version of the hardware
* paired with current firmware in the chip.
*/
count = snprintf(buf, PAGE_SIZE, "%.*s\n",
(int)sizeof(ts->product_name), ts->product_name);
mutex_unlock(&ts->input->mutex);
return count;
}
static DEVICE_ATTR(hw_version, S_IRUGO, mip4_sysfs_read_hw_version, NULL);
static struct attribute *mip4_attrs[] = {
&dev_attr_fw_version.attr,
&dev_attr_hw_version.attr,
&dev_attr_update_fw.attr,
NULL,
};
......@@ -1512,6 +1538,6 @@ static struct i2c_driver mip4_driver = {
module_i2c_driver(mip4_driver);
MODULE_DESCRIPTION("MELFAS MIP4 Touchscreen");
MODULE_VERSION("2016.03.03");
MODULE_VERSION("2016.03.12");
MODULE_AUTHOR("Sangwon Jee <jeesw@melfas.com>");
MODULE_LICENSE("GPL");
......@@ -197,28 +197,34 @@ static int sur40_command(struct sur40_state *dev,
static int sur40_init(struct sur40_state *dev)
{
int result;
u8 buffer[24];
u8 *buffer;
buffer = kmalloc(24, GFP_KERNEL);
if (!buffer) {
result = -ENOMEM;
goto error;
}
/* stupidly replay the original MS driver init sequence */
result = sur40_command(dev, SUR40_GET_VERSION, 0x00, buffer, 12);
if (result < 0)
return result;
goto error;
result = sur40_command(dev, SUR40_GET_VERSION, 0x01, buffer, 12);
if (result < 0)
return result;
goto error;
result = sur40_command(dev, SUR40_GET_VERSION, 0x02, buffer, 12);
if (result < 0)
return result;
goto error;
result = sur40_command(dev, SUR40_UNKNOWN2, 0x00, buffer, 24);
if (result < 0)
return result;
goto error;
result = sur40_command(dev, SUR40_UNKNOWN1, 0x00, buffer, 5);
if (result < 0)
return result;
goto error;
result = sur40_command(dev, SUR40_GET_VERSION, 0x03, buffer, 12);
......@@ -226,7 +232,8 @@ static int sur40_init(struct sur40_state *dev)
* Discard the result buffer - no known data inside except
* some version strings, maybe extract these sometime...
*/
error:
kfree(buffer);
return result;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment