Skip to content

Commit f6f1242

Browse files
author
Jiri Kosina
committed
Merge branch 'upstream-fixes' into for-linus
Conflicts: drivers/hid/hid-wacom.c
2 parents b0eae38 + bca6214 commit f6f1242

5 files changed

Lines changed: 58 additions & 42 deletions

File tree

‎drivers/hid/hid-magicmouse.c‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,13 @@ static void magicmouse_setup_input(struct input_dev *input, struct hid_device *h
405405
__set_bit(REL_HWHEEL, input->relbit);
406406
}
407407
} else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */
408+
/* input->keybit is initialized with incorrect button info
409+
* for Magic Trackpad. There really is only one physical
410+
* button (BTN_LEFT == BTN_MOUSE). Make sure we don't
411+
* advertise buttons that don't exist...
412+
*/
413+
__clear_bit(BTN_RIGHT, input->keybit);
414+
__clear_bit(BTN_MIDDLE, input->keybit);
408415
__set_bit(BTN_MOUSE, input->keybit);
409416
__set_bit(BTN_TOOL_FINGER, input->keybit);
410417
__set_bit(BTN_TOOL_DOUBLETAP, input->keybit);

‎drivers/hid/hid-wacom.c‎

Lines changed: 43 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,51 @@ static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report,
304304
return 1;
305305
}
306306

307+
static int wacom_input_mapped(struct hid_device *hdev, struct hid_input *hi,
308+
struct hid_field *field, struct hid_usage *usage, unsigned long **bit,
309+
int *max)
310+
{
311+
struct input_dev *input = hi->input;
312+
313+
__set_bit(INPUT_PROP_POINTER, input->propbit);
314+
315+
/* Basics */
316+
input->evbit[0] |= BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_REL);
317+
318+
__set_bit(REL_WHEEL, input->relbit);
319+
320+
__set_bit(BTN_TOOL_PEN, input->keybit);
321+
__set_bit(BTN_TOUCH, input->keybit);
322+
__set_bit(BTN_STYLUS, input->keybit);
323+
__set_bit(BTN_STYLUS2, input->keybit);
324+
__set_bit(BTN_LEFT, input->keybit);
325+
__set_bit(BTN_RIGHT, input->keybit);
326+
__set_bit(BTN_MIDDLE, input->keybit);
327+
328+
/* Pad */
329+
input->evbit[0] |= BIT(EV_MSC);
330+
331+
__set_bit(MSC_SERIAL, input->mscbit);
332+
333+
__set_bit(BTN_0, input->keybit);
334+
__set_bit(BTN_1, input->keybit);
335+
__set_bit(BTN_TOOL_FINGER, input->keybit);
336+
337+
/* Distance, rubber and mouse */
338+
__set_bit(BTN_TOOL_RUBBER, input->keybit);
339+
__set_bit(BTN_TOOL_MOUSE, input->keybit);
340+
341+
input_set_abs_params(input, ABS_X, 0, 16704, 4, 0);
342+
input_set_abs_params(input, ABS_Y, 0, 12064, 4, 0);
343+
input_set_abs_params(input, ABS_PRESSURE, 0, 511, 0, 0);
344+
input_set_abs_params(input, ABS_DISTANCE, 0, 32, 0, 0);
345+
346+
return 0;
347+
}
348+
307349
static int wacom_probe(struct hid_device *hdev,
308350
const struct hid_device_id *id)
309351
{
310-
struct hid_input *hidinput;
311-
struct input_dev *input;
312352
struct wacom_data *wdata;
313353
int ret;
314354

@@ -370,42 +410,6 @@ static int wacom_probe(struct hid_device *hdev,
370410
goto err_ac;
371411
}
372412
#endif
373-
hidinput = list_entry(hdev->inputs.next, struct hid_input, list);
374-
input = hidinput->input;
375-
376-
__set_bit(INPUT_PROP_POINTER, input->propbit);
377-
378-
/* Basics */
379-
input->evbit[0] |= BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_REL);
380-
381-
__set_bit(REL_WHEEL, input->relbit);
382-
383-
__set_bit(BTN_TOOL_PEN, input->keybit);
384-
__set_bit(BTN_TOUCH, input->keybit);
385-
__set_bit(BTN_STYLUS, input->keybit);
386-
__set_bit(BTN_STYLUS2, input->keybit);
387-
__set_bit(BTN_LEFT, input->keybit);
388-
__set_bit(BTN_RIGHT, input->keybit);
389-
__set_bit(BTN_MIDDLE, input->keybit);
390-
391-
/* Pad */
392-
input->evbit[0] |= BIT(EV_MSC);
393-
394-
__set_bit(MSC_SERIAL, input->mscbit);
395-
396-
__set_bit(BTN_0, input->keybit);
397-
__set_bit(BTN_1, input->keybit);
398-
__set_bit(BTN_TOOL_FINGER, input->keybit);
399-
400-
/* Distance, rubber and mouse */
401-
__set_bit(BTN_TOOL_RUBBER, input->keybit);
402-
__set_bit(BTN_TOOL_MOUSE, input->keybit);
403-
404-
input_set_abs_params(input, ABS_X, 0, 16704, 4, 0);
405-
input_set_abs_params(input, ABS_Y, 0, 12064, 4, 0);
406-
input_set_abs_params(input, ABS_PRESSURE, 0, 511, 0, 0);
407-
input_set_abs_params(input, ABS_DISTANCE, 0, 32, 0, 0);
408-
409413
return 0;
410414

