diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-04-19 04:00:00 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-04-19 04:00:00 +0000 |
commit | 46e045034336a2cc90c1798cd7cc07af744ddfd6 (patch) | |
tree | 3b9b51fc482e729f663d25333e77fbed9aaa939a /drivers/usb/mdc800.c | |
parent | 31dc59d503a02e84c4de98826452acaeb56dc15a (diff) |
Merge with Linux 2.3.99-pre4.
Diffstat (limited to 'drivers/usb/mdc800.c')
-rw-r--r-- | drivers/usb/mdc800.c | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/drivers/usb/mdc800.c b/drivers/usb/mdc800.c index c8063c927..a45f8c798 100644 --- a/drivers/usb/mdc800.c +++ b/drivers/usb/mdc800.c @@ -26,11 +26,19 @@ * To use the Camera you must support the USB Protocoll of the camera * to the Kernel Node. * The Driver uses a misc device Node. Create it with : - * mknod /dev/mustek c 10 171 + * mknod /dev/mustek c 180 32 * * The driver supports only one camera. * * version 0.7.1 + * MOD_INC and MOD_DEC are changed in usb_probe to prevent load/unload + * problems when compiled as Module. + * (04/04/2000) + * + * The mdc800 driver gets assigned the USB Minor 32-47. The Registration + * was updated to use these values. + * (26/03/2000) + * * The Init und Exit Module Function are updated. * (01/03/2000) * @@ -57,7 +65,6 @@ #include <linux/signal.h> #include <linux/spinlock.h> #include <linux/errno.h> -#include <linux/miscdevice.h> #include <linux/random.h> #include <linux/poll.h> #include <linux/init.h> @@ -67,22 +74,22 @@ #include <linux/usb.h> #define VERSION "0.7.1" -#define RELEASE_DATE "(01/03/2000)" +#define RELEASE_DATE "(26/03/2000)" /* Vendor and Product Information */ #define MDC800_VENDOR_ID 0x055f #define MDC800_PRODUCT_ID 0xa800 /* Timeouts (msec) */ -#define TO_READ_FROM_IRQ 4000 +#define TO_READ_FROM_IRQ 4000 #define TO_GET_READY 2000 -#define TO_DOWNLOAD_GET_READY 1500 -#define TO_DOWNLOAD_GET_BUSY 1500 -#define TO_WRITE_GET_READY 3000 -#define TO_DEFAULT_COMMAND 5000 +#define TO_DOWNLOAD_GET_READY 1500 +#define TO_DOWNLOAD_GET_BUSY 1500 +#define TO_WRITE_GET_READY 3000 +#define TO_DEFAULT_COMMAND 5000 -/* Minor Number of the device (create with mknod /dev/mustek c 10 171) */ -#define MDC800_DEVICE_MINOR 171 +/* Minor Number of the device (create with mknod /dev/mustek c 180 32) */ +#define MDC800_DEVICE_MINOR_BASE 32 /************************************************************************** @@ -514,11 +521,20 @@ static int mdc800_getAnswerSize (char command) static int mdc800_device_open (struct inode* inode, struct file *file) { int retval=0; + + MOD_INC_USE_COUNT; + if (mdc800->state == NOT_CONNECTED) + { + MOD_DEC_USE_COUNT; return -EBUSY; + } if (mdc800->open) + { + MOD_DEC_USE_COUNT; return -EBUSY; + } mdc800->rw_lock=0; mdc800->in_count=0; @@ -535,10 +551,10 @@ static int mdc800_device_open (struct inode* inode, struct file *file) if (usb_submit_urb (mdc800->irq_urb)) { err ("request USB irq fails (submit_retval=%i urb_status=%i).",retval, mdc800->irq_urb->status); + MOD_DEC_USE_COUNT; return -EIO; } - MOD_INC_USE_COUNT; mdc800->open=1; dbg ("Mustek MDC800 device opened."); @@ -792,21 +808,6 @@ static ssize_t mdc800_device_write (struct file *file, const char *buf, size_t l Init and Cleanup this driver (Structs and types) ****************************************************************************/ - -/* - * USB Driver Struct for this device - */ -static struct usb_driver mdc800_usb_driver = -{ - "mdc800", - mdc800_usb_probe, - mdc800_usb_disconnect, - { 0,0 }, - 0, - 0 -}; - - /* File Operations of this drivers */ static struct file_operations mdc800_device_ops = { @@ -828,17 +829,22 @@ static struct file_operations mdc800_device_ops = }; + /* - * The Misc Device Configuration Struct + * USB Driver Struct for this device */ -static struct miscdevice mdc800_device = +static struct usb_driver mdc800_usb_driver = { - MDC800_DEVICE_MINOR, - "USB Mustek MDC800 Camera", - &mdc800_device_ops + "mdc800", + mdc800_usb_probe, + mdc800_usb_disconnect, + { 0,0 }, + &mdc800_device_ops, + MDC800_DEVICE_MINOR_BASE }; + /************************************************************************ Init and Cleanup this driver (Main Functions) *************************************************************************/ @@ -872,8 +878,6 @@ int __init usb_mdc800_init (void) /* Register the driver */ if (usb_register (&mdc800_usb_driver) < 0) goto cleanup_on_fail; - if (misc_register (&mdc800_device) < 0) - goto cleanup_on_misc_register_fail; info ("Mustek Digital Camera Driver " VERSION " (MDC800)"); info (RELEASE_DATE " Henning Zabel <henning@uni-paderborn.de>"); @@ -882,9 +886,6 @@ int __init usb_mdc800_init (void) /* Clean driver up, when something fails */ -cleanup_on_misc_register_fail: - usb_deregister (&mdc800_usb_driver); - cleanup_on_fail: if (mdc800 != 0) @@ -909,7 +910,6 @@ cleanup_on_fail: void __exit usb_mdc800_cleanup (void) { usb_deregister (&mdc800_usb_driver); - misc_deregister (&mdc800_device); usb_free_urb (mdc800->irq_urb); usb_free_urb (mdc800->download_urb); |