From: Geliang Tang Date: Sun, 27 Dec 2015 09:25:20 +0000 (+0800) Subject: HID: move to_hid_device() to hid.h X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=d8ce9bf5551bfea431893bdd0a943f24a5170828;p=openwrt%2Fstaging%2Fblogic.git 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 Signed-off-by: Jiri Kosina --- diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c index fbddcb37ae98..3e160ff5f218 100644 --- a/drivers/hid/hid-lg4ff.c +++ b/drivers/hid/hid-lg4ff.c @@ -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 diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c index f2a481125522..bd2ab476c65e 100644 --- a/drivers/hid/hid-logitech-hidpp.c +++ b/drivers/hid/hid-logitech-hidpp.c @@ -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) { diff --git a/include/linux/hid.h b/include/linux/hid.h index a6d7a3fc2cb3..1472026367ed 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -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);