Skip to content

Commit

Permalink
HID: move to_hid_device() to hid.h
Browse files Browse the repository at this point in the history
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 <geliangtang@163.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Geliang Tang authored and Jiri Kosina committed Dec 28, 2015
1 parent 0b1804e commit d8ce9bf
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 0 additions & 2 deletions drivers/hid/hid-lg4ff.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
#include "hid-lg4ff.h"
#include "hid-ids.h"

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

#define LG4FF_MMODE_IS_MULTIMODE 0
#define LG4FF_MMODE_SWITCHED 1
#define LG4FF_MMODE_NOT_MULTIMODE 2
Expand Down
2 changes: 0 additions & 2 deletions drivers/hid/hid-logitech-hidpp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1310,8 +1310,6 @@ struct g920_private_data {
u16 range;
};

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

static ssize_t g920_range_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
Expand Down
3 changes: 3 additions & 0 deletions include/linux/hid.h
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,9 @@ struct hid_device { /* device report descriptor */
wait_queue_head_t debug_wait;
};

#define to_hid_device(pdev) \
container_of(pdev, struct hid_device, dev)

static inline void *hid_get_drvdata(struct hid_device *hdev)
{
return dev_get_drvdata(&hdev->dev);
Expand Down

0 comments on commit d8ce9bf

Please sign in to comment.