Skip to content

Commit 9f8b483

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
Pull HID fixes from Jiri Kosina: - fix for ordering of device removal actions in hidraw, by Fernando Luis Vázquez Cao - fix for uninitialized workqueue usage in hid-sony, by Frank Praznik - device ID addition for new variant of Logitech G27, from Simon Wood * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: HID: hid-lg4ff: Support new version of G27 HID: hidraw: fix warning destroying hidraw device files after parent HID: sony: Fix work queue issues.
2 parents dcb99fd + 6b5625b commit 9f8b483

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

drivers/hid/hid-lg4ff.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#define G25_REV_MIN 0x22
4444
#define G27_REV_MAJ 0x12
4545
#define G27_REV_MIN 0x38
46+
#define G27_2_REV_MIN 0x39
4647

4748
#define to_hid_device(pdev) container_of(pdev, struct hid_device, dev)
4849

@@ -130,6 +131,7 @@ static const struct lg4ff_usb_revision lg4ff_revs[] = {
130131
{DFP_REV_MAJ, DFP_REV_MIN, &native_dfp}, /* Driving Force Pro */
131132
{G25_REV_MAJ, G25_REV_MIN, &native_g25}, /* G25 */
132133
{G27_REV_MAJ, G27_REV_MIN, &native_g27}, /* G27 */
134+
{G27_REV_MAJ, G27_2_REV_MIN, &native_g27}, /* G27 v2 */
133135
};
134136

135137
/* Recalculates X axis value accordingly to currently selected range */

drivers/hid/hid-sony.c

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#define DUALSHOCK4_CONTROLLER_BT BIT(6)
4343

4444
#define SONY_LED_SUPPORT (SIXAXIS_CONTROLLER_USB | BUZZ_CONTROLLER | DUALSHOCK4_CONTROLLER_USB)
45+
#define SONY_FF_SUPPORT (SIXAXIS_CONTROLLER_USB | DUALSHOCK4_CONTROLLER_USB)
4546

4647
#define MAX_LEDS 4
4748

@@ -499,6 +500,7 @@ struct sony_sc {
499500
__u8 right;
500501
#endif
501502

503+
__u8 worker_initialized;
502504
__u8 led_state[MAX_LEDS];
503505
__u8 led_count;
504506
};
@@ -993,22 +995,11 @@ static int sony_init_ff(struct hid_device *hdev)
993995
return input_ff_create_memless(input_dev, NULL, sony_play_effect);
994996
}
995997

996-
static void sony_destroy_ff(struct hid_device *hdev)
997-
{
998-
struct sony_sc *sc = hid_get_drvdata(hdev);
999-
1000-
cancel_work_sync(&sc->state_worker);
1001-
}
1002-
1003998
#else
1004999
static int sony_init_ff(struct hid_device *hdev)
10051000
{
10061001
return 0;
10071002
}
1008-
1009-
static void sony_destroy_ff(struct hid_device *hdev)
1010-
{
1011-
}
10121003
#endif
10131004

10141005
static int sony_set_output_report(struct sony_sc *sc, int req_id, int req_size)
@@ -1077,6 +1068,8 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
10771068
if (sc->quirks & SIXAXIS_CONTROLLER_USB) {
10781069
hdev->hid_output_raw_report = sixaxis_usb_output_raw_report;
10791070
ret = sixaxis_set_operational_usb(hdev);
1071+
1072+
sc->worker_initialized = 1;
10801073
INIT_WORK(&sc->state_worker, sixaxis_state_worker);
10811074
}
10821075
else if (sc->quirks & SIXAXIS_CONTROLLER_BT)
@@ -1087,6 +1080,7 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
10871080
if (ret < 0)
10881081
goto err_stop;
10891082

1083+
sc->worker_initialized = 1;
10901084
INIT_WORK(&sc->state_worker, dualshock4_state_worker);
10911085
} else {
10921086
ret = 0;
@@ -1101,9 +1095,11 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
11011095
goto err_stop;
11021096
}
11031097

1104-
ret = sony_init_ff(hdev);
1105-
if (ret < 0)
1106-
goto err_stop;
1098+
if (sc->quirks & SONY_FF_SUPPORT) {
1099+
ret = sony_init_ff(hdev);
1100+
if (ret < 0)
1101+
goto err_stop;
1102+
}
11071103

11081104
return 0;
11091105
err_stop:
@@ -1120,7 +1116,8 @@ static void sony_remove(struct hid_device *hdev)
11201116
if (sc->quirks & SONY_LED_SUPPORT)
11211117
sony_leds_remove(hdev);
11221118

1123-
sony_destroy_ff(hdev);
1119+
if (sc->worker_initialized)
1120+
cancel_work_sync(&sc->state_worker);
11241121

11251122
hid_hw_stop(hdev);
11261123
}

drivers/hid/hidraw.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,13 +320,13 @@ static void drop_ref(struct hidraw *hidraw, int exists_bit)
320320
hid_hw_close(hidraw->hid);
321321
wake_up_interruptible(&hidraw->wait);
322322
}
323+
device_destroy(hidraw_class,
324+
MKDEV(hidraw_major, hidraw->minor));
323325
} else {
324326
--hidraw->open;
325327
}
326328
if (!hidraw->open) {
327329
if (!hidraw->exist) {
328-
device_destroy(hidraw_class,
329-
MKDEV(hidraw_major, hidraw->minor));
330330
hidraw_table[hidraw->minor] = NULL;
331331
kfree(hidraw);
332332
} else {

0 commit comments

Comments
 (0)