Skip to content

Commit d8ce9bf

Browse files
geliangtangJiri Kosina
authored andcommitted
HID: move to_hid_device() to hid.h
to_hid_device() macro is defined in both hid-lg4ff.c and hid-logitech-hidpp.c. So I move it to include/linux/hid.h. Signed-off-by: Geliang Tang <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 0b1804e commit d8ce9bf

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

drivers/hid/hid-lg4ff.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
#include "hid-lg4ff.h"
3434
#include "hid-ids.h"
3535

36-
#define to_hid_device(pdev) container_of(pdev, struct hid_device, dev)
37-
3836
#define LG4FF_MMODE_IS_MULTIMODE 0
3937
#define LG4FF_MMODE_SWITCHED 1
4038
#define LG4FF_MMODE_NOT_MULTIMODE 2

drivers/hid/hid-logitech-hidpp.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,8 +1310,6 @@ struct g920_private_data {
13101310
u16 range;
13111311
};
13121312

1313-
#define to_hid_device(pdev) container_of(pdev, struct hid_device, dev)
1314-
13151313
static ssize_t g920_range_show(struct device *dev, struct device_attribute *attr,
13161314
char *buf)
13171315
{

include/linux/hid.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,9 @@ struct hid_device { /* device report descriptor */
565565
wait_queue_head_t debug_wait;
566566
};
567567

568+
#define to_hid_device(pdev) \
569+
container_of(pdev, struct hid_device, dev)
570+
568571
static inline void *hid_get_drvdata(struct hid_device *hdev)
569572
{
570573
return dev_get_drvdata(&hdev->dev);

0 commit comments

Comments
 (0)