Skip to content

Commit 0d24d4b

Browse files
LawstorantJiri Kosina
authored andcommitted
HID: pidff: Move all hid-pidff definitions to a dedicated header
Do not clutter hid includes with stuff not needed outside of the kernel. 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 22a0546 commit 0d24d4b

File tree

5 files changed

+38
-17
lines changed

5 files changed

+38
-17
lines changed

drivers/hid/hid-universal-pidff.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/module.h>
1414
#include <linux/input-event-codes.h>
1515
#include "hid-ids.h"
16+
#include "usbhid/hid-pidff.h"
1617

1718
#define JOY_RANGE (BTN_DEAD - BTN_JOYSTICK + 1)
1819

@@ -89,7 +90,7 @@ static int universal_pidff_probe(struct hid_device *hdev,
8990
}
9091

9192
/* Check if HID_PID support is enabled */
92-
int (*init_function)(struct hid_device *, __u32);
93+
int (*init_function)(struct hid_device *, u32);
9394
init_function = hid_pidff_init_with_quirks;
9495

9596
if (!init_function) {

drivers/hid/usbhid/hid-core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include <linux/hid-debug.h>
3636
#include <linux/hidraw.h>
3737
#include "usbhid.h"
38+
#include "hid-pidff.h"
3839

3940
/*
4041
* Version Information

drivers/hid/usbhid/hid-pidff.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
1414

15+
#include "hid-pidff.h"
1516
#include <linux/input.h>
1617
#include <linux/slab.h>
1718
#include <linux/usb.h>
@@ -1383,7 +1384,7 @@ static int pidff_check_autocenter(struct pidff_device *pidff,
13831384
* Check if the device is PID and initialize it
13841385
* Set initial quirks
13851386
*/
1386-
int hid_pidff_init_with_quirks(struct hid_device *hid, __u32 initial_quirks)
1387+
int hid_pidff_init_with_quirks(struct hid_device *hid, u32 initial_quirks)
13871388
{
13881389
struct pidff_device *pidff;
13891390
struct hid_input *hidinput = list_entry(hid->inputs.next,

drivers/hid/usbhid/hid-pidff.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/* SPDX-License-Identifier: GPL-2.0-or-later */
2+
#ifndef __HID_PIDFF_H
3+
#define __HID_PIDFF_H
4+
5+
#include <linux/hid.h>
6+
7+
/* HID PIDFF quirks */
8+
9+
/* Delay field (0xA7) missing. Skip it during set effect report upload */
10+
#define HID_PIDFF_QUIRK_MISSING_DELAY BIT(0)
11+
12+
/* Missing Paramter block offset (0x23). Skip it during SET_CONDITION
13+
report upload */
14+
#define HID_PIDFF_QUIRK_MISSING_PBO BIT(1)
15+
16+
/* Initialise device control field even if logical_minimum != 1 */
17+
#define HID_PIDFF_QUIRK_PERMISSIVE_CONTROL BIT(2)
18+
19+
/* Use fixed 0x4000 direction during SET_EFFECT report upload */
20+
#define HID_PIDFF_QUIRK_FIX_WHEEL_DIRECTION BIT(3)
21+
22+
/* Force all periodic effects to be uploaded as SINE */
23+
#define HID_PIDFF_QUIRK_PERIODIC_SINE_ONLY BIT(4)
24+
25+
#ifdef CONFIG_HID_PID
26+
int hid_pidff_init(struct hid_device *hid);
27+
int hid_pidff_init_with_quirks(struct hid_device *hid, u32 initial_quirks);
28+
#else
29+
#define hid_pidff_init NULL
30+
#define hid_pidff_init_with_quirks NULL
31+
#endif
32+
33+
#endif

include/linux/hid.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,21 +1222,6 @@ unsigned long hid_lookup_quirk(const struct hid_device *hdev);
12221222
int hid_quirks_init(char **quirks_param, __u16 bus, int count);
12231223
void hid_quirks_exit(__u16 bus);
12241224

1225-
#ifdef CONFIG_HID_PID
1226-
int hid_pidff_init(struct hid_device *hid);
1227-
int hid_pidff_init_with_quirks(struct hid_device *hid, __u32 initial_quirks);
1228-
#else
1229-
#define hid_pidff_init NULL
1230-
#define hid_pidff_init_with_quirks NULL
1231-
#endif
1232-
1233-
/* HID PIDFF quirks */
1234-
#define HID_PIDFF_QUIRK_MISSING_DELAY BIT(0)
1235-
#define HID_PIDFF_QUIRK_MISSING_PBO BIT(1)
1236-
#define HID_PIDFF_QUIRK_PERMISSIVE_CONTROL BIT(2)
1237-
#define HID_PIDFF_QUIRK_FIX_WHEEL_DIRECTION BIT(3)
1238-
#define HID_PIDFF_QUIRK_PERIODIC_SINE_ONLY BIT(4)
1239-
12401225
#define dbg_hid(fmt, ...) pr_debug("%s: " fmt, __FILE__, ##__VA_ARGS__)
12411226

12421227
#define hid_err(hid, fmt, ...) \

0 commit comments

Comments
 (0)