411415
#ifdef CONFIG_HID_WACOM_POWER_SUPPLY
@@ -448,6 +452,7 @@ static struct hid_driver wacom_driver = {
448452
.probe = wacom_probe,
449453
.remove = wacom_remove,
450454
.raw_event = wacom_raw_event,
455+
.input_mapped = wacom_input_mapped,
451456
};
452457

453458
static int __init wacom_init(void)

‎drivers/hid/hidraw.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,10 @@ static int hidraw_open(struct inode *inode, struct file *file)
272272
dev = hidraw_table[minor];
273273
if (!dev->open++) {
274274
err = hid_hw_power(dev->hid, PM_HINT_FULLON);
275-
if (err < 0)
275+
if (err < 0) {
276+
dev->open--;
276277
goto out_unlock;
278+
}
277279

278280
err = hid_hw_open(dev->hid);
279281
if (err < 0) {
@@ -510,20 +512,20 @@ void hidraw_disconnect(struct hid_device *hid)
510512
{
511513
struct hidraw *hidraw = hid->hidraw;
512514

515+
mutex_lock(&minors_lock);
513516
hidraw->exist = 0;
514517

515518
device_destroy(hidraw_class, MKDEV(hidraw_major, hidraw->minor));
516519

517-
mutex_lock(&minors_lock);
518520
hidraw_table[hidraw->minor] = NULL;
519-
mutex_unlock(&minors_lock);
520521

521522
if (hidraw->open) {
522523
hid_hw_close(hid);
523524
wake_up_interruptible(&hidraw->wait);
524525
} else {
525526
kfree(hidraw);
526527
}
528+
mutex_unlock(&minors_lock);
527529
}
528530
EXPORT_SYMBOL_GPL(hidraw_disconnect);
529531

‎drivers/hid/usbhid/hid-core.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1270,7 +1270,7 @@ static void hid_cancel_delayed_stuff(struct usbhid_device *usbhid)
12701270

12711271
static void hid_cease_io(struct usbhid_device *usbhid)
12721272
{
1273-
del_timer(&usbhid->io_retry);
1273+
del_timer_sync(&usbhid->io_retry);
12741274
usb_kill_urb(usbhid->urbin);
12751275
usb_kill_urb(usbhid->urbctrl);
12761276
usb_kill_urb(usbhid->urbout);

‎drivers/hid/usbhid/hiddev.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,8 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
641641
struct usb_device *dev = hid_to_usb_dev(hid);
642642
struct usbhid_device *usbhid = hid->driver_data;
643643

644+
memset(&dinfo, 0, sizeof(dinfo));
645+
644646
dinfo.bustype = BUS_USB;
645647
dinfo.busnum = dev->bus->busnum;
646648
dinfo.devnum = dev->devnum;

0 commit comments

Comments
 (0)