Skip to content

Commit ed806fd

Browse files
Lawstorantgregkh
authored andcommitted
HID: pidff: Add hid_pidff_init_with_quirks and export as GPL symbol
[ Upstream commit 36de016 ] This lays out a way to provide an initial set of quirks to enable before device initialization takes place. GPL symbol export needed for the possibility of building HID drivers which use this function as modules. Adding a wrapper function to ensure compatibility with the old behavior of hid_pidff_init. Signed-off-by: Tomasz Pakuła <[email protected]> Reviewed-by: Michał Kopeć <[email protected]> Reviewed-by: Paul Dino Jones <[email protected]> Tested-by: Paul Dino Jones <[email protected]> Tested-by: Cristóferson Bueno <[email protected]> Tested-by: Pablo Cisneros <[email protected]> Signed-off-by: Jiri Kosina <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 6a20fae commit ed806fd

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

drivers/hid/usbhid/hid-pidff.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1268,8 +1268,9 @@ static int pidff_check_autocenter(struct pidff_device *pidff,
12681268

12691269
/*
12701270
* Check if the device is PID and initialize it
1271+
* Set initial quirks
12711272
*/
1272-
int hid_pidff_init(struct hid_device *hid)
1273+
int hid_pidff_init_with_quirks(struct hid_device *hid, __u32 initial_quirks)
12731274
{
12741275
struct pidff_device *pidff;
12751276
struct hid_input *hidinput = list_entry(hid->inputs.next,
@@ -1291,6 +1292,7 @@ int hid_pidff_init(struct hid_device *hid)
12911292
return -ENOMEM;
12921293

12931294
pidff->hid = hid;
1295+
pidff->quirks = initial_quirks;
12941296

12951297
hid_device_io_start(hid);
12961298

@@ -1369,3 +1371,14 @@ int hid_pidff_init(struct hid_device *hid)
13691371
kfree(pidff);
13701372
return error;
13711373
}
1374+
EXPORT_SYMBOL_GPL(hid_pidff_init_with_quirks);
1375+
1376+
/*
1377+
* Check if the device is PID and initialize it
1378+
* Wrapper made to keep the compatibility with old
1379+
* init function
1380+
*/
1381+
int hid_pidff_init(struct hid_device *hid)
1382+
{
1383+
return hid_pidff_init_with_quirks(hid, 0);
1384+
}

include/linux/hid.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,8 +1223,10 @@ void hid_quirks_exit(__u16 bus);
12231223

12241224
#ifdef CONFIG_HID_PID
12251225
int hid_pidff_init(struct hid_device *hid);
1226+
int hid_pidff_init_with_quirks(struct hid_device *hid, __u32 initial_quirks);
12261227
#else
12271228
#define hid_pidff_init NULL
1229+
#define hid_pidff_init_with_quirks NULL
12281230
#endif
12291231

12301232
/* HID PIDFF quirks */

0 commit comments

Comments
 (0)