Skip to content

Commit

Permalink
Merge branch 'for-4.15/use-timer-setup' into for-linus
Browse files Browse the repository at this point in the history
- usbhid: conversion to timer_setup() and from_timer() from Kees Cook

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Jiri Kosina committed Nov 15, 2017
2 parents 6ed7a70 + 0ee3277 commit 4b54530
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
10 changes: 6 additions & 4 deletions drivers/hid/hid-multitouch.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ struct mt_device {
struct mt_slot curdata; /* placeholder of incoming data */
struct mt_class mtclass; /* our mt device class */
struct timer_list release_timer; /* to release sticky fingers */
struct hid_device *hdev; /* hid_device we're attached to */
struct mt_fields *fields; /* temporary placeholder for storing the
multitouch fields */
unsigned long mt_io_flags; /* mt flags (MT_IO_FLAGS_*) */
Expand Down Expand Up @@ -1288,10 +1289,10 @@ static void mt_release_contacts(struct hid_device *hid)
td->num_received = 0;
}

static void mt_expired_timeout(unsigned long arg)
static void mt_expired_timeout(struct timer_list *t)
{
struct hid_device *hdev = (void *)arg;
struct mt_device *td = hid_get_drvdata(hdev);
struct mt_device *td = from_timer(td, t, release_timer);
struct hid_device *hdev = td->hdev;

/*
* An input report came in just before we release the sticky fingers,
Expand Down Expand Up @@ -1322,6 +1323,7 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
dev_err(&hdev->dev, "cannot allocate multitouch data\n");
return -ENOMEM;
}
td->hdev = hdev;
td->mtclass = *mtclass;
td->inputmode = -1;
td->maxcontact_report_id = -1;
Expand Down Expand Up @@ -1373,7 +1375,7 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
*/
hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS;

setup_timer(&td->release_timer, mt_expired_timeout, (long)hdev);
timer_setup(&td->release_timer, mt_expired_timeout, 0);

ret = hid_parse(hdev);
if (ret != 0)
Expand Down
8 changes: 4 additions & 4 deletions drivers/hid/usbhid/hid-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ static int hid_start_in(struct hid_device *hid)
}

/* I/O retry timer routine */
static void hid_retry_timeout(unsigned long _hid)
static void hid_retry_timeout(struct timer_list *t)
{
struct hid_device *hid = (struct hid_device *) _hid;
struct usbhid_device *usbhid = hid->driver_data;
struct usbhid_device *usbhid = from_timer(usbhid, t, io_retry);
struct hid_device *hid = usbhid->hid;

dev_dbg(&usbhid->intf->dev, "retrying intr urb\n");
if (hid_start_in(hid))
Expand Down Expand Up @@ -1373,7 +1373,7 @@ static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *

init_waitqueue_head(&usbhid->wait);
INIT_WORK(&usbhid->reset_work, hid_reset);
setup_timer(&usbhid->io_retry, hid_retry_timeout, (unsigned long) hid);
timer_setup(&usbhid->io_retry, hid_retry_timeout, 0);
spin_lock_init(&usbhid->lock);

ret = hid_add_device(hid);
Expand Down

0 comments on commit 4b54530

Please sign in to comment.