Thread (9 messages) 9 messages, 2 authors, 2012-02-06

Re: [PATCH 1/5] Input: wacom - isolate input registration

flat view

From: Wanlong Gao <hidden>
Date: 2012-02-06 04:00:15

On 02/06/2012 10:46 AM, chris@cnpbagwell.com wrote:
quoted hunk ↗ jump to hunk
From: Chris Bagwell <redacted>

Although this better co-locates input registration logic,
the main goal is to make it easier to optionally create
input devices or delay creation to later time periods.

Signed-off-by: Chris Bagwell <redacted>
---
 drivers/input/tablet/wacom_sys.c |   53 +++++++++++++++++++++++--------------
 1 files changed, 33 insertions(+), 20 deletions(-)
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index c9588ee..43e82e9 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -822,6 +822,37 @@ static void wacom_destroy_leds(struct wacom *wacom)
 	}
 }
 
+static int wacom_register_input(struct wacom *wacom)
+{
+	struct input_dev *input_dev;
+	struct usb_interface *intf = wacom->intf;
+	struct usb_device *dev = interface_to_usbdev(intf);
+	struct wacom_wac *wacom_wac = &(wacom->wacom_wac);
+	int error;
+
+	input_dev = input_allocate_device();
+	if (!input_dev)
+		return -ENOMEM;
+
+	input_dev->name = wacom_wac->name;
+	input_dev->dev.parent = &intf->dev;
+	input_dev->open = wacom_open;
+	input_dev->close = wacom_close;
+	usb_to_input_id(dev, &input_dev->id);
+	input_set_drvdata(input_dev, wacom);
+
+	wacom_wac->input = input_dev;
+	wacom_setup_input_capabilities(input_dev, wacom_wac);
+
+	error = input_register_device(input_dev);
+	if (error) {
+		input_free_device(input_dev);
+		wacom_wac->input =  0;
				  ^^^
spare space here. and better use NULL?

Thanks
-Wanlong Gao
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help