X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Finput%2Fevbug.c;h=0353601ac3b575e9a7e968387ec22d10fb88c04e;hb=ef0e3c26efe9c52de62b96fdad94de3ed70489d0;hp=07358fb51b82aacf8e7cb1b9fbe9f2cc943eb455;hpb=e44e20ff1273cf96c7f195297208f654c49295cf;p=linux-2.6-omap-h63xx.git diff --git a/drivers/input/evbug.c b/drivers/input/evbug.c index 07358fb51b8..0353601ac3b 100644 --- a/drivers/input/evbug.c +++ b/drivers/input/evbug.c @@ -1,6 +1,4 @@ /* - * $Id: evbug.c,v 1.10 2001/09/25 10:12:07 vojtech Exp $ - * * Copyright (c) 1999-2001 Vojtech Pavlik */ @@ -38,41 +36,59 @@ MODULE_AUTHOR("Vojtech Pavlik "); 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); + printk(KERN_DEBUG "evbug.c: Event. Dev: %s, Type: %d, Code: %d, Value: %d\n", + handle->dev->dev.bus_id, type, code, value); } -static struct input_handle *evbug_connect(struct input_handler *handler, struct input_dev *dev, 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; + + error = input_open_device(handle); + if (error) + goto err_unregister_handle; - input_open_device(handle); + printk(KERN_DEBUG "evbug.c: Connected device: %s (%s at %s)\n", + dev->dev.bus_id, + dev->name ?: "unknown", + dev->phys ?: "unknown"); - printk(KERN_DEBUG "evbug.c: Connected device: \"%s\", %s\n", dev->name, dev->phys); + return 0; - return handle; + 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); + printk(KERN_DEBUG "evbug.c: Disconnected device: %s\n", + handle->dev->dev.bus_id); input_close_device(handle); - + input_unregister_handle(handle); kfree(handle); } -static struct input_device_id evbug_ids[] = { +static const struct input_device_id evbug_ids[] = { { .driver_info = 1 }, /* Matches all devices */ { }, /* Terminating zero entry */ }; @@ -89,8 +105,7 @@ static struct input_handler evbug_handler = { static int __init evbug_init(void) { - input_register_handler(&evbug_handler); - return 0; + return input_register_handler(&evbug_handler); } static void __exit evbug_exit(void)