[PATCH 3/5 #2] HID: move zeroplus FF processing

Previous thread: Re: [RFC][Resend] Make NFS-Client readahead tunable by Martin Knoblauch on Thursday, September 18, 2008 - 2:32 am. (1 message)

Next thread: none
From: Jiri Slaby
Date: Thursday, September 18, 2008 - 3:23 am

Move the force feedback processing into a separate module.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
 drivers/hid/Kconfig             |   16 +++
 drivers/hid/Makefile            |    1 +
 drivers/hid/hid-core.c          |    2 +
 drivers/hid/hid-dummy.c         |    3 +
 drivers/hid/hid-ids.h           |    2 +
 drivers/hid/hid-pl.c            |  205 +++++++++++++++++++++++++++++++++++++++
 drivers/hid/usbhid/Kconfig      |    8 --
 drivers/hid/usbhid/Makefile     |    3 -
 drivers/hid/usbhid/hid-ff.c     |    4 -
 drivers/hid/usbhid/hid-plff.c   |  139 --------------------------
 drivers/hid/usbhid/hid-quirks.c |    1 -
 include/linux/hid.h             |    1 -
 12 files changed, 229 insertions(+), 156 deletions(-)
 create mode 100644 drivers/hid/hid-pl.c
 delete mode 100644 drivers/hid/usbhid/hid-plff.c

diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 46337a2..7220e6f 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -199,6 +199,22 @@ config HID_MONTEREY
 	---help---
 	Support for Monterey Genius KB29E.
 
+config HID_PANTHERLORD
+	tristate "Pantherlord"
+	default m
+	depends on USB_HID
+	---help---
+	Support for PantherLord/GreenAsia based device support (including
+	force feedback).
+
+config PANTHERLORD_FF
+	bool "Force feedback support"
+	depends on HID_PANTHERLORD
+	select INPUT_FF_MEMLESS
+	help
+	  Say Y here if you have a PantherLord/GreenAsia based game controller
+	  or adapter and want to enable force feedback support for it.
+
 config HID_PETALYNX
 	tristate "Petalynx"
 	default m
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index 300ee00..e607068 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -32,6 +32,7 @@ obj-$(CONFIG_HID_GYRATION)	+= hid-gyration.o
 obj-$(CONFIG_HID_LOGITECH)	+= hid-logitech.o
 obj-$(CONFIG_HID_MICROSOFT)	+= hid-microsoft.o
 obj-$(CONFIG_HID_MONTEREY)	+= hid-monterey.o
+obj-$(CONFIG_HID_PANTHERLORD)	+= hid-pl.o
 obj-$(CONFIG_HID_PETALYNX)	+= ...
From: Jiri Slaby
Date: Thursday, September 18, 2008 - 3:23 am

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
 drivers/hid/Kconfig           |    9 ++
 drivers/hid/Makefile          |    1 +
 drivers/hid/hid-core.c        |    4 +
 drivers/hid/hid-dummy.c       |    3 +
 drivers/hid/hid-ids.h         |    2 +
 drivers/hid/hid-tmff.c        |  267 +++++++++++++++++++++++++++++++++++++++++
 drivers/hid/usbhid/Kconfig    |   11 --
 drivers/hid/usbhid/Makefile   |    3 -
 drivers/hid/usbhid/hid-ff.c   |    6 -
 drivers/hid/usbhid/hid-tmff.c |  225 ----------------------------------
 include/linux/hid.h           |    1 -
 11 files changed, 286 insertions(+), 246 deletions(-)
 create mode 100644 drivers/hid/hid-tmff.c
 delete mode 100644 drivers/hid/usbhid/hid-tmff.c

diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 7220e6f..268fcd1 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -243,6 +243,15 @@ config HID_SUNPLUS
 	---help---
 	Support for Sunplus WDesktop input device.
 
+config THRUSTMASTER_FF
+	tristate "ThrustMaster devices support"
+	default m
+	depends on USB_HID
+	select INPUT_FF_MEMLESS
+	help
+	  Say Y here if you have a THRUSTMASTER FireStore Dual Power 2 or
+	  a THRUSTMASTER Ferrari GT Rumble Force or Force Feedback Wheel.
+
 endmenu
 
 endif # HID_SUPPORT
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index e607068..9bd6daf 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -37,6 +37,7 @@ obj-$(CONFIG_HID_PETALYNX)	+= hid-petalynx.o
 obj-$(CONFIG_HID_SAMSUNG)	+= hid-samsung.o
 obj-$(CONFIG_HID_SONY)		+= hid-sony.o
 obj-$(CONFIG_HID_SUNPLUS)	+= hid-sunplus.o
+obj-$(CONFIG_THRUSTMASTER_FF)	+= hid-tmff.o
 
 obj-$(CONFIG_USB_HID)		+= usbhid/
 obj-$(CONFIG_USB_MOUSE)		+= usbhid/
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 48a76e7..b0996ff 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1516,6 +1516,10 @@ static const struct hid_device_id hid_ignore_list[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, ...
From: Jiri Slaby
Date: Thursday, September 18, 2008 - 3:23 am

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
 drivers/hid/Kconfig           |    8 ++
 drivers/hid/Makefile          |    1 +
 drivers/hid/hid-core.c        |    2 +
 drivers/hid/hid-dummy.c       |    3 +
 drivers/hid/hid-ids.h         |    2 +
 drivers/hid/hid-zpff.c        |  162 +++++++++++++++++++++++++++++++++++++++++
 drivers/hid/usbhid/Kconfig    |    8 --
 drivers/hid/usbhid/Makefile   |    3 -
 drivers/hid/usbhid/hid-ff.c   |    4 -
 drivers/hid/usbhid/hid-zpff.c |  107 ---------------------------
 include/linux/hid.h           |    1 -
 11 files changed, 178 insertions(+), 123 deletions(-)
 create mode 100644 drivers/hid/hid-zpff.c
 delete mode 100644 drivers/hid/usbhid/hid-zpff.c

diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 268fcd1..e4d5263 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -252,6 +252,14 @@ config THRUSTMASTER_FF
 	  Say Y here if you have a THRUSTMASTER FireStore Dual Power 2 or
 	  a THRUSTMASTER Ferrari GT Rumble Force or Force Feedback Wheel.
 
+config ZEROPLUS_FF
+	tristate "Zeroplus based game controller support"
+	default m
+	depends on USB_HID
+	select INPUT_FF_MEMLESS
+	help
+	  Say Y here if you have a Zeroplus based game controller.
+
 endmenu
 
 endif # HID_SUPPORT
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index 9bd6daf..767f295 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -38,6 +38,7 @@ obj-$(CONFIG_HID_SAMSUNG)	+= hid-samsung.o
 obj-$(CONFIG_HID_SONY)		+= hid-sony.o
 obj-$(CONFIG_HID_SUNPLUS)	+= hid-sunplus.o
 obj-$(CONFIG_THRUSTMASTER_FF)	+= hid-tmff.o
+obj-$(CONFIG_ZEROPLUS_FF)	+= hid-zpff.o
 
 obj-$(CONFIG_USB_HID)		+= usbhid/
 obj-$(CONFIG_USB_MOUSE)		+= usbhid/
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index b0996ff..5a23077 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1530,6 +1530,8 @@ static const struct hid_device_id hid_ignore_list[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, ...
From: Jiri Slaby
Date: Thursday, September 18, 2008 - 3:23 am

hid-ff.c now calls only pidff (generic driver), the special ones are now
in separate drivers. Invoke pidff on all non-special directly.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
 drivers/hid/usbhid/Kconfig    |   13 --------
 drivers/hid/usbhid/Makefile   |    3 --
 drivers/hid/usbhid/hid-core.c |    2 +-
 drivers/hid/usbhid/hid-ff.c   |   69 -----------------------------------------
 include/linux/hid.h           |    9 +-----
 5 files changed, 2 insertions(+), 94 deletions(-)
 delete mode 100644 drivers/hid/usbhid/hid-ff.c

diff --git a/drivers/hid/usbhid/Kconfig b/drivers/hid/usbhid/Kconfig
index 3cfc076..5d9aa95 100644
--- a/drivers/hid/usbhid/Kconfig
+++ b/drivers/hid/usbhid/Kconfig
@@ -24,21 +24,8 @@ config USB_HID
 comment "Input core support is needed for USB HID input layer or HIDBP support"
 	depends on USB_HID && INPUT=n
 
-config HID_FF
-	bool "Force feedback support (EXPERIMENTAL)"
-	depends on USB_HID && EXPERIMENTAL
-	help
-	  Say Y here is you want force feedback support for a few HID devices.
-	  See below for a list of supported devices.
-
-	  See <file:Documentation/input/ff.txt> for a description of the force
-	  feedback API.
-
-	  If unsure, say N.
-
 config HID_PID
 	bool "PID device support"
-	depends on HID_FF
 	help
 	  Say Y here if you have a PID-compliant device and wish to enable force
 	  feedback for it. Microsoft Sidewinder Force Feedback 2 is one of such
diff --git a/drivers/hid/usbhid/Makefile b/drivers/hid/usbhid/Makefile
index 5c460fc..1329ecb 100644
--- a/drivers/hid/usbhid/Makefile
+++ b/drivers/hid/usbhid/Makefile
@@ -13,9 +13,6 @@ endif
 ifeq ($(CONFIG_HID_PID),y)
 	usbhid-objs	+= hid-pidff.o
 endif
-ifeq ($(CONFIG_HID_FF),y)
-	usbhid-objs	+= hid-ff.o
-endif
 
 obj-$(CONFIG_USB_HID)		+= usbhid.o
 obj-$(CONFIG_USB_KBD)		+= usbkbd.o
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 4ec10aa..07840df 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ ...
From: Jiri Slaby
Date: Thursday, September 18, 2008 - 3:23 am

Since we have a real device bound to a driver, we may use struct
device for printing. Use dev_* functions instead of printks in
4 drivers.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
 drivers/hid/hid-lg2ff.c |    8 ++++----
 drivers/hid/hid-pl.c    |   11 ++++++-----
 drivers/hid/hid-tmff.c  |   26 ++++++++++++++------------
 drivers/hid/hid-zpff.c  |    6 +++---
 4 files changed, 27 insertions(+), 24 deletions(-)

diff --git a/drivers/hid/hid-lg2ff.c b/drivers/hid/hid-lg2ff.c
index b2e9a67..4e6dc6e 100644
--- a/drivers/hid/hid-lg2ff.c
+++ b/drivers/hid/hid-lg2ff.c
@@ -71,18 +71,18 @@ int lg2ff_init(struct hid_device *hid)
 	int error;
 
 	if (list_empty(report_list)) {
-		printk(KERN_ERR "hid-lg2ff: no output report found\n");
+		dev_err(&hid->dev, "no output report found\n");
 		return -ENODEV;
 	}
 
 	report = list_entry(report_list->next, struct hid_report, list);
 
 	if (report->maxfield < 1) {
-		printk(KERN_ERR "hid-lg2ff: output report is empty\n");
+		dev_err(&hid->dev, "output report is empty\n");
 		return -ENODEV;
 	}
 	if (report->field[0]->report_count < 7) {
-		printk(KERN_ERR "hid-lg2ff: not enough values in the field\n");
+		dev_err(&hid->dev, "not enough values in the field\n");
 		return -ENODEV;
 	}
 
@@ -109,7 +109,7 @@ int lg2ff_init(struct hid_device *hid)
 
 	usbhid_submit_report(hid, report, USB_DIR_OUT);
 
-	printk(KERN_INFO "Force feedback for Logitech Rumblepad 2 by "
+	dev_info(&hid->dev, "Force feedback for Logitech Rumblepad 2 by "
 	       "Anssi Hannula <anssi.hannula@gmail.com>\n");
 
 	return 0;
diff --git a/drivers/hid/hid-pl.c b/drivers/hid/hid-pl.c
index b450084..682cac1 100644
--- a/drivers/hid/hid-pl.c
+++ b/drivers/hid/hid-pl.c
@@ -90,7 +90,7 @@ static int plff_init(struct hid_device *hid)
 	   currently unknown. */
 
 	if (list_empty(report_list)) {
-		printk(KERN_ERR "hid-plff: no output reports found\n");
+		dev_err(&hid->dev, "no output reports found\n");
 		return -ENODEV;
 	}
 
@@ -99,18 +99,19 ...
From: Jiri Kosina
Date: Thursday, September 18, 2008 - 10:29 am

This comment is a little bit misleading -- it says that 
CONFIG_HID_PANTHERLORD includes force feedback support, but you have to 

Also, mentioning "Pantherlord" here might make things more clear, this way 
it looks like this enables generic force feedback.

I will fix that up in the patchset, if you don't mind, and apply.

-- 
Jiri Kosina
SUSE Labs
--

Previous thread: Re: [RFC][Resend] Make NFS-Client readahead tunable by Martin Knoblauch on Thursday, September 18, 2008 - 2:32 am. (1 message)

Next thread: none