forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- consolidate code for binding handlers to a device - return error codes from handlers connect() methods back to input core and log failures Signed-off-by: Dmitry Torokhov <[email protected]>
- Loading branch information
Dmitry Torokhov
committed
Apr 12, 2007
1 parent
6e78258
commit 5b2a082
Showing
9 changed files
with
288 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,39 +38,51 @@ MODULE_AUTHOR("Vojtech Pavlik <[email protected]>"); | |
MODULE_DESCRIPTION("Input driver event debug module"); | ||
MODULE_LICENSE("GPL"); | ||
|
||
static char evbug_name[] = "evbug"; | ||
|
||
static void evbug_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) | ||
{ | ||
printk(KERN_DEBUG "evbug.c: Event. Dev: %s, Type: %d, Code: %d, Value: %d\n", | ||
handle->dev->phys, type, code, value); | ||
} | ||
|
||
static struct input_handle *evbug_connect(struct input_handler *handler, struct input_dev *dev, | ||
const struct input_device_id *id) | ||
static int evbug_connect(struct input_handler *handler, struct input_dev *dev, | ||
const struct input_device_id *id) | ||
{ | ||
struct input_handle *handle; | ||
int error; | ||
|
||
if (!(handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL))) | ||
return NULL; | ||
handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL); | ||
if (!handle) | ||
return -ENOMEM; | ||
|
||
handle->dev = dev; | ||
handle->handler = handler; | ||
handle->name = evbug_name; | ||
handle->name = "evbug"; | ||
|
||
error = input_register_handle(handle); | ||
if (error) | ||
goto err_free_handle; | ||
|
||
input_open_device(handle); | ||
error = input_open_device(handle); | ||
if (error) | ||
goto err_unregister_handle; | ||
|
||
printk(KERN_DEBUG "evbug.c: Connected device: \"%s\", %s\n", dev->name, dev->phys); | ||
|
||
return handle; | ||
return 0; | ||
|
||
err_unregister_handle: | ||
input_unregister_handle(handle); | ||
err_free_handle: | ||
kfree(handle); | ||
return error; | ||
} | ||
|
||
static void evbug_disconnect(struct input_handle *handle) | ||
{ | ||
printk(KERN_DEBUG "evbug.c: Disconnected device: %s\n", handle->dev->phys); | ||
|
||
input_close_device(handle); | ||
|
||
input_unregister_handle(handle); | ||
kfree(handle); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.