2 * Berkshire USB-PC Watchdog Card Driver
4 * (c) Copyright 2004 Wim Van Sebroeck <wim@iguana.be>.
6 * Based on source code of the following authors:
7 * Ken Hollis <kenji@bitgate.com>,
8 * Alan Cox <alan@redhat.com>,
9 * Matt Domsch <Matt_Domsch@dell.com>,
10 * Rob Radez <rob@osinvestor.com>,
11 * Greg Kroah-Hartman <greg@kroah.com>
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version
16 * 2 of the License, or (at your option) any later version.
18 * Neither Wim Van Sebroeck nor Iguana vzw. admit liability nor
19 * provide warranty for any of this software. This material is
20 * provided "AS-IS" and at no charge.
22 * Thanks also to Simon Machell at Berkshire Products Inc. for
23 * providing the test hardware. More info is available at
24 * http://www.berkprod.com/ or http://www.pcwatchdog.com/
27 #include <linux/config.h>
28 #include <linux/kernel.h>
29 #include <linux/errno.h>
30 #include <linux/init.h>
31 #include <linux/slab.h>
32 #include <linux/module.h>
33 #include <linux/moduleparam.h>
34 #include <linux/types.h>
35 #include <linux/delay.h>
36 #include <linux/miscdevice.h>
37 #include <linux/watchdog.h>
38 #include <linux/notifier.h>
39 #include <linux/reboot.h>
41 #include <linux/smp_lock.h>
42 #include <linux/completion.h>
43 #include <asm/uaccess.h>
44 #include <linux/usb.h>
47 #ifdef CONFIG_USB_DEBUG
53 /* Use our own dbg macro */
55 #define dbg(format, arg...) do { if (debug) printk(KERN_DEBUG PFX format "\n" , ## arg); } while (0)
58 /* Module and Version Information */
59 #define DRIVER_VERSION "v1.00 (28/02/2004)"
60 #define DRIVER_AUTHOR "Wim Van Sebroeck <wim@iguana.be>"
61 #define DRIVER_DESC "Berkshire USB-PC Watchdog driver"
62 #define DRIVER_LICENSE "GPL"
63 #define DRIVER_NAME "pcwd_usb"
64 #define PFX DRIVER_NAME ": "
66 MODULE_AUTHOR(DRIVER_AUTHOR);
67 MODULE_DESCRIPTION(DRIVER_DESC);
68 MODULE_LICENSE(DRIVER_LICENSE);
69 MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
70 MODULE_ALIAS_MISCDEV(TEMP_MINOR);
72 /* Module Parameters */
73 module_param(debug, int, 0);
74 MODULE_PARM_DESC(debug, "Debug enabled or not");
76 #define WATCHDOG_HEARTBEAT 2 /* 2 sec default heartbeat */
77 static int heartbeat = WATCHDOG_HEARTBEAT;
78 module_param(heartbeat, int, 0);
79 MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (0<heartbeat<65536, default=" __MODULE_STRING(WATCHDOG_HEARTBEAT) ")");
81 #ifdef CONFIG_WATCHDOG_NOWAYOUT
82 static int nowayout = 1;
84 static int nowayout = 0;
87 module_param(nowayout, int, 0);
88 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
90 /* The vendor and product id's for the USB-PC Watchdog card */
91 #define USB_PCWD_VENDOR_ID 0x0c98
92 #define USB_PCWD_PRODUCT_ID 0x1140
94 /* table of devices that work with this driver */
95 static struct usb_device_id usb_pcwd_table [] = {
96 { USB_DEVICE(USB_PCWD_VENDOR_ID, USB_PCWD_PRODUCT_ID) },
97 { } /* Terminating entry */
99 MODULE_DEVICE_TABLE (usb, usb_pcwd_table);
101 /* according to documentation max. time to process a command for the USB
102 * watchdog card is 100 or 200 ms, so we give it 250 ms to do it's job */
103 #define USB_COMMAND_TIMEOUT 250
105 /* Watchdog's internal commands */
106 #define CMD_READ_TEMP 0x02 /* Read Temperature; Re-trigger Watchdog */
107 #define CMD_TRIGGER CMD_READ_TEMP
108 #define CMD_GET_STATUS 0x04 /* Get Status Information */
109 #define CMD_GET_FIRMWARE_VERSION 0x08 /* Get Firmware Version */
110 #define CMD_GET_DIP_SWITCH_SETTINGS 0x0c /* Get Dip Switch Settings */
111 #define CMD_READ_WATCHDOG_TIMEOUT 0x18 /* Read Current Watchdog Time */
112 #define CMD_WRITE_WATCHDOG_TIMEOUT 0x19 /* Write Current Watchdog Time */
113 #define CMD_ENABLE_WATCHDOG 0x30 /* Enable / Disable Watchdog */
114 #define CMD_DISABLE_WATCHDOG CMD_ENABLE_WATCHDOG
116 /* Some defines that I like to be somewhere else like include/linux/usb_hid.h */
117 #define HID_REQ_SET_REPORT 0x09
118 #define HID_DT_REPORT (USB_TYPE_CLASS | 0x02)
120 /* We can only use 1 card due to the /dev/watchdog restriction */
121 static int cards_found;
123 /* some internal variables */
124 static unsigned long is_active;
125 static char expect_release;
127 /* Structure to hold all of our device specific stuff */
128 struct usb_pcwd_private {
129 struct usb_device * udev; /* save off the usb device pointer */
130 struct usb_interface * interface; /* the interface for this device */
132 unsigned int interface_number; /* the interface number used for cmd's */
134 unsigned char * intr_buffer; /* the buffer to intr data */
135 dma_addr_t intr_dma; /* the dma address for the intr buffer */
136 size_t intr_size; /* the size of the intr buffer */
137 struct urb * intr_urb; /* the urb used for the intr pipe */
139 unsigned char cmd_command; /* The command that is reported back */
140 unsigned char cmd_data_msb; /* The data MSB that is reported back */
141 unsigned char cmd_data_lsb; /* The data LSB that is reported back */
142 atomic_t cmd_received; /* true if we received a report after a command */
144 int exists; /* Wether or not the device exists */
145 struct semaphore sem; /* locks this structure */
147 static struct usb_pcwd_private *usb_pcwd_device;
149 /* prevent races between open() and disconnect() */
150 static DECLARE_MUTEX (disconnect_sem);
152 /* local function prototypes */
153 static int usb_pcwd_probe (struct usb_interface *interface, const struct usb_device_id *id);
154 static void usb_pcwd_disconnect (struct usb_interface *interface);
156 /* usb specific object needed to register this driver with the usb subsystem */
157 static struct usb_driver usb_pcwd_driver = {
158 .owner = THIS_MODULE,
160 .probe = usb_pcwd_probe,
161 .disconnect = usb_pcwd_disconnect,
162 .id_table = usb_pcwd_table,
166 static void usb_pcwd_intr_done(struct urb *urb, struct pt_regs *regs)
168 struct usb_pcwd_private *usb_pcwd = (struct usb_pcwd_private *)urb->context;
169 unsigned char *data = usb_pcwd->intr_buffer;
172 switch (urb->status) {
173 case 0: /* success */
175 case -ECONNRESET: /* unlink */
178 /* this urb is terminated, clean up */
179 dbg("%s - urb shutting down with status: %d", __FUNCTION__, urb->status);
181 /* -EPIPE: should clear the halt */
183 dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status);
187 dbg("received following data cmd=0x%02x msb=0x%02x lsb=0x%02x",
188 data[0], data[1], data[2]);
190 usb_pcwd->cmd_command = data[0];
191 usb_pcwd->cmd_data_msb = data[1];
192 usb_pcwd->cmd_data_lsb = data[2];
194 /* notify anyone waiting that the cmd has finished */
195 atomic_set (&usb_pcwd->cmd_received, 1);
198 retval = usb_submit_urb (urb, GFP_ATOMIC);
200 printk(KERN_ERR PFX "can't resubmit intr, usb_submit_urb failed with result %d\n",
204 static int usb_pcwd_send_command(struct usb_pcwd_private *usb_pcwd, unsigned char cmd,
205 unsigned char *msb, unsigned char *lsb)
207 int got_response, count;
208 unsigned char buf[6];
210 /* We will not send any commands if the USB PCWD device does not exist */
211 if ((!usb_pcwd) || (!usb_pcwd->exists))
214 /* The USB PC Watchdog uses a 6 byte report format. The board currently uses
215 * only 3 of the six bytes of the report. */
216 buf[0] = cmd; /* Byte 0 = CMD */
217 buf[1] = *msb; /* Byte 1 = Data MSB */
218 buf[2] = *lsb; /* Byte 2 = Data LSB */
219 buf[3] = buf[4] = buf[5] = 0; /* All other bytes not used */
221 dbg("sending following data cmd=0x%02x msb=0x%02x lsb=0x%02x",
222 buf[0], buf[1], buf[2]);
224 atomic_set (&usb_pcwd->cmd_received, 0);
226 if (usb_control_msg(usb_pcwd->udev, usb_sndctrlpipe(usb_pcwd->udev, 0),
227 HID_REQ_SET_REPORT, HID_DT_REPORT,
228 0x0200, usb_pcwd->interface_number, buf, sizeof(buf),
229 HZ) != sizeof(buf)) {
230 dbg("usb_pcwd_send_command: error in usb_control_msg for cmd 0x%x 0x%x 0x%x\n", cmd, *msb, *lsb);
232 /* wait till the usb card processed the command,
233 * with a max. timeout of USB_COMMAND_TIMEOUT */
235 for (count = 0; (count < USB_COMMAND_TIMEOUT) && (!got_response); count++) {
237 if (atomic_read (&usb_pcwd->cmd_received))
241 if ((got_response) && (cmd == usb_pcwd->cmd_command)) {
242 /* read back response */
243 *msb = usb_pcwd->cmd_data_msb;
244 *lsb = usb_pcwd->cmd_data_lsb;
250 static int usb_pcwd_start(struct usb_pcwd_private *usb_pcwd)
252 unsigned char msb = 0x00;
253 unsigned char lsb = 0x00;
256 /* Enable Watchdog */
257 retval = usb_pcwd_send_command(usb_pcwd, CMD_ENABLE_WATCHDOG, &msb, &lsb);
259 if ((retval == 0) || (lsb == 0)) {
260 printk(KERN_ERR PFX "Card did not acknowledge enable attempt\n");
267 static int usb_pcwd_stop(struct usb_pcwd_private *usb_pcwd)
269 unsigned char msb = 0xA5;
270 unsigned char lsb = 0xC3;
273 /* Disable Watchdog */
274 retval = usb_pcwd_send_command(usb_pcwd, CMD_DISABLE_WATCHDOG, &msb, &lsb);
276 if ((retval == 0) || (lsb != 0)) {
277 printk(KERN_ERR PFX "Card did not acknowledge disable attempt\n");
284 static int usb_pcwd_keepalive(struct usb_pcwd_private *usb_pcwd)
288 /* Re-trigger Watchdog */
289 usb_pcwd_send_command(usb_pcwd, CMD_TRIGGER, &dummy, &dummy);
294 static int usb_pcwd_set_heartbeat(struct usb_pcwd_private *usb_pcwd, int t)
296 unsigned char msb = t / 256;
297 unsigned char lsb = t % 256;
299 if ((t < 0x0001) || (t > 0xFFFF))
302 /* Write new heartbeat to watchdog */
303 usb_pcwd_send_command(usb_pcwd, CMD_WRITE_WATCHDOG_TIMEOUT, &msb, &lsb);
309 static int usb_pcwd_get_temperature(struct usb_pcwd_private *usb_pcwd, int *temperature)
311 unsigned char msb, lsb;
313 usb_pcwd_send_command(usb_pcwd, CMD_READ_TEMP, &msb, &lsb);
316 * Convert celsius to fahrenheit, since this was
317 * the decided 'standard' for this return value.
319 *temperature = (lsb * 9 / 5) + 32;
325 * /dev/watchdog handling
328 static ssize_t usb_pcwd_write(struct file *file, const char *data,
329 size_t len, loff_t *ppos)
331 /* Can't seek (pwrite) on this device */
332 if (ppos != &file->f_pos)
335 /* See if we got the magic character 'V' and reload the timer */
340 /* note: just in case someone wrote the magic character
341 * five months ago... */
344 /* scan to see whether or not we got the magic character */
345 for (i = 0; i != len; i++) {
347 if(get_user(c, data+i))
354 /* someone wrote to us, we should reload the timer */
355 usb_pcwd_keepalive(usb_pcwd_device);
360 static int usb_pcwd_ioctl(struct inode *inode, struct file *file,
361 unsigned int cmd, unsigned long arg)
363 static struct watchdog_info ident = {
364 .options = WDIOF_KEEPALIVEPING |
367 .firmware_version = 1,
368 .identity = DRIVER_NAME,
372 case WDIOC_GETSUPPORT:
373 return copy_to_user((struct watchdog_info *) arg, &ident,
374 sizeof (ident)) ? -EFAULT : 0;
376 case WDIOC_GETSTATUS:
377 case WDIOC_GETBOOTSTATUS:
378 return put_user(0, (int *) arg);
384 if (usb_pcwd_get_temperature(usb_pcwd_device, &temperature))
387 return put_user(temperature, (int *) arg);
390 case WDIOC_KEEPALIVE:
391 usb_pcwd_keepalive(usb_pcwd_device);
394 case WDIOC_SETOPTIONS:
396 int new_options, retval = -EINVAL;
398 if (get_user (new_options, (int *) arg))
401 if (new_options & WDIOS_DISABLECARD) {
402 usb_pcwd_stop(usb_pcwd_device);
406 if (new_options & WDIOS_ENABLECARD) {
407 usb_pcwd_start(usb_pcwd_device);
414 case WDIOC_SETTIMEOUT:
418 if (get_user(new_heartbeat, (int *) arg))
421 if (usb_pcwd_set_heartbeat(usb_pcwd_device, new_heartbeat))
424 usb_pcwd_keepalive(usb_pcwd_device);
428 case WDIOC_GETTIMEOUT:
429 return put_user(heartbeat, (int *)arg);
436 static int usb_pcwd_open(struct inode *inode, struct file *file)
438 /* /dev/watchdog can only be opened once */
439 if (test_and_set_bit(0, &is_active))
443 usb_pcwd_start(usb_pcwd_device);
444 usb_pcwd_keepalive(usb_pcwd_device);
448 static int usb_pcwd_release(struct inode *inode, struct file *file)
451 * Shut off the timer.
453 if (expect_release == 42) {
454 usb_pcwd_stop(usb_pcwd_device);
456 printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
457 usb_pcwd_keepalive(usb_pcwd_device);
459 clear_bit(0, &is_active);
465 * /dev/temperature handling
468 static ssize_t usb_pcwd_temperature_read(struct file *file, char *data,
469 size_t len, loff_t *ppos)
473 /* Can't seek (pwrite) on this device */
474 if (ppos != &file->f_pos)
477 if (usb_pcwd_get_temperature(usb_pcwd_device, &temperature))
480 if (copy_to_user (data, &temperature, 1))
486 static int usb_pcwd_temperature_open(struct inode *inode, struct file *file)
491 static int usb_pcwd_temperature_release(struct inode *inode, struct file *file)
500 static int usb_pcwd_notify_sys(struct notifier_block *this, unsigned long code, void *unused)
502 if (code==SYS_DOWN || code==SYS_HALT) {
503 /* Turn the WDT off */
504 usb_pcwd_stop(usb_pcwd_device);
514 static struct file_operations usb_pcwd_fops = {
515 .owner = THIS_MODULE,
517 .write = usb_pcwd_write,
518 .ioctl = usb_pcwd_ioctl,
519 .open = usb_pcwd_open,
520 .release = usb_pcwd_release,
523 static struct miscdevice usb_pcwd_miscdev = {
524 .minor = WATCHDOG_MINOR,
526 .fops = &usb_pcwd_fops,
529 static struct file_operations usb_pcwd_temperature_fops = {
530 .owner = THIS_MODULE,
532 .read = usb_pcwd_temperature_read,
533 .open = usb_pcwd_temperature_open,
534 .release = usb_pcwd_temperature_release,
537 static struct miscdevice usb_pcwd_temperature_miscdev = {
539 .name = "temperature",
540 .fops = &usb_pcwd_temperature_fops,
543 static struct notifier_block usb_pcwd_notifier = {
544 .notifier_call = usb_pcwd_notify_sys,
550 static inline void usb_pcwd_delete (struct usb_pcwd_private *usb_pcwd)
552 if (usb_pcwd->intr_urb != NULL)
553 usb_free_urb (usb_pcwd->intr_urb);
554 if (usb_pcwd->intr_buffer != NULL)
555 usb_buffer_free(usb_pcwd->udev, usb_pcwd->intr_size,
556 usb_pcwd->intr_buffer, usb_pcwd->intr_dma);
563 * Called by the usb core when a new device is connected that it thinks
564 * this driver might be interested in.
566 static int usb_pcwd_probe(struct usb_interface *interface, const struct usb_device_id *id)
568 struct usb_device *udev = interface_to_usbdev(interface);
569 struct usb_host_interface *iface_desc;
570 struct usb_endpoint_descriptor *endpoint;
571 struct usb_pcwd_private *usb_pcwd = NULL;
573 int retval = -ENOMEM;
575 unsigned char fw_rev_major, fw_rev_minor;
577 unsigned char option_switches, dummy;
579 /* See if the device offered us matches what we can accept */
580 if ((udev->descriptor.idVendor != USB_PCWD_VENDOR_ID) ||
581 (udev->descriptor.idProduct != USB_PCWD_PRODUCT_ID)) {
586 if (cards_found > 1) {
587 printk(KERN_ERR PFX "This driver only supports 1 device\n");
591 /* get the active interface descriptor */
592 iface_desc = interface->cur_altsetting;
594 /* check out that we have a HID device */
595 if (!(iface_desc->desc.bInterfaceClass == USB_CLASS_HID)) {
596 printk(KERN_ERR PFX "The device isn't a Human Interface Device\n");
600 /* check out the endpoint: it has to be Interrupt & IN */
601 endpoint = &iface_desc->endpoint[0].desc;
603 if (!((endpoint->bEndpointAddress & USB_DIR_IN) &&
604 ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
605 == USB_ENDPOINT_XFER_INT))) {
606 /* we didn't find a Interrupt endpoint with direction IN */
607 printk(KERN_ERR PFX "Couldn't find an INTR & IN endpoint\n");
611 /* get a handle to the interrupt data pipe */
612 pipe = usb_rcvintpipe(udev, endpoint->bEndpointAddress);
613 maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe));
615 /* allocate memory for our device and initialize it */
616 usb_pcwd = kmalloc (sizeof(struct usb_pcwd_private), GFP_KERNEL);
617 if (usb_pcwd == NULL) {
618 printk(KERN_ERR PFX "Out of memory\n");
621 memset (usb_pcwd, 0x00, sizeof (*usb_pcwd));
623 usb_pcwd_device = usb_pcwd;
625 init_MUTEX (&usb_pcwd->sem);
626 usb_pcwd->udev = udev;
627 usb_pcwd->interface = interface;
628 usb_pcwd->interface_number = iface_desc->desc.bInterfaceNumber;
629 usb_pcwd->intr_size = (endpoint->wMaxPacketSize > 8 ? endpoint->wMaxPacketSize : 8);
631 /* set up the memory buffer's */
632 if (!(usb_pcwd->intr_buffer = usb_buffer_alloc(udev, usb_pcwd->intr_size, SLAB_ATOMIC, &usb_pcwd->intr_dma))) {
633 printk(KERN_ERR PFX "Out of memory\n");
637 /* allocate the urb's */
638 usb_pcwd->intr_urb = usb_alloc_urb(0, GFP_KERNEL);
639 if (!usb_pcwd->intr_urb) {
640 printk(KERN_ERR PFX "Out of memory\n");
644 /* initialise the intr urb's */
645 usb_fill_int_urb(usb_pcwd->intr_urb, udev, pipe,
646 usb_pcwd->intr_buffer, usb_pcwd->intr_size,
647 usb_pcwd_intr_done, usb_pcwd, endpoint->bInterval);
648 usb_pcwd->intr_urb->transfer_dma = usb_pcwd->intr_dma;
649 usb_pcwd->intr_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
651 /* register our interrupt URB with the USB system */
652 if (usb_submit_urb(usb_pcwd->intr_urb, GFP_KERNEL)) {
653 printk(KERN_ERR PFX "Problem registering interrupt URB\n");
654 retval = -EIO; /* failure */
658 /* The device exists and can be communicated with */
659 usb_pcwd->exists = 1;
662 usb_pcwd_stop(usb_pcwd);
664 /* Get the Firmware Version */
665 got_fw_rev = usb_pcwd_send_command(usb_pcwd, CMD_GET_FIRMWARE_VERSION, &fw_rev_major, &fw_rev_minor);
667 sprintf(fw_ver_str, "%u.%02u", fw_rev_major, fw_rev_minor);
669 sprintf(fw_ver_str, "<card no answer>");
672 printk(KERN_INFO PFX "Found card (Firmware: %s) with temp option\n",
675 /* Get switch settings */
676 usb_pcwd_send_command(usb_pcwd, CMD_GET_DIP_SWITCH_SETTINGS, &dummy, &option_switches);
678 printk(KERN_INFO PFX "Option switches (0x%02x): Temperature Reset Enable=%s, Power On Delay=%s\n",
680 ((option_switches & 0x10) ? "ON" : "OFF"),
681 ((option_switches & 0x08) ? "ON" : "OFF"));
683 /* Check that the heartbeat value is within it's range ; if not reset to the default */
684 if (heartbeat < 1 || heartbeat > 0xFFFF) {
685 heartbeat = WATCHDOG_HEARTBEAT;
686 printk(KERN_INFO PFX "heartbeat value must be 0<heartbeat<65536, using %d\n",
690 /* Calculate the watchdog's heartbeat */
691 usb_pcwd_set_heartbeat(usb_pcwd, heartbeat);
693 retval = register_reboot_notifier(&usb_pcwd_notifier);
695 printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
700 retval = misc_register(&usb_pcwd_miscdev);
702 printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
703 WATCHDOG_MINOR, retval);
704 goto err_out_unregister_reboot;
707 retval = misc_register(&usb_pcwd_temperature_miscdev);
709 printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
711 goto err_out_misc_deregister;
714 /* we can register the device now, as it is ready */
715 usb_set_intfdata (interface, usb_pcwd);
717 printk(KERN_INFO PFX "initialized. heartbeat=%d sec (nowayout=%d)\n",
718 heartbeat, nowayout);
722 err_out_misc_deregister:
723 misc_deregister(&usb_pcwd_miscdev);
724 err_out_unregister_reboot:
725 unregister_reboot_notifier(&usb_pcwd_notifier);
727 usb_pcwd_delete (usb_pcwd);
728 usb_pcwd_device = NULL;
734 * usb_pcwd_disconnect
736 * Called by the usb core when the device is removed from the system.
738 * This routine guarantees that the driver will not submit any more urbs
739 * by clearing dev->udev.
741 static void usb_pcwd_disconnect(struct usb_interface *interface)
743 struct usb_pcwd_private *usb_pcwd;
745 /* prevent races with open() */
746 down (&disconnect_sem);
748 usb_pcwd = usb_get_intfdata (interface);
749 usb_set_intfdata (interface, NULL);
751 down (&usb_pcwd->sem);
753 /* Stop the timer before we leave */
755 usb_pcwd_stop(usb_pcwd);
757 /* We should now stop communicating with the USB PCWD device */
758 usb_pcwd->exists = 0;
761 misc_deregister(&usb_pcwd_temperature_miscdev);
762 misc_deregister(&usb_pcwd_miscdev);
763 unregister_reboot_notifier(&usb_pcwd_notifier);
767 /* Delete the USB PCWD device */
768 usb_pcwd_delete(usb_pcwd);
772 up (&disconnect_sem);
774 printk(KERN_INFO PFX "USB PC Watchdog disconnected\n");
782 static int __init usb_pcwd_init(void)
786 /* register this driver with the USB subsystem */
787 result = usb_register(&usb_pcwd_driver);
789 printk(KERN_ERR PFX "usb_register failed. Error number %d\n",
794 printk(KERN_INFO PFX DRIVER_DESC " " DRIVER_VERSION "\n");
802 static void __exit usb_pcwd_exit(void)
804 /* deregister this driver with the USB subsystem */
805 usb_deregister(&usb_pcwd_driver);
809 module_init (usb_pcwd_init);
810 module_exit (usb_pcwd_exit);