From d6ab770ec852ed3a096a47c443e7dd585cd9a137 Mon Sep 17 00:00:00 2001 From: Ondra Havel Date: Mon, 2 Apr 2012 00:18:35 +0200 Subject: [PATCH] linux kernel style adjustations --- README | 9 --------- hanvon.c | 21 ++++----------------- 2 files changed, 4 insertions(+), 26 deletions(-) diff --git a/README b/README index 3fac028..28c6380 100644 --- a/README +++ b/README @@ -25,15 +25,6 @@ insmod ./hanvon.ko If everything goes right the tablet should start working immediately. -Diagnostics -=========== - -After insmod, check with dmesg, if the module was loaded properly. -"USB Hanvon tablet driver" should appear in the listing. - -lsmod should also contain hanvon in its listing: lsmod | grep hanvon - - Revision history ================ diff --git a/hanvon.c b/hanvon.c index 1ad0c02..5128aa5 100644 --- a/hanvon.c +++ b/hanvon.c @@ -4,7 +4,6 @@ #include #include -#define DRIVER_VERSION "0.4b" #define DRIVER_AUTHOR "Ondra Havel " #define DRIVER_DESC "USB Hanvon tablet driver" #define DRIVER_LICENSE "GPL" @@ -136,14 +135,14 @@ MODULE_DEVICE_TABLE(usb, hanvon_ids); static int hanvon_open(struct input_dev *dev) { - int ret = 0; struct hanvon *hanvon = input_get_drvdata(dev); hanvon->old_wheel_pos = -AM_WHEEL_THRESHOLD-1; hanvon->irq->dev = hanvon->usbdev; if (usb_submit_urb(hanvon->irq, GFP_KERNEL)) - ret = -EIO; - return ret; + return -EIO; + + return 0; } static void hanvon_close(struct input_dev *dev) @@ -258,16 +257,4 @@ static struct usb_driver hanvon_driver = { .id_table = hanvon_ids, }; -static int __init hanvon_init(void) -{ - printk(DRIVER_DESC " " DRIVER_VERSION "\n"); - return usb_register(&hanvon_driver); -} - -static void __exit hanvon_exit(void) -{ - usb_deregister(&hanvon_driver); -} - -module_init(hanvon_init); -module_exit(hanvon_exit); +module_usb_driver(hanvon_driver);