Skip to content

Commit 36de016

Browse files
LawstorantJiri Kosina
authored andcommitted
HID: pidff: Add hid_pidff_init_with_quirks and export as GPL symbol
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 <tomasz.pakula.oficjalny@gmail.com> Reviewed-by: Michał Kopeć <michal@nozomi.space> Reviewed-by: Paul Dino Jones <paul@spacefreak18.xyz> Tested-by: Paul Dino Jones <paul@spacefreak18.xyz> Tested-by: Cristóferson Bueno <cbueno81@gmail.com> Tested-by: Pablo Cisneros <patchkez@protonmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
1 parent a411910 commit 36de016

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

drivers/hid/usbhid/hid-pidff.c

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

12821282
/*
12831283
* Check if the device is PID and initialize it
1284+
* Set initial quirks
12841285
*/
1285-
int hid_pidff_init(struct hid_device *hid)
1286+
int hid_pidff_init_with_quirks(struct hid_device *hid, __u32 initial_quirks)
12861287
{
12871288
struct pidff_device *pidff;
12881289
struct hid_input *hidinput = list_entry(hid->inputs.next,
@@ -1304,6 +1305,7 @@ int hid_pidff_init(struct hid_device *hid)
13041305
return -ENOMEM;
13051306

13061307
pidff->hid = hid;
1308+
pidff->quirks = initial_quirks;
13071309

13081310
hid_device_io_start(hid);
13091311

@@ -1382,3 +1384,14 @@ int hid_pidff_init(struct hid_device *hid)
13821384
kfree(pidff);
13831385
return error;
13841386
}
1387+
EXPORT_SYMBOL_GPL(hid_pidff_init_with_quirks);
1388+
1389+
/*
1390+
* Check if the device is PID and initialize it
1391+
* Wrapper made to keep the compatibility with old
1392+
* init function
1393+
*/
1394+
int hid_pidff_init(struct hid_device *hid)
1395+
{
1396+
return hid_pidff_init_with_quirks(hid, 0);
1397+
}

include/linux/hid.h

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

12251225
#ifdef CONFIG_HID_PID
12261226
int hid_pidff_init(struct hid_device *hid);
1227+
int hid_pidff_init_with_quirks(struct hid_device *hid, __u32 initial_quirks);
12271228
#else
12281229
#define hid_pidff_init NULL
1230+
#define hid_pidff_init_with_quirks NULL
12291231
#endif
12301232

12311233
/* HID PIDFF quirks */

0 commit comments

Comments
 (0)