Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1298333

[PATCH 1/5] HID: move to_hid_device() to hid.h

From Geliang Tang <geliangtang@163.com>
Newsgroups linux.kernel
Subject [PATCH 1/5] HID: move to_hid_device() to hid.h
Date 2015-12-27 10:30 +0100
Message-ID <qKfOh-52f-5@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 drivers/hid/hid-lg4ff.c          | 2 --
 drivers/hid/hid-logitech-hidpp.c | 2 --
 include/linux/hid.h              | 3 +++
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c
index fbddcb3..3e160ff 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 f2a4811..bd2ab476 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 a6d7a3f..1472026 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);
-- 
2.5.0


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/5] HID: move to_hid_device() to hid.h Geliang Tang <geliangtang@163.com> - 2015-12-27 10:30 +0100
  [PATCH 5/5] HID: use kobj_to_dev() Geliang Tang <geliangtang@163.com> - 2015-12-27 10:30 +0100
  [PATCH 3/5] HID: add a new helper to_hid_driver() Geliang Tang <geliangtang@163.com> - 2015-12-27 10:30 +0100
  [PATCH 2/5] HID: use to_hid_device() Geliang Tang <geliangtang@163.com> - 2015-12-27 10:30 +0100
  Re: [PATCH 1/5] HID: move to_hid_device() to hid.h Jiri Kosina <jikos@kernel.org> - 2015-12-28 13:50 +0100

csiph-web