diff options
-rw-r--r-- | drivers/hid/wacom.h | 21 | ||||
-rw-r--r-- | drivers/hid/wacom_sys.c | 10 | ||||
-rw-r--r-- | drivers/hid/wacom_wac.c | 13 |
3 files changed, 29 insertions, 15 deletions
diff --git a/drivers/hid/wacom.h b/drivers/hid/wacom.h index 4681a65a4579..a968fbbbae77 100644 --- a/drivers/hid/wacom.h +++ b/drivers/hid/wacom.h | |||
@@ -105,13 +105,19 @@ | |||
105 | #define USB_VENDOR_ID_WACOM 0x056a | 105 | #define USB_VENDOR_ID_WACOM 0x056a |
106 | #define USB_VENDOR_ID_LENOVO 0x17ef | 106 | #define USB_VENDOR_ID_LENOVO 0x17ef |
107 | 107 | ||
108 | enum wacom_worker { | ||
109 | WACOM_WORKER_WIRELESS, | ||
110 | WACOM_WORKER_BATTERY, | ||
111 | }; | ||
112 | |||
108 | struct wacom { | 113 | struct wacom { |
109 | struct usb_device *usbdev; | 114 | struct usb_device *usbdev; |
110 | struct usb_interface *intf; | 115 | struct usb_interface *intf; |
111 | struct wacom_wac wacom_wac; | 116 | struct wacom_wac wacom_wac; |
112 | struct hid_device *hdev; | 117 | struct hid_device *hdev; |
113 | struct mutex lock; | 118 | struct mutex lock; |
114 | struct work_struct work; | 119 | struct work_struct wireless_work; |
120 | struct work_struct battery_work; | ||
115 | struct wacom_led { | 121 | struct wacom_led { |
116 | u8 select[5]; /* status led selector (0..3) */ | 122 | u8 select[5]; /* status led selector (0..3) */ |
117 | u8 llv; /* status led brightness no button (1..127) */ | 123 | u8 llv; /* status led brightness no button (1..127) */ |
@@ -127,10 +133,19 @@ struct wacom { | |||
127 | struct attribute_group remote_group[5]; | 133 | struct attribute_group remote_group[5]; |
128 | }; | 134 | }; |
129 | 135 | ||
130 | static inline void wacom_schedule_work(struct wacom_wac *wacom_wac) | 136 | static inline void wacom_schedule_work(struct wacom_wac *wacom_wac, |
137 | enum wacom_worker which) | ||
131 | { | 138 | { |
132 | struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac); | 139 | struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac); |
133 | schedule_work(&wacom->work); | 140 | |
141 | switch (which) { | ||
142 | case WACOM_WORKER_WIRELESS: | ||
143 | schedule_work(&wacom->wireless_work); | ||
144 | break; | ||
145 | case WACOM_WORKER_BATTERY: | ||
146 | schedule_work(&wacom->battery_work); | ||
147 | break; | ||
148 | } | ||
134 | } | 149 | } |
135 | 150 | ||
136 | extern const struct hid_device_id wacom_ids[]; | 151 | extern const struct hid_device_id wacom_ids[]; |
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index af2801df14ed..54f026049812 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c | |||
@@ -1527,7 +1527,7 @@ static void wacom_calculate_res(struct wacom_features *features) | |||
1527 | 1527 | ||
1528 | void wacom_battery_work(struct work_struct *work) | 1528 | void wacom_battery_work(struct work_struct *work) |
1529 | { | 1529 | { |
1530 | struct wacom *wacom = container_of(work, struct wacom, work); | 1530 | struct wacom *wacom = container_of(work, struct wacom, battery_work); |
1531 | 1531 | ||
1532 | if ((wacom->wacom_wac.features.quirks & WACOM_QUIRK_BATTERY) && | 1532 | if ((wacom->wacom_wac.features.quirks & WACOM_QUIRK_BATTERY) && |
1533 | !wacom->battery) { | 1533 | !wacom->battery) { |
@@ -1743,7 +1743,7 @@ fail_allocate_inputs: | |||
1743 | 1743 | ||
1744 | static void wacom_wireless_work(struct work_struct *work) | 1744 | static void wacom_wireless_work(struct work_struct *work) |
1745 | { | 1745 | { |
1746 | struct wacom *wacom = container_of(work, struct wacom, work); | 1746 | struct wacom *wacom = container_of(work, struct wacom, wireless_work); |
1747 | struct usb_device *usbdev = wacom->usbdev; | 1747 | struct usb_device *usbdev = wacom->usbdev; |
1748 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; | 1748 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
1749 | struct hid_device *hdev1, *hdev2; | 1749 | struct hid_device *hdev1, *hdev2; |
@@ -1871,7 +1871,8 @@ static int wacom_probe(struct hid_device *hdev, | |||
1871 | wacom->usbdev = dev; | 1871 | wacom->usbdev = dev; |
1872 | wacom->intf = intf; | 1872 | wacom->intf = intf; |
1873 | mutex_init(&wacom->lock); | 1873 | mutex_init(&wacom->lock); |
1874 | INIT_WORK(&wacom->work, wacom_wireless_work); | 1874 | INIT_WORK(&wacom->wireless_work, wacom_wireless_work); |
1875 | INIT_WORK(&wacom->battery_work, wacom_battery_work); | ||
1875 | 1876 | ||
1876 | /* ask for the report descriptor to be loaded by HID */ | 1877 | /* ask for the report descriptor to be loaded by HID */ |
1877 | error = hid_parse(hdev); | 1878 | error = hid_parse(hdev); |
@@ -1912,7 +1913,8 @@ static void wacom_remove(struct hid_device *hdev) | |||
1912 | 1913 | ||
1913 | hid_hw_stop(hdev); | 1914 | hid_hw_stop(hdev); |
1914 | 1915 | ||
1915 | cancel_work_sync(&wacom->work); | 1916 | cancel_work_sync(&wacom->wireless_work); |
1917 | cancel_work_sync(&wacom->battery_work); | ||
1916 | kobject_put(wacom->remote_dir); | 1918 | kobject_put(wacom->remote_dir); |
1917 | wacom_destroy_leds(wacom); | 1919 | wacom_destroy_leds(wacom); |
1918 | wacom_clean_inputs(wacom); | 1920 | wacom_clean_inputs(wacom); |
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index d6746caf71cb..c7707b29eeec 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c | |||
@@ -814,8 +814,7 @@ static int wacom_remote_irq(struct wacom_wac *wacom_wac, size_t len) | |||
814 | if (!wacom->battery && | 814 | if (!wacom->battery && |
815 | !(features->quirks & WACOM_QUIRK_BATTERY)) { | 815 | !(features->quirks & WACOM_QUIRK_BATTERY)) { |
816 | features->quirks |= WACOM_QUIRK_BATTERY; | 816 | features->quirks |= WACOM_QUIRK_BATTERY; |
817 | INIT_WORK(&wacom->work, wacom_battery_work); | 817 | wacom_schedule_work(wacom_wac, WACOM_WORKER_BATTERY); |
818 | wacom_schedule_work(wacom_wac); | ||
819 | } | 818 | } |
820 | 819 | ||
821 | wacom_notify_battery(wacom_wac, bat_percent, bat_charging, 1, | 820 | wacom_notify_battery(wacom_wac, bat_percent, bat_charging, 1, |
@@ -2150,7 +2149,7 @@ static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len) | |||
2150 | charging = !!(data[5] & 0x80); | 2149 | charging = !!(data[5] & 0x80); |
2151 | if (wacom->pid != pid) { | 2150 | if (wacom->pid != pid) { |
2152 | wacom->pid = pid; | 2151 | wacom->pid = pid; |
2153 | wacom_schedule_work(wacom); | 2152 | wacom_schedule_work(wacom, WACOM_WORKER_WIRELESS); |
2154 | } | 2153 | } |
2155 | 2154 | ||
2156 | if (w->battery) | 2155 | if (w->battery) |
@@ -2159,7 +2158,7 @@ static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len) | |||
2159 | } else if (wacom->pid != 0) { | 2158 | } else if (wacom->pid != 0) { |
2160 | /* disconnected while previously connected */ | 2159 | /* disconnected while previously connected */ |
2161 | wacom->pid = 0; | 2160 | wacom->pid = 0; |
2162 | wacom_schedule_work(wacom); | 2161 | wacom_schedule_work(wacom, WACOM_WORKER_WIRELESS); |
2163 | wacom_notify_battery(wacom, 0, 0, 0, 0); | 2162 | wacom_notify_battery(wacom, 0, 0, 0, 0); |
2164 | } | 2163 | } |
2165 | 2164 | ||
@@ -2194,15 +2193,13 @@ static int wacom_status_irq(struct wacom_wac *wacom_wac, size_t len) | |||
2194 | if (!wacom->battery && | 2193 | if (!wacom->battery && |
2195 | !(features->quirks & WACOM_QUIRK_BATTERY)) { | 2194 | !(features->quirks & WACOM_QUIRK_BATTERY)) { |
2196 | features->quirks |= WACOM_QUIRK_BATTERY; | 2195 | features->quirks |= WACOM_QUIRK_BATTERY; |
2197 | INIT_WORK(&wacom->work, wacom_battery_work); | 2196 | wacom_schedule_work(wacom_wac, WACOM_WORKER_BATTERY); |
2198 | wacom_schedule_work(wacom_wac); | ||
2199 | } | 2197 | } |
2200 | } | 2198 | } |
2201 | else if ((features->quirks & WACOM_QUIRK_BATTERY) && | 2199 | else if ((features->quirks & WACOM_QUIRK_BATTERY) && |
2202 | wacom->battery) { | 2200 | wacom->battery) { |
2203 | features->quirks &= ~WACOM_QUIRK_BATTERY; | 2201 | features->quirks &= ~WACOM_QUIRK_BATTERY; |
2204 | INIT_WORK(&wacom->work, wacom_battery_work); | 2202 | wacom_schedule_work(wacom_wac, WACOM_WORKER_BATTERY); |
2205 | wacom_schedule_work(wacom_wac); | ||
2206 | wacom_notify_battery(wacom_wac, 0, 0, 0, 0); | 2203 | wacom_notify_battery(wacom_wac, 0, 0, 0, 0); |
2207 | } | 2204 | } |
2208 | return 0; | 2205 | return 0; |