diff options
author | Jiri Kosina <jkosina@suse.cz> | 2017-11-15 05:13:23 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2017-11-15 05:13:23 -0500 |
commit | 4b545304947147bd4b9890160d328780c97bac33 (patch) | |
tree | 075de84738df9ec472980887830f632c7b6ca6df | |
parent | 6ed7a70be54ef6148cbfce0d59d12d2aa41bbb23 (diff) | |
parent | 0ee32774aed648854a06bc3fae636f20f5f75a68 (diff) |
Merge branch 'for-4.15/use-timer-setup' into for-linus
- usbhid: conversion to timer_setup() and from_timer() from Kees Cook
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r-- | drivers/hid/hid-multitouch.c | 10 | ||||
-rw-r--r-- | drivers/hid/usbhid/hid-core.c | 8 |
2 files changed, 10 insertions, 8 deletions
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 86fd7f4b1b26..65ea23be9677 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c | |||
@@ -113,6 +113,7 @@ struct mt_device { | |||
113 | struct mt_slot curdata; /* placeholder of incoming data */ | 113 | struct mt_slot curdata; /* placeholder of incoming data */ |
114 | struct mt_class mtclass; /* our mt device class */ | 114 | struct mt_class mtclass; /* our mt device class */ |
115 | struct timer_list release_timer; /* to release sticky fingers */ | 115 | struct timer_list release_timer; /* to release sticky fingers */ |
116 | struct hid_device *hdev; /* hid_device we're attached to */ | ||
116 | struct mt_fields *fields; /* temporary placeholder for storing the | 117 | struct mt_fields *fields; /* temporary placeholder for storing the |
117 | multitouch fields */ | 118 | multitouch fields */ |
118 | unsigned long mt_io_flags; /* mt flags (MT_IO_FLAGS_*) */ | 119 | unsigned long mt_io_flags; /* mt flags (MT_IO_FLAGS_*) */ |
@@ -1288,10 +1289,10 @@ static void mt_release_contacts(struct hid_device *hid) | |||
1288 | td->num_received = 0; | 1289 | td->num_received = 0; |
1289 | } | 1290 | } |
1290 | 1291 | ||
1291 | static void mt_expired_timeout(unsigned long arg) | 1292 | static void mt_expired_timeout(struct timer_list *t) |
1292 | { | 1293 | { |
1293 | struct hid_device *hdev = (void *)arg; | 1294 | struct mt_device *td = from_timer(td, t, release_timer); |
1294 | struct mt_device *td = hid_get_drvdata(hdev); | 1295 | struct hid_device *hdev = td->hdev; |
1295 | 1296 | ||
1296 | /* | 1297 | /* |
1297 | * An input report came in just before we release the sticky fingers, | 1298 | * An input report came in just before we release the sticky fingers, |
@@ -1322,6 +1323,7 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
1322 | dev_err(&hdev->dev, "cannot allocate multitouch data\n"); | 1323 | dev_err(&hdev->dev, "cannot allocate multitouch data\n"); |
1323 | return -ENOMEM; | 1324 | return -ENOMEM; |
1324 | } | 1325 | } |
1326 | td->hdev = hdev; | ||
1325 | td->mtclass = *mtclass; | 1327 | td->mtclass = *mtclass; |
1326 | td->inputmode = -1; | 1328 | td->inputmode = -1; |
1327 | td->maxcontact_report_id = -1; | 1329 | td->maxcontact_report_id = -1; |
@@ -1373,7 +1375,7 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
1373 | */ | 1375 | */ |
1374 | hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS; | 1376 | hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS; |
1375 | 1377 | ||
1376 | setup_timer(&td->release_timer, mt_expired_timeout, (long)hdev); | 1378 | timer_setup(&td->release_timer, mt_expired_timeout, 0); |
1377 | 1379 | ||
1378 | ret = hid_parse(hdev); | 1380 | ret = hid_parse(hdev); |
1379 | if (ret != 0) | 1381 | if (ret != 0) |
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index 045b5da9b992..640dfb937c69 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c | |||
@@ -101,10 +101,10 @@ static int hid_start_in(struct hid_device *hid) | |||
101 | } | 101 | } |
102 | 102 | ||
103 | /* I/O retry timer routine */ | 103 | /* I/O retry timer routine */ |
104 | static void hid_retry_timeout(unsigned long _hid) | 104 | static void hid_retry_timeout(struct timer_list *t) |
105 | { | 105 | { |
106 | struct hid_device *hid = (struct hid_device *) _hid; | 106 | struct usbhid_device *usbhid = from_timer(usbhid, t, io_retry); |
107 | struct usbhid_device *usbhid = hid->driver_data; | 107 | struct hid_device *hid = usbhid->hid; |
108 | 108 | ||
109 | dev_dbg(&usbhid->intf->dev, "retrying intr urb\n"); | 109 | dev_dbg(&usbhid->intf->dev, "retrying intr urb\n"); |
110 | if (hid_start_in(hid)) | 110 | if (hid_start_in(hid)) |
@@ -1373,7 +1373,7 @@ static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id * | |||
1373 | 1373 | ||
1374 | init_waitqueue_head(&usbhid->wait); | 1374 | init_waitqueue_head(&usbhid->wait); |
1375 | INIT_WORK(&usbhid->reset_work, hid_reset); | 1375 | INIT_WORK(&usbhid->reset_work, hid_reset); |
1376 | setup_timer(&usbhid->io_retry, hid_retry_timeout, (unsigned long) hid); | 1376 | timer_setup(&usbhid->io_retry, hid_retry_timeout, 0); |
1377 | spin_lock_init(&usbhid->lock); | 1377 | spin_lock_init(&usbhid->lock); |
1378 | 1378 | ||
1379 | ret = hid_add_device(hid); | 1379 | ret = hid_add_device(hid); |