Commit a07335eb authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge kroah.com:/home/greg/linux/BK/bleed-2.5

into kroah.com:/home/greg/linux/BK/gregkh-2.6
parents 6cf73674 caa6e213
...@@ -111,12 +111,12 @@ ...@@ -111,12 +111,12 @@
</para> </para>
<programlisting> <programlisting>
static struct usb_driver skel_driver = { static struct usb_driver skel_driver = {
name: "skeleton", .name = "skeleton",
probe: skel_probe, .probe = skel_probe,
disconnect: skel_disconnect, .disconnect = skel_disconnect,
fops: &amp;skel_fops, .fops = &amp;skel_fops,
minor: USB_SKEL_MINOR_BASE, .minor = USB_SKEL_MINOR_BASE,
id_table: skel_table, .id_table = skel_table,
}; };
</programlisting> </programlisting>
<para> <para>
...@@ -202,41 +202,21 @@ MODULE_DEVICE_TABLE (usb, skel_table); ...@@ -202,41 +202,21 @@ MODULE_DEVICE_TABLE (usb, skel_table);
are passed to the function: are passed to the function:
</para> </para>
<programlisting> <programlisting>
static void * skel_probe(struct usb_device *dev, static int skel_probe(struct usb_interface *interface,
unsigned int ifnum, const struct usb_device_id *id) const struct usb_device_id *id)
</programlisting> </programlisting>
<para> <para>
The driver now needs to verify that this device is actually one that it The driver now needs to verify that this device is actually one that it
can accept. If not, or if any error occurs during initialization, a NULL can accept. If so, it returns 0.
value is returned from the probe function. Otherwise a pointer to a If not, or if any error occurs during initialization, an errorcode
private data structure containing the driver's state for this device is (such as <literal>-ENOMEM<literal> or <literal>-ENODEV<literal>)
returned. That pointer is stored in the usb_device structure, and all is returned from the probe function.
callbacks to the driver pass that pointer.
</para> </para>
<para> <para>
In the skeleton driver, we determine what end points are marked as bulk-in In the skeleton driver, we determine what end points are marked as bulk-in
and bulk-out. We create buffers to hold the data that will be sent and and bulk-out. We create buffers to hold the data that will be sent and
received from the device, and a USB urb to write data to the device is received from the device, and a USB urb to write data to the device is
initialized. Also, we register the device with the devfs subsystem, initialized.
allowing users of devfs to access our device. That registration looks like
the following:
</para>
<programlisting>
/* initialize the devfs node for this device and register it */
sprintf(name, &quot;skel%d&quot;, skel->minor);
skel->devfs = devfs_register (usb_devfs_handle,
name,
DEVFS_FL_DEFAULT,
USB_MAJOR,
USB_SKEL_MINOR_BASE + skel->minor,
S_IFCHR | S_IRUSR | S_IWUSR |
S_IRGRP | S_IWGRP | S_IROTH,
&amp;skel_fops,
NULL);
</programlisting>
<para>
If the devfs_register function fails, we do not care, as the devfs
subsystem will report this to the user.
</para> </para>
<para> <para>
Conversely, when the device is removed from the USB bus, the disconnect Conversely, when the device is removed from the USB bus, the disconnect
...@@ -254,23 +234,18 @@ devfs_unregister(skel->devfs); ...@@ -254,23 +234,18 @@ devfs_unregister(skel->devfs);
the device, any of the functions in the file_operations structure that the device, any of the functions in the file_operations structure that
were passed to the USB subsystem will be called from a user program trying were passed to the USB subsystem will be called from a user program trying
to talk to the device. The first function called will be open, as the to talk to the device. The first function called will be open, as the
program tries to open the device for I/O. Within the skeleton driver's program tries to open the device for I/O. We increment our private usage
open function we increment the driver's usage count if it is a module with
a call to MODULE_INC_USE_COUNT. With this macro call, if the driver is
compiled as a module, the driver cannot be unloaded until a corresponding
MODULE_DEC_USE_COUNT macro is called. We also increment our private usage
count and save off a pointer to our internal structure in the file count and save off a pointer to our internal structure in the file
structure. This is done so that future calls to file operations will structure. This is done so that future calls to file operations will
enable the driver to determine which device the user is addressing. All of enable the driver to determine which device the user is addressing. All
this is done with the following code: of this is done with the following code:
</para> </para>
<programlisting> <programlisting>
/* increment our usage count for the module */ /* increment our usage count for the module */
MOD_INC_USE_COUNT;
++skel->open_count; ++skel->open_count;
/* save our object in the file's private structure */ /* save our object in the file's private structure */
file->private_data = skel; file->private_data = dev;
</programlisting> </programlisting>
<para> <para>
After the open function is called, the read and write functions are called After the open function is called, the read and write functions are called
...@@ -349,75 +324,47 @@ if (!retval) { ...@@ -349,75 +324,47 @@ if (!retval) {
</para> </para>
<para> <para>
When the user program releases the file handle that it has been using to When the user program releases the file handle that it has been using to
talk to the device, the release function in the driver is called. In this talk to the device, the release function in the driver is called. In this
function we decrement the module usage count with a call to function we decrement our private usage count and wait for possible
MOD_DEC_USE_COUNT (to match our previous call to MOD_INC_USE_COUNT). We pending writes:
also determine if there are any other programs that are currently talking
to the device (a device may be opened by more than one program at one
time). If this is the last user of the device, then we shut down any
possible pending writes that might be currently occurring. This is all
done with:
</para>
<programlisting> <programlisting>
/* decrement our usage count for the device */ /* decrement our usage count for the device */
--skel->open_count; --skel->open_count;
if (skel->open_count &lt;= 0) {
/* shutdown any bulk writes that might be going on */
usb_unlink_urb (skel->write_urb);
skel->open_count = 0;
}
/* decrement our usage count for the module */
MOD_DEC_USE_COUNT;
</programlisting> </programlisting>
<para> <para>
One of the more difficult problems that USB drivers must be able to handle One of the more difficult problems that USB drivers must be able to handle
smoothly is the fact that the USB device may be removed from the system at smoothly is the fact that the USB device may be removed from the system at
any point in time, even if a program is currently talking to it. It needs any point in time, even if a program is currently talking to it. It needs
to be able to shut down any current reads and writes and notify the to be able to shut down any current reads and writes and notify the
user-space programs that the device is no longer there. The following user-space programs that the device is no longer there. The following
code is an example of how to do this: </para> code (function <function>skel_delete</function>)
is an example of how to do this: </para>
<programlisting> <programlisting>
/* if the device is not opened, then we clean right now */ static inline void skel_delete (struct usb_skel *dev)
if (skel->open_count) { {
minor_table[skel->minor] = NULL; if (dev->bulk_in_buffer != NULL)
if (skel->bulk_in_buffer != NULL) kfree (dev->bulk_in_buffer);
kfree (skel->bulk_in_buffer); if (dev->bulk_out_buffer != NULL)
if (skel->bulk_out_buffer != NULL) usb_buffer_free (dev->udev, dev->bulk_out_size,
kfree (skel->bulk_out_buffer); dev->bulk_out_buffer,
if (skel->write_urb != NULL) dev->write_urb->transfer_dma);
usb_free_urb (skel->write_urb); if (dev->write_urb != NULL)
kfree (skel); usb_free_urb (dev->write_urb);
} else { kfree (dev);
skel->dev = NULL;
up (&amp;skel->sem);
} }
</programlisting> </programlisting>
<para> <para>
If a program currently has an open handle to the device, we only null the If a program currently has an open handle to the device, we reset the flag
usb_device structure in our local structure, as it has now gone away. For <literal>device_present</literal>. For
every read, write, release and other functions that expect a device to be every read, write, release and other functions that expect a device to be
present, the driver first checks to see if this usb_device structure is present, the driver first checks this flag to see if the device is
still present. If not, it releases that the device has disappeared, and a still present. If not, it releases that the device has disappeared, and a
-ENODEV error is returned to the user-space program. When the release -ENODEV error is returned to the user-space program. When the release
function is eventually called, it determines if there is no usb_device function is eventually called, it determines if there is no device
structure and if not, it does the cleanup that the skel_disconnect and if not, it does the cleanup that the skel_disconnect
function normally does if there are no open files on the device (see function normally does if there are no open files on the device (see
Listing 5). Listing 5).
</para> </para>
<programlisting>
if (skel->dev == NULL) {
/* the device was unplugged before the file was released */
minor_table[skel->minor] = NULL;
if (skel->bulk_in_buffer != NULL)
kfree (skel->bulk_in_buffer);
if (skel->bulk_out_buffer != NULL)
kfree (skel->bulk_out_buffer);
if (skel->write_urb != NULL)
usb_free_urb (skel->write_urb);
kfree (skel);
goto exit;
}
</programlisting>
</chapter> </chapter>
<chapter id="iso"> <chapter id="iso">
......
...@@ -122,17 +122,17 @@ Drivers that connect directly to the USB subsystem should be declared ...@@ -122,17 +122,17 @@ Drivers that connect directly to the USB subsystem should be declared
something like this: something like this:
static struct usb_driver mydriver = { static struct usb_driver mydriver = {
name: "mydriver", .name = "mydriver",
id_table: mydriver_id_table, .id_table = mydriver_id_table,
probe: my_probe, .probe = my_probe,
disconnect: my_disconnect, .disconnect = my_disconnect,
/* /*
if using the usb chardev framework: if using the usb chardev framework:
minor: MY_USB_MINOR_START, .minor = MY_USB_MINOR_START,
fops: my_file_ops, .fops = my_file_ops,
if exposing any operations through usbdevfs: if exposing any operations through usbdevfs:
ioctl: my_ioctl, .ioctl = my_ioctl,
*/ */
} }
......
...@@ -349,9 +349,9 @@ void video_unregister_device(struct video_device *vfd) ...@@ -349,9 +349,9 @@ void video_unregister_device(struct video_device *vfd)
if(video_device[vfd->minor]!=vfd) if(video_device[vfd->minor]!=vfd)
panic("videodev: bad unregister"); panic("videodev: bad unregister");
class_device_unregister(&vfd->class_dev);
devfs_remove(vfd->devfs_name); devfs_remove(vfd->devfs_name);
video_device[vfd->minor]=NULL; video_device[vfd->minor]=NULL;
class_device_unregister(&vfd->class_dev);
up(&videodev_lock); up(&videodev_lock);
} }
......
...@@ -483,7 +483,7 @@ static void rh_report_status (unsigned long ptr) ...@@ -483,7 +483,7 @@ static void rh_report_status (unsigned long ptr)
{ {
struct urb *urb; struct urb *urb;
struct usb_hcd *hcd; struct usb_hcd *hcd;
int length; int length = 0;
unsigned long flags; unsigned long flags;
urb = (struct urb *) ptr; urb = (struct urb *) ptr;
...@@ -499,7 +499,9 @@ static void rh_report_status (unsigned long ptr) ...@@ -499,7 +499,9 @@ static void rh_report_status (unsigned long ptr)
return; return;
} }
length = hcd->driver->hub_status_data (hcd, urb->transfer_buffer); if (!HCD_IS_SUSPENDED (hcd->state))
length = hcd->driver->hub_status_data (
hcd, urb->transfer_buffer);
/* complete the status urb, or retrigger the timer */ /* complete the status urb, or retrigger the timer */
spin_lock (&hcd_data_lock); spin_lock (&hcd_data_lock);
......
...@@ -246,21 +246,22 @@ static void sg_complete (struct urb *urb, struct pt_regs *regs) ...@@ -246,21 +246,22 @@ static void sg_complete (struct urb *urb, struct pt_regs *regs)
io->status = urb->status; io->status = urb->status;
/* the previous urbs, and this one, completed already. /* the previous urbs, and this one, completed already.
* unlink the later ones so they won't rx/tx bad data, * unlink pending urbs so they won't rx/tx bad data.
*
* FIXME don't bother unlinking urbs that haven't yet been
* submitted; those non-error cases shouldn't be syslogged
*/ */
for (i = 0, found = 0; i < io->entries; i++) { for (i = 0, found = 0; i < io->entries; i++) {
if (!io->urbs [i])
continue;
if (found) { if (found) {
status = usb_unlink_urb (io->urbs [i]); status = usb_unlink_urb (io->urbs [i]);
if (status && status != -EINPROGRESS) if (status != -EINPROGRESS && status != -EBUSY)
err ("sg_complete, unlink --> %d", dev_err (&io->dev->dev,
status); "%s, unlink --> %d\n",
__FUNCTION__, status);
} else if (urb == io->urbs [i]) } else if (urb == io->urbs [i])
found = 1; found = 1;
} }
} }
urb->dev = 0;
/* on the last completion, signal usb_sg_wait() */ /* on the last completion, signal usb_sg_wait() */
io->bytes += urb->actual_length; io->bytes += urb->actual_length;
...@@ -356,7 +357,7 @@ int usb_sg_init ( ...@@ -356,7 +357,7 @@ int usb_sg_init (
goto nomem; goto nomem;
} }
io->urbs [i]->dev = dev; io->urbs [i]->dev = 0;
io->urbs [i]->pipe = pipe; io->urbs [i]->pipe = pipe;
io->urbs [i]->interval = period; io->urbs [i]->interval = period;
io->urbs [i]->transfer_flags = urb_flags; io->urbs [i]->transfer_flags = urb_flags;
...@@ -448,6 +449,7 @@ void usb_sg_wait (struct usb_sg_request *io) ...@@ -448,6 +449,7 @@ void usb_sg_wait (struct usb_sg_request *io)
for (i = 0; i < io->entries && !io->status; i++) { for (i = 0; i < io->entries && !io->status; i++) {
int retval; int retval;
io->urbs [i]->dev = io->dev;
retval = usb_submit_urb (io->urbs [i], SLAB_ATOMIC); retval = usb_submit_urb (io->urbs [i], SLAB_ATOMIC);
/* after we submit, let completions or cancelations fire; /* after we submit, let completions or cancelations fire;
...@@ -459,9 +461,9 @@ void usb_sg_wait (struct usb_sg_request *io) ...@@ -459,9 +461,9 @@ void usb_sg_wait (struct usb_sg_request *io)
case -ENXIO: // hc didn't queue this one case -ENXIO: // hc didn't queue this one
case -EAGAIN: case -EAGAIN:
case -ENOMEM: case -ENOMEM:
io->urbs [i]->dev = 0;
retval = 0; retval = 0;
i--; i--;
// FIXME: should it usb_sg_cancel() on INTERRUPT?
yield (); yield ();
break; break;
...@@ -477,8 +479,10 @@ void usb_sg_wait (struct usb_sg_request *io) ...@@ -477,8 +479,10 @@ void usb_sg_wait (struct usb_sg_request *io)
/* fail any uncompleted urbs */ /* fail any uncompleted urbs */
default: default:
io->urbs [i]->dev = 0;
io->urbs [i]->status = retval; io->urbs [i]->status = retval;
dbg ("usb_sg_msg, submit --> %d", retval); dev_dbg (&io->dev->dev, "%s, submit --> %d\n",
__FUNCTION__, retval);
usb_sg_cancel (io); usb_sg_cancel (io);
} }
spin_lock_irqsave (&io->lock, flags); spin_lock_irqsave (&io->lock, flags);
...@@ -521,9 +525,9 @@ void usb_sg_cancel (struct usb_sg_request *io) ...@@ -521,9 +525,9 @@ void usb_sg_cancel (struct usb_sg_request *io)
if (!io->urbs [i]->dev) if (!io->urbs [i]->dev)
continue; continue;
retval = usb_unlink_urb (io->urbs [i]); retval = usb_unlink_urb (io->urbs [i]);
if (retval && retval != -EINPROGRESS) if (retval != -EINPROGRESS && retval != -EBUSY)
warn ("usb_sg_cancel, unlink --> %d", retval); dev_warn (&io->dev->dev, "%s, unlink --> %d\n",
// FIXME don't warn on "not yet submitted" error __FUNCTION__, retval);
} }
} }
spin_unlock_irqrestore (&io->lock, flags); spin_unlock_irqrestore (&io->lock, flags);
......
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
#define DEBUG 1 #define DEBUG 1
// #define VERBOSE /* extra debug messages (success too) */ // #define VERBOSE /* extra debug messages (success too) */
#include <linux/version.h>
#include <linux/config.h> #include <linux/config.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/pci.h> #include <linux/pci.h>
......
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/version.h>
#include "../core/hcd.h" #include "../core/hcd.h"
#include <asm/byteorder.h> #include <asm/byteorder.h>
...@@ -979,21 +978,12 @@ static const struct hc_driver ehci_driver = { ...@@ -979,21 +978,12 @@ static const struct hc_driver ehci_driver = {
/* EHCI spec says PCI is required. */ /* EHCI spec says PCI is required. */
/* PCI driver selection metadata; PCI hotplugging uses this */ /* PCI driver selection metadata; PCI hotplugging uses this */
static struct pci_device_id pci_ids [] = { { static const struct pci_device_id pci_ids [] = { {
/* handle any USB 2.0 EHCI controller */ /* handle any USB 2.0 EHCI controller */
PCI_DEVICE_CLASS(((PCI_CLASS_SERIAL_USB << 8) | 0x20), ~0),
.class = ((PCI_CLASS_SERIAL_USB << 8) | 0x20),
.class_mask = ~0,
.driver_data = (unsigned long) &ehci_driver, .driver_data = (unsigned long) &ehci_driver,
},
/* no matter who makes it */ { /* end: all zeroes */ }
.vendor = PCI_ANY_ID,
.device = PCI_ANY_ID,
.subvendor = PCI_ANY_ID,
.subdevice = PCI_ANY_ID,
}, { /* end: all zeroes */ }
}; };
MODULE_DEVICE_TABLE (pci, pci_ids); MODULE_DEVICE_TABLE (pci, pci_ids);
......
...@@ -351,18 +351,9 @@ static const struct hc_driver ohci_pci_hc_driver = { ...@@ -351,18 +351,9 @@ static const struct hc_driver ohci_pci_hc_driver = {
static const struct pci_device_id pci_ids [] = { { static const struct pci_device_id pci_ids [] = { {
/* handle any USB OHCI controller */ /* handle any USB OHCI controller */
.class = (PCI_CLASS_SERIAL_USB << 8) | 0x10, PCI_DEVICE_CLASS((PCI_CLASS_SERIAL_USB << 8) | 0x10, ~0),
.class_mask = ~0,
.driver_data = (unsigned long) &ohci_pci_hc_driver, .driver_data = (unsigned long) &ohci_pci_hc_driver,
/* no matter who makes it */
.vendor = PCI_ANY_ID,
.device = PCI_ANY_ID,
.subvendor = PCI_ANY_ID,
.subdevice = PCI_ANY_ID,
}, { /* end: all zeroes */ } }, { /* end: all zeroes */ }
}; };
MODULE_DEVICE_TABLE (pci, pci_ids); MODULE_DEVICE_TABLE (pci, pci_ids);
......
...@@ -2504,18 +2504,9 @@ static const struct hc_driver uhci_driver = { ...@@ -2504,18 +2504,9 @@ static const struct hc_driver uhci_driver = {
}; };
static const struct pci_device_id uhci_pci_ids[] = { { static const struct pci_device_id uhci_pci_ids[] = { {
/* handle any USB UHCI controller */ /* handle any USB UHCI controller */
.class = ((PCI_CLASS_SERIAL_USB << 8) | 0x00), PCI_DEVICE_CLASS(((PCI_CLASS_SERIAL_USB << 8) | 0x00), ~0),
.class_mask = ~0,
.driver_data = (unsigned long) &uhci_driver, .driver_data = (unsigned long) &uhci_driver,
/* no matter who makes it */
.vendor = PCI_ANY_ID,
.device = PCI_ANY_ID,
.subvendor = PCI_ANY_ID,
.subdevice = PCI_ANY_ID,
}, { /* end: all zeroes */ } }, { /* end: all zeroes */ }
}; };
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/socket.h> #include <linux/socket.h>
#include <linux/miscdevice.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/slab.h> #include <linux/slab.h>
......
This diff is collapsed.
...@@ -89,7 +89,7 @@ struct stv680_frame { ...@@ -89,7 +89,7 @@ struct stv680_frame {
/* this is almost the video structure uvd_t, with extra parameters for stv */ /* this is almost the video structure uvd_t, with extra parameters for stv */
struct usb_stv { struct usb_stv {
struct video_device vdev; struct video_device *vdev;
struct usb_device *udev; struct usb_device *udev;
...@@ -142,7 +142,6 @@ struct usb_stv { ...@@ -142,7 +142,6 @@ struct usb_stv {
wait_queue_head_t wq; /* Processes waiting */ wait_queue_head_t wq; /* Processes waiting */
struct proc_dir_entry *proc_entry; /* /proc/stv680/videoX */
int nullpackets; int nullpackets;
}; };
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include <linux/signal.h> #include <linux/signal.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/miscdevice.h>
#include <linux/random.h> #include <linux/random.h>
#include <linux/poll.h> #include <linux/poll.h>
#include <linux/init.h> #include <linux/init.h>
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/socket.h> #include <linux/socket.h>
#include <linux/miscdevice.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/init.h> #include <linux/init.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
......
...@@ -435,7 +435,7 @@ static int is_good_config (char *buf, int len) ...@@ -435,7 +435,7 @@ static int is_good_config (char *buf, int len)
return 0; return 0;
} }
le32_to_cpus (&config->wTotalLength); le16_to_cpus (&config->wTotalLength);
if (config->wTotalLength == len) /* read it all */ if (config->wTotalLength == len) /* read it all */
return 1; return 1;
return config->wTotalLength >= TBUF_SIZE; /* max partial read */ return config->wTotalLength >= TBUF_SIZE; /* max partial read */
......
...@@ -75,7 +75,6 @@ ...@@ -75,7 +75,6 @@
#include <linux/mii.h> #include <linux/mii.h>
#include <linux/crc32.h> #include <linux/crc32.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <linux/version.h>
/* Version Information */ /* Version Information */
#define DRIVER_VERSION "v2.0.2" #define DRIVER_VERSION "v2.0.2"
......
This diff is collapsed.
...@@ -602,10 +602,19 @@ static int belkin_sa_ioctl (struct usb_serial_port *port, struct file * file, un ...@@ -602,10 +602,19 @@ static int belkin_sa_ioctl (struct usb_serial_port *port, struct file * file, un
static int __init belkin_sa_init (void) static int __init belkin_sa_init (void)
{ {
usb_serial_register (&belkin_device); int retval;
usb_register (&belkin_driver); retval = usb_serial_register(&belkin_device);
if (retval)
goto failed_usb_serial_register;
retval = usb_register(&belkin_driver);
if (retval)
goto failed_usb_register;
info(DRIVER_DESC " " DRIVER_VERSION); info(DRIVER_DESC " " DRIVER_VERSION);
return 0; return 0;
failed_usb_register:
usb_serial_deregister(&belkin_device);
failed_usb_serial_register:
return retval;
} }
......
...@@ -464,13 +464,22 @@ static void cyberjack_write_bulk_callback (struct urb *urb, struct pt_regs *regs ...@@ -464,13 +464,22 @@ static void cyberjack_write_bulk_callback (struct urb *urb, struct pt_regs *regs
static int __init cyberjack_init (void) static int __init cyberjack_init (void)
{ {
usb_serial_register (&cyberjack_device); int retval;
usb_register (&cyberjack_driver); retval = usb_serial_register(&cyberjack_device);
if (retval)
goto failed_usb_serial_register;
retval = usb_register(&cyberjack_driver);
if (retval)
goto failed_usb_register;
info(DRIVER_VERSION " " DRIVER_AUTHOR); info(DRIVER_VERSION " " DRIVER_AUTHOR);
info(DRIVER_DESC); info(DRIVER_DESC);
return 0; return 0;
failed_usb_register:
usb_serial_deregister(&cyberjack_device);
failed_usb_serial_register:
return retval;
} }
static void __exit cyberjack_exit (void) static void __exit cyberjack_exit (void)
......
...@@ -2045,11 +2045,24 @@ opcode, line, status, val ); ...@@ -2045,11 +2045,24 @@ opcode, line, status, val );
static int __init digi_init (void) static int __init digi_init (void)
{ {
usb_serial_register (&digi_acceleport_2_device); int retval;
usb_serial_register (&digi_acceleport_4_device); retval = usb_serial_register(&digi_acceleport_2_device);
usb_register (&digi_driver); if (retval)
goto failed_acceleport_2_device;
retval = usb_serial_register(&digi_acceleport_4_device);
if (retval)
goto failed_acceleport_4_device;
retval = usb_register(&digi_driver);
if (retval)
goto failed_usb_register;
info(DRIVER_VERSION ":" DRIVER_DESC); info(DRIVER_VERSION ":" DRIVER_DESC);
return 0; return 0;
failed_usb_register:
usb_serial_deregister(&digi_acceleport_4_device);
failed_acceleport_4_device:
usb_serial_deregister(&digi_acceleport_2_device);
failed_acceleport_2_device:
return retval;
} }
......
...@@ -558,7 +558,7 @@ static void empeg_set_termios (struct usb_serial_port *port, struct termios *old ...@@ -558,7 +558,7 @@ static void empeg_set_termios (struct usb_serial_port *port, struct termios *old
static int __init empeg_init (void) static int __init empeg_init (void)
{ {
struct urb *urb; struct urb *urb;
int i; int i, retval;
/* create our write urb pool and transfer buffers */ /* create our write urb pool and transfer buffers */
spin_lock_init (&write_urb_pool_lock); spin_lock_init (&write_urb_pool_lock);
...@@ -570,7 +570,6 @@ static int __init empeg_init (void) ...@@ -570,7 +570,6 @@ static int __init empeg_init (void)
continue; continue;
} }
urb->transfer_buffer = NULL;
urb->transfer_buffer = kmalloc (URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL); urb->transfer_buffer = kmalloc (URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL);
if (!urb->transfer_buffer) { if (!urb->transfer_buffer) {
err("%s - out of memory for urb buffers.", err("%s - out of memory for urb buffers.",
...@@ -579,12 +578,27 @@ static int __init empeg_init (void) ...@@ -579,12 +578,27 @@ static int __init empeg_init (void)
} }
} }
usb_serial_register (&empeg_device); retval = usb_serial_register(&empeg_device);
usb_register (&empeg_driver); if (retval)
goto failed_usb_serial_register;
retval = usb_register(&empeg_driver);
if (retval)
goto failed_usb_register;
info(DRIVER_VERSION ":" DRIVER_DESC); info(DRIVER_VERSION ":" DRIVER_DESC);
return 0; return 0;
failed_usb_register:
usb_serial_deregister(&empeg_device);
failed_usb_serial_register:
for (i = 0; i < NUM_URBS; ++i) {
if (write_urb_pool[i]) {
if (write_urb_pool[i]->transfer_buffer)
kfree(write_urb_pool[i]->transfer_buffer);
usb_free_urb(write_urb_pool[i]);
}
}
return retval;
} }
...@@ -593,7 +607,7 @@ static void __exit empeg_exit (void) ...@@ -593,7 +607,7 @@ static void __exit empeg_exit (void)
int i; int i;
unsigned long flags; unsigned long flags;
usb_register (&empeg_driver); usb_deregister(&empeg_driver);
usb_serial_deregister (&empeg_device); usb_serial_deregister (&empeg_device);
spin_lock_irqsave (&write_urb_pool_lock, flags); spin_lock_irqsave (&write_urb_pool_lock, flags);
......
...@@ -17,6 +17,11 @@ ...@@ -17,6 +17,11 @@
* See http://ftdi-usb-sio.sourceforge.net for upto date testing info * See http://ftdi-usb-sio.sourceforge.net for upto date testing info
* and extra documentation * and extra documentation
* *
* (19/Aug/2003) Ian Abbott
* Freed urb's transfer buffer in write bulk callback.
* Omitted some paranoid checks in write bulk callback that don't matter.
* Scheduled work in write bulk callback regardless of port's open count.
*
* (05/Aug/2003) Ian Abbott * (05/Aug/2003) Ian Abbott
* Added VID/PID for ID TECH IDT1221U USB to RS-232 adapter. * Added VID/PID for ID TECH IDT1221U USB to RS-232 adapter.
* VID/PID provided by Steve Briggs. * VID/PID provided by Steve Briggs.
...@@ -1391,31 +1396,21 @@ static int ftdi_write (struct usb_serial_port *port, int from_user, ...@@ -1391,31 +1396,21 @@ static int ftdi_write (struct usb_serial_port *port, int from_user,
static void ftdi_write_bulk_callback (struct urb *urb, struct pt_regs *regs) static void ftdi_write_bulk_callback (struct urb *urb, struct pt_regs *regs)
{ {
struct usb_serial_port *port = (struct usb_serial_port *)urb->context; struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
dbg("%s", __FUNCTION__); /* free up the transfer buffer, as usb_free_urb() does not do this */
kfree (urb->transfer_buffer);
if (port_paranoia_check (port, __FUNCTION__)) if (port_paranoia_check (port, __FUNCTION__))
return; return;
dbg("%s - port %d", __FUNCTION__, port->number);
if (urb->status) { if (urb->status) {
dbg("nonzero write bulk status received: %d", urb->status); dbg("nonzero write bulk status received: %d", urb->status);
return; return;
} }
if (!serial) { schedule_work(&port->work);
dbg("%s - bad serial pointer, exiting", __FUNCTION__);
return;
}
/* Have to check for validity of queueing up the tasks */
dbg("%s - port->open_count = %d", __FUNCTION__, port->open_count);
if (port->open_count > 0){
schedule_work(&port->work);
}
return;
} /* ftdi_write_bulk_callback */ } /* ftdi_write_bulk_callback */
...@@ -1999,17 +1994,42 @@ static void ftdi_unthrottle (struct usb_serial_port *port) ...@@ -1999,17 +1994,42 @@ static void ftdi_unthrottle (struct usb_serial_port *port)
static int __init ftdi_init (void) static int __init ftdi_init (void)
{ {
int retval;
dbg("%s", __FUNCTION__); dbg("%s", __FUNCTION__);
usb_serial_register (&ftdi_SIO_device); retval = usb_serial_register(&ftdi_SIO_device);
usb_serial_register (&ftdi_8U232AM_device); if (retval)
usb_serial_register (&ftdi_FT232BM_device); goto failed_SIO_register;
usb_serial_register (&ftdi_USB_UIRT_device); retval = usb_serial_register(&ftdi_8U232AM_device);
usb_serial_register (&ftdi_HE_TIRA1_device); if (retval)
usb_register (&ftdi_driver); goto failed_8U232AM_register;
retval = usb_serial_register(&ftdi_FT232BM_device);
if (retval)
goto failed_FT232BM_register;
retval = usb_serial_register(&ftdi_USB_UIRT_device);
if (retval)
goto failed_USB_UIRT_register;
retval = usb_serial_register(&ftdi_HE_TIRA1_device);
if (retval)
goto failed_HE_TIRA1_register;
retval = usb_register(&ftdi_driver);
if (retval)
goto failed_usb_register;
info(DRIVER_VERSION ":" DRIVER_DESC); info(DRIVER_VERSION ":" DRIVER_DESC);
return 0; return 0;
failed_usb_register:
usb_serial_deregister(&ftdi_HE_TIRA1_device);
failed_HE_TIRA1_register:
usb_serial_deregister(&ftdi_USB_UIRT_device);
failed_USB_UIRT_register:
usb_serial_deregister(&ftdi_FT232BM_device);
failed_FT232BM_register:
usb_serial_deregister(&ftdi_8U232AM_device);
failed_8U232AM_register:
usb_serial_deregister(&ftdi_SIO_device);
failed_SIO_register:
return retval;
} }
......
...@@ -3051,15 +3051,36 @@ static void edge_shutdown (struct usb_serial *serial) ...@@ -3051,15 +3051,36 @@ static void edge_shutdown (struct usb_serial *serial)
* edgeport_init * edgeport_init
* This is called by the module subsystem, or on startup to initialize us * This is called by the module subsystem, or on startup to initialize us
****************************************************************************/ ****************************************************************************/
int __init edgeport_init(void) static int __init edgeport_init(void)
{ {
usb_serial_register (&edgeport_1port_device); int retval;
usb_serial_register (&edgeport_2port_device); retval = usb_serial_register(&edgeport_1port_device);
usb_serial_register (&edgeport_4port_device); if (retval)
usb_serial_register (&edgeport_8port_device); goto failed_1port_device_register;
usb_register (&io_driver); retval = usb_serial_register(&edgeport_2port_device);
if (retval)
goto failed_2port_device_register;
retval = usb_serial_register(&edgeport_4port_device);
if (retval)
goto failed_4port_device_register;
retval = usb_serial_register(&edgeport_8port_device);
if (retval)
goto failed_8port_device_register;
retval = usb_register(&io_driver);
if (retval)
goto failed_usb_register;
info(DRIVER_DESC " " DRIVER_VERSION); info(DRIVER_DESC " " DRIVER_VERSION);
return 0; return 0;
failed_usb_register:
usb_serial_deregister(&edgeport_8port_device);
failed_8port_device_register:
usb_serial_deregister(&edgeport_4port_device);
failed_4port_device_register:
usb_serial_deregister(&edgeport_2port_device);
failed_2port_device_register:
usb_serial_deregister(&edgeport_1port_device);
failed_1port_device_register:
return retval;
} }
...@@ -3068,7 +3089,7 @@ int __init edgeport_init(void) ...@@ -3068,7 +3089,7 @@ int __init edgeport_init(void)
* edgeport_exit * edgeport_exit
* Called when the driver is about to be unloaded. * Called when the driver is about to be unloaded.
****************************************************************************/ ****************************************************************************/
void __exit edgeport_exit (void) static void __exit edgeport_exit (void)
{ {
usb_deregister (&io_driver); usb_deregister (&io_driver);
usb_serial_deregister (&edgeport_1port_device); usb_serial_deregister (&edgeport_1port_device);
......
...@@ -127,6 +127,7 @@ static struct usb_device_id edgeport_1port_id_table [] = { ...@@ -127,6 +127,7 @@ static struct usb_device_id edgeport_1port_id_table [] = {
static struct usb_device_id edgeport_2port_id_table [] = { static struct usb_device_id edgeport_2port_id_table [] = {
{ USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_2) }, { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_2) },
{ USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_2C) },
{ USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_2I) }, { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_2I) },
{ USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_421) }, { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_421) },
{ USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_421_BOOT) }, { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_421_BOOT) },
...@@ -145,6 +146,7 @@ static struct usb_device_id edgeport_2port_id_table [] = { ...@@ -145,6 +146,7 @@ static struct usb_device_id edgeport_2port_id_table [] = {
static struct usb_device_id id_table_combined [] = { static struct usb_device_id id_table_combined [] = {
{ USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_1) }, { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_1) },
{ USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_2) }, { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_2) },
{ USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_2C) },
{ USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_2I) }, { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_2I) },
{ USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_421) }, { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_421) },
{ USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_421_BOOT) }, { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_421_BOOT) },
...@@ -2679,11 +2681,24 @@ static struct usb_serial_device_type edgeport_2port_device = { ...@@ -2679,11 +2681,24 @@ static struct usb_serial_device_type edgeport_2port_device = {
static int __init edgeport_init(void) static int __init edgeport_init(void)
{ {
usb_serial_register (&edgeport_1port_device); int retval;
usb_serial_register (&edgeport_2port_device); retval = usb_serial_register(&edgeport_1port_device);
usb_register (&io_driver); if (retval)
goto failed_1port_device_register;
retval = usb_serial_register(&edgeport_2port_device);
if (retval)
goto failed_2port_device_register;
retval = usb_register(&io_driver);
if (retval)
goto failed_usb_register;
info(DRIVER_DESC " " DRIVER_VERSION); info(DRIVER_DESC " " DRIVER_VERSION);
return 0; return 0;
failed_usb_register:
usb_serial_deregister(&edgeport_2port_device);
failed_2port_device_register:
usb_serial_deregister(&edgeport_1port_device);
failed_1port_device_register:
return retval;
} }
static void __exit edgeport_exit (void) static void __exit edgeport_exit (void)
......
...@@ -118,6 +118,7 @@ ...@@ -118,6 +118,7 @@
#define ION_DEVICE_ID_TI_EDGEPORT_1 0x0215 /* Edgeport/1 RS232 */ #define ION_DEVICE_ID_TI_EDGEPORT_1 0x0215 /* Edgeport/1 RS232 */
#define ION_DEVICE_ID_TI_EDGEPORT_42 0x0217 /* Edgeport/42 4 hub 2 RS232 */ #define ION_DEVICE_ID_TI_EDGEPORT_42 0x0217 /* Edgeport/42 4 hub 2 RS232 */
#define ION_DEVICE_ID_TI_EDGEPORT_22 0x021A /* Edgeport/22 Edgeport/22I is an Edgeport/4 with ports 1&2 RS422 and ports 3&4 RS232 */ #define ION_DEVICE_ID_TI_EDGEPORT_22 0x021A /* Edgeport/22 Edgeport/22I is an Edgeport/4 with ports 1&2 RS422 and ports 3&4 RS232 */
#define ION_DEVICE_ID_TI_EDGEPORT_2C 0x021B /* Edgeport/2c RS232 */
#define ION_DEVICE_ID_TI_EDGEPORT_421_BOOT 0x0240 /* Edgeport/421 in boot mode */ #define ION_DEVICE_ID_TI_EDGEPORT_421_BOOT 0x0240 /* Edgeport/421 in boot mode */
#define ION_DEVICE_ID_TI_EDGEPORT_421_DOWN 0x0241 /* Edgeport/421 in download mode first interface is 2 RS232 (Note that the second interface of this multi interface device should be a standard USB class 7 printer port) */ #define ION_DEVICE_ID_TI_EDGEPORT_421_DOWN 0x0241 /* Edgeport/421 in download mode first interface is 2 RS232 (Note that the second interface of this multi interface device should be a standard USB class 7 printer port) */
......
...@@ -570,16 +570,25 @@ static void ipaq_shutdown(struct usb_serial *serial) ...@@ -570,16 +570,25 @@ static void ipaq_shutdown(struct usb_serial *serial)
static int __init ipaq_init(void) static int __init ipaq_init(void)
{ {
int retval;
spin_lock_init(&write_list_lock); spin_lock_init(&write_list_lock);
usb_serial_register(&ipaq_device); retval = usb_serial_register(&ipaq_device);
if (retval)
goto failed_usb_serial_register;
info(DRIVER_DESC " " DRIVER_VERSION); info(DRIVER_DESC " " DRIVER_VERSION);
if (vendor) { if (vendor) {
ipaq_id_table[0].idVendor = vendor; ipaq_id_table[0].idVendor = vendor;
ipaq_id_table[0].idProduct = product; ipaq_id_table[0].idProduct = product;
} }
usb_register(&ipaq_driver); retval = usb_register(&ipaq_driver);
if (retval)
goto failed_usb_register;
return 0; return 0;
failed_usb_register:
usb_serial_deregister(&ipaq_device);
failed_usb_serial_register:
return retval;
} }
......
...@@ -609,10 +609,19 @@ static void ir_set_termios (struct usb_serial_port *port, struct termios *old_te ...@@ -609,10 +609,19 @@ static void ir_set_termios (struct usb_serial_port *port, struct termios *old_te
static int __init ir_init (void) static int __init ir_init (void)
{ {
usb_serial_register (&ir_device); int retval;
usb_register (&ir_driver); retval = usb_serial_register(&ir_device);
if (retval)
goto failed_usb_serial_register;
retval = usb_register(&ir_driver);
if (retval)
goto failed_usb_register;
info(DRIVER_DESC " " DRIVER_VERSION); info(DRIVER_DESC " " DRIVER_VERSION);
return 0; return 0;
failed_usb_register:
usb_serial_deregister(&ir_device);
failed_usb_serial_register:
return retval;
} }
......
...@@ -197,15 +197,36 @@ struct keyspan_port_private { ...@@ -197,15 +197,36 @@ struct keyspan_port_private {
/* Functions used by new usb-serial code. */ /* Functions used by new usb-serial code. */
static int __init keyspan_init (void) static int __init keyspan_init (void)
{ {
usb_serial_register (&keyspan_pre_device); int retval;
usb_serial_register (&keyspan_1port_device); retval = usb_serial_register(&keyspan_pre_device);
usb_serial_register (&keyspan_2port_device); if (retval)
usb_serial_register (&keyspan_4port_device); goto failed_pre_device_register;
usb_register (&keyspan_driver); retval = usb_serial_register(&keyspan_1port_device);
if (retval)
goto failed_1port_device_register;
retval = usb_serial_register(&keyspan_2port_device);
if (retval)
goto failed_2port_device_register;
retval = usb_serial_register(&keyspan_4port_device);
if (retval)
goto failed_4port_device_register;
retval = usb_register(&keyspan_driver);
if (retval)
goto failed_usb_register;
info(DRIVER_VERSION ":" DRIVER_DESC); info(DRIVER_VERSION ":" DRIVER_DESC);
return 0; return 0;
failed_usb_register:
usb_serial_deregister(&keyspan_4port_device);
failed_4port_device_register:
usb_serial_deregister(&keyspan_2port_device);
failed_2port_device_register:
usb_serial_deregister(&keyspan_1port_device);
failed_1port_device_register:
usb_serial_deregister(&keyspan_pre_device);
failed_pre_device_register:
return retval;
} }
static void __exit keyspan_exit (void) static void __exit keyspan_exit (void)
......
...@@ -876,16 +876,39 @@ static struct usb_serial_device_type keyspan_pda_device = { ...@@ -876,16 +876,39 @@ static struct usb_serial_device_type keyspan_pda_device = {
static int __init keyspan_pda_init (void) static int __init keyspan_pda_init (void)
{ {
usb_serial_register (&keyspan_pda_device); int retval;
retval = usb_serial_register(&keyspan_pda_device);
if (retval)
goto failed_pda_register;
#ifdef KEYSPAN #ifdef KEYSPAN
usb_serial_register (&keyspan_pda_fake_device); retval = usb_serial_register(&keyspan_pda_fake_device);
if (retval)
goto failed_pda_fake_register;
#endif #endif
#ifdef XIRCOM #ifdef XIRCOM
usb_serial_register (&xircom_pgs_fake_device); retval = usb_serial_register(&xircom_pgs_fake_device);
if (retval)
goto failed_xircom_register;
#endif #endif
usb_register (&keyspan_pda_driver); retval = usb_register(&keyspan_pda_driver);
if (retval)
goto failed_usb_register;
info(DRIVER_DESC " " DRIVER_VERSION); info(DRIVER_DESC " " DRIVER_VERSION);
return 0; return 0;
failed_usb_register:
#ifdef XIRCOM
usb_serial_deregister(&xircom_pgs_fake_device);
failed_xircom_register:
#endif /* XIRCOM */
#ifdef KEYSPAN
usb_serial_deregister(&keyspan_pda_fake_device);
#endif
#ifdef KEYSPAN
failed_pda_fake_register:
#endif
usb_serial_deregister(&keyspan_pda_device);
failed_pda_register:
return retval;
} }
......
...@@ -1037,11 +1037,20 @@ static void klsi_105_unthrottle (struct usb_serial_port *port) ...@@ -1037,11 +1037,20 @@ static void klsi_105_unthrottle (struct usb_serial_port *port)
static int __init klsi_105_init (void) static int __init klsi_105_init (void)
{ {
usb_serial_register (&kl5kusb105d_device); int retval;
usb_register (&kl5kusb105d_driver); retval = usb_serial_register(&kl5kusb105d_device);
if (retval)
goto failed_usb_serial_register;
retval = usb_register(&kl5kusb105d_driver);
if (retval)
goto failed_usb_register;
info(DRIVER_DESC " " DRIVER_VERSION); info(DRIVER_DESC " " DRIVER_VERSION);
return 0; return 0;
failed_usb_register:
usb_serial_deregister(&kl5kusb105d_device);
failed_usb_serial_register:
return retval;
} }
......
...@@ -743,13 +743,22 @@ static int kobil_ioctl(struct usb_serial_port *port, struct file *file, ...@@ -743,13 +743,22 @@ static int kobil_ioctl(struct usb_serial_port *port, struct file *file,
static int __init kobil_init (void) static int __init kobil_init (void)
{ {
usb_serial_register (&kobil_device); int retval;
usb_register (&kobil_driver); retval = usb_serial_register(&kobil_device);
if (retval)
goto failed_usb_serial_register;
retval = usb_register(&kobil_driver);
if (retval)
goto failed_usb_register;
info(DRIVER_VERSION " " DRIVER_AUTHOR); info(DRIVER_VERSION " " DRIVER_AUTHOR);
info(DRIVER_DESC); info(DRIVER_DESC);
return 0; return 0;
failed_usb_register:
usb_serial_deregister(&kobil_device);
failed_usb_serial_register:
return retval;
} }
......
...@@ -850,10 +850,19 @@ static int mct_u232_ioctl (struct usb_serial_port *port, struct file * file, ...@@ -850,10 +850,19 @@ static int mct_u232_ioctl (struct usb_serial_port *port, struct file * file,
static int __init mct_u232_init (void) static int __init mct_u232_init (void)
{ {
usb_serial_register (&mct_u232_device); int retval;
usb_register (&mct_u232_driver); retval = usb_serial_register(&mct_u232_device);
if (retval)
goto failed_usb_serial_register;
retval = usb_register(&mct_u232_driver);
if (retval)
goto failed_usb_register;
info(DRIVER_DESC " " DRIVER_VERSION); info(DRIVER_DESC " " DRIVER_VERSION);
return 0; return 0;
failed_usb_register:
usb_serial_deregister(&mct_u232_device);
failed_usb_serial_register:
return retval;
} }
......
...@@ -375,10 +375,19 @@ static void omninet_shutdown (struct usb_serial *serial) ...@@ -375,10 +375,19 @@ static void omninet_shutdown (struct usb_serial *serial)
static int __init omninet_init (void) static int __init omninet_init (void)
{ {
usb_serial_register (&zyxel_omninet_device); int retval;
usb_register (&omninet_driver); retval = usb_serial_register(&zyxel_omninet_device);
if (retval)
goto failed_usb_serial_register;
retval = usb_register(&omninet_driver);
if (retval)
goto failed_usb_register;
info(DRIVER_VERSION ":" DRIVER_DESC); info(DRIVER_VERSION ":" DRIVER_DESC);
return 0; return 0;
failed_usb_register:
usb_serial_deregister(&zyxel_omninet_device);
failed_usb_serial_register:
return retval;
} }
......
...@@ -768,10 +768,19 @@ static void pl2303_write_bulk_callback (struct urb *urb, struct pt_regs *regs) ...@@ -768,10 +768,19 @@ static void pl2303_write_bulk_callback (struct urb *urb, struct pt_regs *regs)
static int __init pl2303_init (void) static int __init pl2303_init (void)
{ {
usb_serial_register (&pl2303_device); int retval;
usb_register (&pl2303_driver); retval = usb_serial_register(&pl2303_device);
if (retval)
goto failed_usb_serial_register;
retval = usb_register(&pl2303_driver);
if (retval)
goto failed_usb_register;
info(DRIVER_DESC " " DRIVER_VERSION); info(DRIVER_DESC " " DRIVER_VERSION);
return 0; return 0;
failed_usb_register:
usb_serial_deregister(&pl2303_device);
failed_usb_serial_register:
return retval;
} }
......
...@@ -422,7 +422,7 @@ static struct usb_serial_device_type safe_device = { ...@@ -422,7 +422,7 @@ static struct usb_serial_device_type safe_device = {
static int __init safe_init (void) static int __init safe_init (void)
{ {
int i; int i, retval;
info (DRIVER_VERSION " " DRIVER_AUTHOR); info (DRIVER_VERSION " " DRIVER_AUTHOR);
info (DRIVER_DESC); info (DRIVER_DESC);
...@@ -441,10 +441,18 @@ static int __init safe_init (void) ...@@ -441,10 +441,18 @@ static int __init safe_init (void)
} }
} }
usb_serial_register (&safe_device); retval = usb_serial_register(&safe_device);
usb_register (&safe_driver); if (retval)
goto failed_usb_serial_register;
retval = usb_register(&safe_driver);
if (retval)
goto failed_usb_register;
return 0; return 0;
failed_usb_register:
usb_serial_deregister(&safe_device);
failed_usb_serial_register:
return retval;
} }
static void __exit safe_exit (void) static void __exit safe_exit (void)
......
...@@ -956,7 +956,7 @@ static void visor_set_termios (struct usb_serial_port *port, struct termios *old ...@@ -956,7 +956,7 @@ static void visor_set_termios (struct usb_serial_port *port, struct termios *old
static int __init visor_init (void) static int __init visor_init (void)
{ {
int i; int i, retval;
/* Only if parameters were passed to us */ /* Only if parameters were passed to us */
if ((vendor>0) && (product>0)) { if ((vendor>0) && (product>0)) {
struct usb_device_id usb_dev_temp[]= struct usb_device_id usb_dev_temp[]=
...@@ -983,12 +983,24 @@ static int __init visor_init (void) ...@@ -983,12 +983,24 @@ static int __init visor_init (void)
info("Adding Palm OS protocol 4.x support for unknown device: 0x%x/0x%x", info("Adding Palm OS protocol 4.x support for unknown device: 0x%x/0x%x",
vendor, product); vendor, product);
} }
usb_serial_register (&handspring_device); retval = usb_serial_register(&handspring_device);
usb_serial_register (&clie_3_5_device); if (retval)
usb_register (&visor_driver); goto failed_handspring_register;
retval = usb_serial_register(&clie_3_5_device);
if (retval)
goto failed_clie_3_5_register;
retval = usb_register(&visor_driver);
if (retval)
goto failed_usb_register;
info(DRIVER_DESC " " DRIVER_VERSION); info(DRIVER_DESC " " DRIVER_VERSION);
return 0; return 0;
failed_usb_register:
usb_serial_deregister(&clie_3_5_device);
failed_clie_3_5_register:
usb_serial_deregister(&handspring_device);
failed_handspring_register:
return retval;
} }
......
...@@ -1486,11 +1486,24 @@ static void rx_data_softint(void *private) ...@@ -1486,11 +1486,24 @@ static void rx_data_softint(void *private)
*****************************************************************************/ *****************************************************************************/
static int __init whiteheat_init (void) static int __init whiteheat_init (void)
{ {
usb_serial_register (&whiteheat_fake_device); int retval;
usb_serial_register (&whiteheat_device); retval = usb_serial_register(&whiteheat_fake_device);
usb_register (&whiteheat_driver); if (retval)
goto failed_fake_register;
retval = usb_serial_register(&whiteheat_device);
if (retval)
goto failed_device_register;
retval = usb_register(&whiteheat_driver);
if (retval)
goto failed_usb_register;
info(DRIVER_DESC " " DRIVER_VERSION); info(DRIVER_DESC " " DRIVER_VERSION);
return 0; return 0;
failed_usb_register:
usb_serial_deregister(&whiteheat_device);
failed_device_register:
usb_serial_deregister(&whiteheat_fake_device);
failed_fake_register:
return retval;
} }
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "debug.h" #include "debug.h"
#include "sddr09.h" #include "sddr09.h"
#include <linux/version.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/slab.h> #include <linux/slab.h>
......
...@@ -48,7 +48,6 @@ ...@@ -48,7 +48,6 @@
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/version.h>
#include "scsi.h" #include "scsi.h"
#include "hosts.h" #include "hosts.h"
......
...@@ -63,6 +63,12 @@ video_device_create_file(struct video_device *vfd, ...@@ -63,6 +63,12 @@ video_device_create_file(struct video_device *vfd,
{ {
class_device_create_file(&vfd->class_dev, attr); class_device_create_file(&vfd->class_dev, attr);
} }
static inline void
video_device_remove_file(struct video_device *vfd,
struct class_device_attribute *attr)
{
class_device_remove_file(&vfd->class_dev, attr);
}
/* helper functions to alloc / release struct video_device, the /* helper functions to alloc / release struct video_device, the
later can be used for video_device->release() */ later can be used for video_device->release() */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment