Commit 6606cf5e authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge bk://linuxusb@bkbits.net/linus-2.5

into kroah.com:/home/linux/linux/BK/gregkh-2.5
parents 5054ed20 cc1dd8e2
...@@ -168,7 +168,7 @@ struct usb_bluetooth { ...@@ -168,7 +168,7 @@ struct usb_bluetooth {
int magic; int magic;
struct usb_device * dev; struct usb_device * dev;
struct tty_driver * tty_driver; /* the tty_driver for this device */ struct tty_driver * tty_driver; /* the tty_driver for this device */
struct tty_struct * tty; /* the coresponding tty for this port */ struct tty_struct * tty; /* the corresponding tty for this port */
unsigned char minor; /* the starting minor number for this device */ unsigned char minor; /* the starting minor number for this device */
int throttle; /* throttled by tty layer */ int throttle; /* throttled by tty layer */
...@@ -1328,7 +1328,7 @@ int usb_bluetooth_init(void) ...@@ -1328,7 +1328,7 @@ int usb_bluetooth_init(void)
int i; int i;
int result; int result;
/* Initalize our global data */ /* Initialize our global data */
for (i = 0; i < BLUETOOTH_TTY_MINORS; ++i) { for (i = 0; i < BLUETOOTH_TTY_MINORS; ++i) {
bluetooth_table[i] = NULL; bluetooth_table[i] = NULL;
} }
......
...@@ -138,9 +138,9 @@ struct acm_line { ...@@ -138,9 +138,9 @@ struct acm_line {
*/ */
struct acm { struct acm {
struct usb_device *dev; /* the coresponding usb device */ struct usb_device *dev; /* the corresponding usb device */
struct usb_interface *iface; /* the interfaces - +0 control +1 data */ struct usb_interface *iface; /* the interfaces - +0 control +1 data */
struct tty_struct *tty; /* the coresponding tty */ struct tty_struct *tty; /* the corresponding tty */
struct urb *ctrlurb, *readurb, *writeurb; /* urbs */ struct urb *ctrlurb, *readurb, *writeurb; /* urbs */
struct acm_line line; /* line coding (bits, stop, parity) */ struct acm_line line; /* line coding (bits, stop, parity) */
struct work_struct work; /* work queue entry for line discipline waking up */ struct work_struct work; /* work queue entry for line discipline waking up */
......
...@@ -1270,7 +1270,7 @@ static void *find_descriptor( void *descStart, unsigned int descLength, void *af ...@@ -1270,7 +1270,7 @@ static void *find_descriptor( void *descStart, unsigned int descLength, void *af
return NULL; return NULL;
} }
/** Utility to find a class-specfic interface descriptor. /** Utility to find a class-specific interface descriptor.
* dsubtype is a descriptor subtype * dsubtype is a descriptor subtype
* Called by parseDescriptor(); * Called by parseDescriptor();
**/ **/
......
...@@ -516,7 +516,7 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) ...@@ -516,7 +516,7 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
endpoint = &desc->endpoint[0].desc; endpoint = &desc->endpoint[0].desc;
/* Output endpoint? Curiousier and curiousier.. */ /* Output endpoint? Curiouser and curiouser.. */
if (!(endpoint->bEndpointAddress & USB_DIR_IN)) { if (!(endpoint->bEndpointAddress & USB_DIR_IN)) {
goto descriptor_error; goto descriptor_error;
} }
...@@ -958,7 +958,7 @@ static void usb_hub_events(void) ...@@ -958,7 +958,7 @@ static void usb_hub_events(void)
int i, ret; int i, ret;
/* /*
* We restart the list everytime to avoid a deadlock with * We restart the list every time to avoid a deadlock with
* deleting hubs downstream from this one. This should be * deleting hubs downstream from this one. This should be
* safe since we delete the hub from the event list. * safe since we delete the hub from the event list.
* Not the most efficient, but avoids deadlocks. * Not the most efficient, but avoids deadlocks.
......
...@@ -69,7 +69,7 @@ void usb_free_urb(struct urb *urb) ...@@ -69,7 +69,7 @@ void usb_free_urb(struct urb *urb)
* usb_get_urb - increments the reference count of the urb * usb_get_urb - increments the reference count of the urb
* @urb: pointer to the urb to modify * @urb: pointer to the urb to modify
* *
* This must be called whenever a urb is transfered from a device driver to a * This must be called whenever a urb is transferred from a device driver to a
* host controller driver. This allows proper reference counting to happen * host controller driver. This allows proper reference counting to happen
* for urbs. * for urbs.
* *
...@@ -383,7 +383,7 @@ int usb_unlink_urb(struct urb *urb) ...@@ -383,7 +383,7 @@ int usb_unlink_urb(struct urb *urb)
{ {
/* FIXME /* FIXME
* We should not care about the state here, but the host controllers * We should not care about the state here, but the host controllers
* die a horrible death if we submit a urb for a device that has been * die a horrible death if we unlink a urb for a device that has been
* physically removed. * physically removed.
*/ */
if (urb && if (urb &&
......
...@@ -605,7 +605,7 @@ static struct urb *qu_return_urb (hci_t * hci, struct urb * urb, int resub_ok) ...@@ -605,7 +605,7 @@ static struct urb *qu_return_urb (hci_t * hci, struct urb * urb, int resub_ok)
/*************************************************************************** /***************************************************************************
* Function Name : sh_scan_iso_urb_list * Function Name : sh_scan_iso_urb_list
* *
* This function goes throught the isochronous urb list and schedule the * This function goes through the isochronous urb list and schedule the
* the transfer. * the transfer.
* *
* Note: This function has not tested yet * Note: This function has not tested yet
......
...@@ -44,8 +44,8 @@ struct virt_root_hub { ...@@ -44,8 +44,8 @@ struct virt_root_hub {
int devnum; /* Address of Root Hub endpoint */ int devnum; /* Address of Root Hub endpoint */
void *urb; /* interrupt URB of root hub */ void *urb; /* interrupt URB of root hub */
int send; /* active flag */ int send; /* active flag */
int interval; /* intervall of roothub interrupt transfers */ int interval; /* interval of roothub interrupt transfers */
struct timer_list rh_int_timer; /* intervall timer for rh interrupt EP */ struct timer_list rh_int_timer; /* interval timer for rh interrupt EP */
}; };
#if 1 #if 1
......
...@@ -368,7 +368,7 @@ struct hci; ...@@ -368,7 +368,7 @@ struct hci;
#define SL11H_CTL1VAL_RESET 8 #define SL11H_CTL1VAL_RESET 8
/* Interrut enable (addr 6) and interrupt status register bits (addr 0xD) */ /* Interrupt enable (addr 6) and interrupt status register bits (addr 0xD) */
#define SL11H_INTMASK_XFERDONE 1 #define SL11H_INTMASK_XFERDONE 1
#define SL11H_INTMASK_SOFINTR 0x10 #define SL11H_INTMASK_SOFINTR 0x10
#define SL11H_INTMASK_INSRMV 0x20 #define SL11H_INTMASK_INSRMV 0x20
......
...@@ -650,7 +650,7 @@ static void td_submit_urb ( ...@@ -650,7 +650,7 @@ static void td_submit_urb (
/* calculate transfer length/status and update the urb /* calculate transfer length/status and update the urb
* PRECONDITION: irqsafe (only for urb->status locking) * PRECONDITION: irqsafe (only for urb->status locking)
*/ */
static void td_done (struct urb *urb, struct td *td) static void td_done (struct ohci_hcd *ohci, struct urb *urb, struct td *td)
{ {
u32 tdINFO = le32_to_cpup (&td->hwINFO); u32 tdINFO = le32_to_cpup (&td->hwINFO);
int cc = 0; int cc = 0;
...@@ -908,7 +908,7 @@ finish_unlinks (struct ohci_hcd *ohci, u16 tick, struct pt_regs *regs) ...@@ -908,7 +908,7 @@ finish_unlinks (struct ohci_hcd *ohci, u16 tick, struct pt_regs *regs)
*prev = td->hwNextTD | savebits; *prev = td->hwNextTD | savebits;
/* HC may have partly processed this TD */ /* HC may have partly processed this TD */
td_done (urb, td); td_done (ohci, urb, td);
urb_priv->td_cnt++; urb_priv->td_cnt++;
/* if URB is done, clean up */ /* if URB is done, clean up */
...@@ -991,7 +991,7 @@ dl_done_list (struct ohci_hcd *ohci, struct td *td, struct pt_regs *regs) ...@@ -991,7 +991,7 @@ dl_done_list (struct ohci_hcd *ohci, struct td *td, struct pt_regs *regs)
struct ed *ed = td->ed; struct ed *ed = td->ed;
/* update URB's length and status from TD */ /* update URB's length and status from TD */
td_done (urb, td); td_done (ohci, urb, td);
urb_priv->td_cnt++; urb_priv->td_cnt++;
/* If all this urb's TDs are done, call complete() */ /* If all this urb's TDs are done, call complete() */
......
...@@ -136,7 +136,7 @@ static inline void uhci_add_complete(struct uhci_hcd *uhci, struct urb *urb) ...@@ -136,7 +136,7 @@ static inline void uhci_add_complete(struct uhci_hcd *uhci, struct urb *urb)
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&uhci->complete_list_lock, flags); spin_lock_irqsave(&uhci->complete_list_lock, flags);
list_add(&urbp->complete_list, &uhci->complete_list); list_add_tail(&urbp->complete_list, &uhci->complete_list);
spin_unlock_irqrestore(&uhci->complete_list_lock, flags); spin_unlock_irqrestore(&uhci->complete_list_lock, flags);
} }
......
...@@ -303,7 +303,7 @@ static int hpusbscsi_scsi_queuecommand (Scsi_Cmnd *srb, scsi_callback callback) ...@@ -303,7 +303,7 @@ static int hpusbscsi_scsi_queuecommand (Scsi_Cmnd *srb, scsi_callback callback)
} else { } else {
usb_callback = simple_payload_callback; usb_callback = simple_payload_callback;
} }
/* Now we find out which direction data is to be transfered in */ /* Now we find out which direction data is to be transferred in */
hpusbscsi->current_data_pipe = DIRECTION_IS_IN(srb->cmnd[0]) ? hpusbscsi->current_data_pipe = DIRECTION_IS_IN(srb->cmnd[0]) ?
usb_rcvbulkpipe(hpusbscsi->dev, hpusbscsi->ep_in) usb_rcvbulkpipe(hpusbscsi->dev, hpusbscsi->ep_in)
: :
...@@ -410,7 +410,7 @@ DEBUG("Getting status byte %d \n",hpusbscsi->scsi_state_byte); ...@@ -410,7 +410,7 @@ DEBUG("Getting status byte %d \n",hpusbscsi->scsi_state_byte);
} }
if (hpusbscsi->scallback != NULL && hpusbscsi->state == HP_STATE_WAIT && scsi_state != CHECK_CONDITION <<1 ) if (hpusbscsi->scallback != NULL && hpusbscsi->state == HP_STATE_WAIT && scsi_state != CHECK_CONDITION <<1 )
/* we do a callback to the scsi layer if and only if all data has been transfered */ /* we do a callback to the scsi layer if and only if all data has been transferred */
hpusbscsi->scallback(hpusbscsi->srb); hpusbscsi->scallback(hpusbscsi->srb);
TRACE_STATE; TRACE_STATE;
......
...@@ -85,7 +85,7 @@ static Scsi_Host_Template hpusbscsi_scsi_host_template = { ...@@ -85,7 +85,7 @@ static Scsi_Host_Template hpusbscsi_scsi_host_template = {
/* defines for internal driver state */ /* defines for internal driver state */
#define HP_STATE_FREE 0 /*ready for next request */ #define HP_STATE_FREE 0 /*ready for next request */
#define HP_STATE_BEGINNING 1 /*command being transfered */ #define HP_STATE_BEGINNING 1 /*command being transferred */
#define HP_STATE_WORKING 2 /* data transfer stage */ #define HP_STATE_WORKING 2 /* data transfer stage */
#define HP_STATE_ERROR 3 /* error has been reported */ #define HP_STATE_ERROR 3 /* error has been reported */
#define HP_STATE_WAIT 4 /* waiting for status transfer */ #define HP_STATE_WAIT 4 /* waiting for status transfer */
......
/* -*- linux-c -*- */ /* -*- linux-c -*- */
/* /*
* Driver for USB Scanners (linux-2.5.64) * Driver for USB Scanners (linux-2.5)
* *
* Copyright (C) 1999, 2000, 2001, 2002 David E. Nelson * Copyright (C) 1999, 2000, 2001, 2002 David E. Nelson
* Copyright (C) 2002, 2003 Henning Meier-Geinitz * Copyright (C) 2002, 2003 Henning Meier-Geinitz
...@@ -33,8 +33,8 @@ ...@@ -33,8 +33,8 @@
* 0.1 8/31/1999 * 0.1 8/31/1999
* *
* Developed/tested using linux-2.3.15 with minor ohci.c changes to * Developed/tested using linux-2.3.15 with minor ohci.c changes to
* support short packes during bulk xfer mode. Some testing was * support short packets during bulk xfer mode. Some testing was
* done with ohci-hcd but the performace was low. Very limited * done with ohci-hcd but the performance was low. Very limited
* testing was performed with uhci but I was unable to get it to * testing was performed with uhci but I was unable to get it to
* work. Initial relase to the linux-usb development effort. * work. Initial relase to the linux-usb development effort.
* *
...@@ -338,7 +338,7 @@ ...@@ -338,7 +338,7 @@
* Till Kamppeter <till.kamppeter@gmx.net> and others for all the ids. * Till Kamppeter <till.kamppeter@gmx.net> and others for all the ids.
* - Cleaned up list of vendor/product ids. * - Cleaned up list of vendor/product ids.
* - Print information about user-supplied ids only once at startup instead * - Print information about user-supplied ids only once at startup instead
* of everytime any USB device is plugged in. * of every time any USB device is plugged in.
* - Removed PV8630 ioctls. Use the standard ioctls instead. * - Removed PV8630 ioctls. Use the standard ioctls instead.
* - Made endpoint detection more generic. Basically, only one bulk-in * - Made endpoint detection more generic. Basically, only one bulk-in
* endpoint is required, everything else is optional. * endpoint is required, everything else is optional.
...@@ -350,6 +350,9 @@ ...@@ -350,6 +350,9 @@
* - Added vendor/product ids for Artec, Avision, Brother, Medion, Primax, * - Added vendor/product ids for Artec, Avision, Brother, Medion, Primax,
* Prolink, Fujitsu, Plustek, and SYSCAN scanners. * Prolink, Fujitsu, Plustek, and SYSCAN scanners.
* - Fixed generation of devfs names if dynamic minors are disabled. * - Fixed generation of devfs names if dynamic minors are disabled.
* - Used kobject reference counting to free the scn struct when the device
* is closed and disconnected. Avoids crashes when writing to a
* disconnected device. (Thanks to Greg KH).
* *
* TODO * TODO
* - Performance * - Performance
...@@ -427,6 +430,7 @@ irq_scanner(struct urb *urb, struct pt_regs *regs) ...@@ -427,6 +430,7 @@ irq_scanner(struct urb *urb, struct pt_regs *regs)
return; return;
default: default:
dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status); dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status);
return;
} }
dbg("irq_scanner(%d): data:%x", scn->scn_minor, *data); dbg("irq_scanner(%d): data:%x", scn->scn_minor, *data);
...@@ -461,6 +465,7 @@ open_scanner(struct inode * inode, struct file * file) ...@@ -461,6 +465,7 @@ open_scanner(struct inode * inode, struct file * file)
return -ENODEV; return -ENODEV;
} }
scn = usb_get_intfdata(intf); scn = usb_get_intfdata(intf);
kobject_get(&scn->kobj);
dev = scn->scn_dev; dev = scn->scn_dev;
...@@ -521,6 +526,8 @@ close_scanner(struct inode * inode, struct file * file) ...@@ -521,6 +526,8 @@ close_scanner(struct inode * inode, struct file * file)
up(&scn_mutex); up(&scn_mutex);
up(&(scn->sem)); up(&(scn->sem));
kobject_put(&scn->kobj);
return 0; return 0;
} }
...@@ -813,6 +820,37 @@ ioctl_scanner(struct inode *inode, struct file *file, ...@@ -813,6 +820,37 @@ ioctl_scanner(struct inode *inode, struct file *file,
return retval; return retval;
} }
static void destroy_scanner (struct kobject *kobj)
{
struct scn_usb_data *scn;
dbg ("%s", __FUNCTION__);
scn = to_scanner(kobj);
down (&scn_mutex);
down (&(scn->sem));
usb_driver_release_interface(&scanner_driver,
&scn->scn_dev->actconfig->interface[scn->ifnum]);
kfree(scn->ibuf);
kfree(scn->obuf);
dbg("%s: De-allocating minor:%d", __FUNCTION__, scn->scn_minor);
devfs_unregister(scn->devfs);
usb_deregister_dev(1, scn->scn_minor);
usb_free_urb(scn->scn_irq);
usb_put_dev(scn->scn_dev);
up (&(scn->sem));
kfree (scn);
up (&scn_mutex);
}
static struct kobj_type scanner_kobj_type = {
.release = destroy_scanner,
};
static struct static struct
file_operations usb_scanner_fops = { file_operations usb_scanner_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
...@@ -982,6 +1020,8 @@ probe_scanner(struct usb_interface *intf, ...@@ -982,6 +1020,8 @@ probe_scanner(struct usb_interface *intf,
return -ENOMEM; return -ENOMEM;
} }
memset (scn, 0, sizeof(struct scn_usb_data)); memset (scn, 0, sizeof(struct scn_usb_data));
kobject_init(&scn->kobj);
scn->kobj.ktype = &scanner_kobj_type;
scn->scn_irq = usb_alloc_urb(0, GFP_KERNEL); scn->scn_irq = usb_alloc_urb(0, GFP_KERNEL);
if (!scn->scn_irq) { if (!scn->scn_irq) {
...@@ -1049,6 +1089,7 @@ probe_scanner(struct usb_interface *intf, ...@@ -1049,6 +1089,7 @@ probe_scanner(struct usb_interface *intf,
} }
usb_get_dev(dev);
scn->bulk_in_ep = have_bulk_in; scn->bulk_in_ep = have_bulk_in;
scn->bulk_out_ep = have_bulk_out; scn->bulk_out_ep = have_bulk_out;
scn->intr_ep = have_intr; scn->intr_ep = have_intr;
...@@ -1089,28 +1130,13 @@ disconnect_scanner(struct usb_interface *intf) ...@@ -1089,28 +1130,13 @@ disconnect_scanner(struct usb_interface *intf)
intf->kdev = NODEV; intf->kdev = NODEV;
usb_set_intfdata(intf, NULL); usb_set_intfdata(intf, NULL);
if (scn) {
down (&scn_mutex);
down (&(scn->sem));
if(scn->intr_ep) { if(scn->intr_ep) {
dbg("disconnect_scanner(%d): Unlinking IRQ URB", scn->scn_minor); dbg("%s(%d): Unlinking IRQ URB", __FUNCTION__, scn->scn_minor);
usb_unlink_urb(scn->scn_irq); usb_unlink_urb(scn->scn_irq);
} }
usb_driver_release_interface(&scanner_driver,
&scn->scn_dev->actconfig->interface[scn->ifnum]);
kfree(scn->ibuf); if (scn)
kfree(scn->obuf); kobject_put(&scn->kobj);
dbg("disconnect_scanner: De-allocating minor:%d", scn->scn_minor);
devfs_unregister(scn->devfs);
usb_deregister_dev(1, scn->scn_minor);
usb_free_urb(scn->scn_irq);
up (&(scn->sem));
kfree (scn);
up (&scn_mutex);
}
} }
/* we want to look at all devices, as the vendor/product id can change /* we want to look at all devices, as the vendor/product id can change
......
/* /*
* Driver for USB Scanners (linux-2.5.64) * Driver for USB Scanners (linux-2.5)
* *
* Copyright (C) 1999, 2000, 2001, 2002 David E. Nelson * Copyright (C) 1999, 2000, 2001, 2002 David E. Nelson
* Previously maintained by Brian Beattie * Previously maintained by Brian Beattie
...@@ -335,7 +335,9 @@ struct scn_usb_data { ...@@ -335,7 +335,9 @@ struct scn_usb_data {
wait_queue_head_t rd_wait_q; /* read timeouts */ wait_queue_head_t rd_wait_q; /* read timeouts */
struct semaphore sem; /* lock to prevent concurrent reads or writes */ struct semaphore sem; /* lock to prevent concurrent reads or writes */
unsigned int rd_nak_timeout; /* Seconds to wait before read() timeout. */ unsigned int rd_nak_timeout; /* Seconds to wait before read() timeout. */
struct kobject kobj; /* Handles our reference counting */
}; };
#define to_scanner(d) container_of(d, struct scn_usb_data, kobj)
extern devfs_handle_t usb_devfs_handle; extern devfs_handle_t usb_devfs_handle;
......
...@@ -954,7 +954,7 @@ void hid_output_report(struct hid_report *report, __u8 *data) ...@@ -954,7 +954,7 @@ void hid_output_report(struct hid_report *report, __u8 *data)
/* /*
* Set a field value. The report this field belongs to has to be * Set a field value. The report this field belongs to has to be
* created and transfered to the device, to set this value in the * created and transferred to the device, to set this value in the
* device. * device.
*/ */
......
...@@ -480,7 +480,7 @@ static void hidinput_close(struct input_dev *dev) ...@@ -480,7 +480,7 @@ static void hidinput_close(struct input_dev *dev)
/* /*
* Register the input device; print a message. * Register the input device; print a message.
* Configure the input layer interface * Configure the input layer interface
* Read all reports and initalize the absoulte field values. * Read all reports and initialize the absolute field values.
*/ */
int hidinput_connect(struct hid_device *hid) int hidinput_connect(struct hid_device *hid)
......
...@@ -209,8 +209,8 @@ struct hid_item { ...@@ -209,8 +209,8 @@ struct hid_item {
#define HID_QUIRK_BADPAD 0x20 #define HID_QUIRK_BADPAD 0x20
/* /*
* This is the global enviroment of the parser. This information is * This is the global environment of the parser. This information is
* persistent for main-items. The global enviroment can be saved and * persistent for main-items. The global environment can be saved and
* restored with PUSH/POP statements. * restored with PUSH/POP statements.
*/ */
...@@ -228,7 +228,7 @@ struct hid_global { ...@@ -228,7 +228,7 @@ struct hid_global {
}; };
/* /*
* This is the local enviroment. It is resistent up the next main-item. * This is the local environment. It is persistent up the next main-item.
*/ */
#define HID_MAX_DESCRIPTOR_SIZE 4096 #define HID_MAX_DESCRIPTOR_SIZE 4096
......
...@@ -33,6 +33,12 @@ ...@@ -33,6 +33,12 @@
History: History:
Version 0.30:
Markus: Updates for 2.5.x kernel and more ISO compiant source
Version 0.25:
PSL and Markus: Cleanup, radio now doesn't stop on device close
Version 0.24: Version 0.24:
Markus: Hope I got these silly VIDEO_TUNER_LOW issues finally Markus: Hope I got these silly VIDEO_TUNER_LOW issues finally
right. Some minor cleanup, improved standalone compilation right. Some minor cleanup, improved standalone compilation
...@@ -69,15 +75,22 @@ ...@@ -69,15 +75,22 @@
/* /*
* Version Information * Version Information
*/ */
#define DRIVER_VERSION "v0.24" #define DRIVER_VERSION "v0.25"
#define DRIVER_AUTHOR "Markus Demleitner <msdemlei@tucana.harvard.edu>" #define DRIVER_AUTHOR "Markus Demleitner <msdemlei@tucana.harvard.edu>"
#define DRIVER_DESC "D-Link DSB-R100 USB radio driver" #define DRIVER_DESC "D-Link DSB-R100 USB FM radio driver"
#define DSB100_VENDOR 0x04b4 #define DSB100_VENDOR 0x04b4
#define DSB100_PRODUCT 0x1002 #define DSB100_PRODUCT 0x1002
#define TB_LEN 16 #define TB_LEN 16
/* Frequency limits in MHz -- these are European values. For Japanese
devices, that would be 76 and 91. */
#define FREQ_MIN 87.5
#define FREQ_MAX 108.0
#define FREQ_MUL 16000
static int usb_dsbr100_probe(struct usb_interface *intf, static int usb_dsbr100_probe(struct usb_interface *intf,
const struct usb_device_id *id); const struct usb_device_id *id);
static void usb_dsbr100_disconnect(struct usb_interface *intf); static void usb_dsbr100_disconnect(struct usb_interface *intf);
...@@ -108,7 +121,7 @@ static struct file_operations usb_dsbr100_fops = { ...@@ -108,7 +121,7 @@ static struct file_operations usb_dsbr100_fops = {
static struct video_device usb_dsbr100_radio= static struct video_device usb_dsbr100_radio=
{ {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "D-Link DSB R-100 USB radio", .name = "D-Link DSB-R 100",
.type = VID_TYPE_TUNER, .type = VID_TYPE_TUNER,
.hardware = VID_HARDWARE_AZTECH, .hardware = VID_HARDWARE_AZTECH,
.fops = &usb_dsbr100_fops, .fops = &usb_dsbr100_fops,
...@@ -189,7 +202,7 @@ static int usb_dsbr100_probe(struct usb_interface *intf, ...@@ -189,7 +202,7 @@ static int usb_dsbr100_probe(struct usb_interface *intf,
return -ENOMEM; return -ENOMEM;
usb_dsbr100_radio.priv = radio; usb_dsbr100_radio.priv = radio;
radio->dev = interface_to_usbdev (intf); radio->dev = interface_to_usbdev (intf);
radio->curfreq = 1454000; radio->curfreq = FREQ_MIN*FREQ_MUL;
usb_set_intfdata (intf, radio); usb_set_intfdata (intf, radio);
return 0; return 0;
} }
...@@ -225,11 +238,11 @@ static int usb_dsbr100_do_ioctl(struct inode *inode, struct file *file, ...@@ -225,11 +238,11 @@ static int usb_dsbr100_do_ioctl(struct inode *inode, struct file *file,
{ {
case VIDIOCGCAP: { case VIDIOCGCAP: {
struct video_capability *v = arg; struct video_capability *v = arg;
memset(v,0,sizeof(*v)); memset(v, 0, sizeof(*v));
v->type=VID_TYPE_TUNER; v->type = VID_TYPE_TUNER;
v->channels=1; v->channels = 1;
v->audios=1; v->audios = 1;
strcpy(v->name, "D-Link R-100 USB Radio"); strcpy(v->name, "D-Link R-100 USB FM Radio");
return 0; return 0;
} }
case VIDIOCGTUNER: { case VIDIOCGTUNER: {
...@@ -237,8 +250,8 @@ static int usb_dsbr100_do_ioctl(struct inode *inode, struct file *file, ...@@ -237,8 +250,8 @@ static int usb_dsbr100_do_ioctl(struct inode *inode, struct file *file,
dsbr100_getstat(radio); dsbr100_getstat(radio);
if(v->tuner) /* Only 1 tuner */ if(v->tuner) /* Only 1 tuner */
return -EINVAL; return -EINVAL;
v->rangelow = 87*16000; v->rangelow = FREQ_MIN*FREQ_MUL;
v->rangehigh = 108*16000; v->rangehigh = FREQ_MAX*FREQ_MUL;
v->flags = VIDEO_TUNER_LOW; v->flags = VIDEO_TUNER_LOW;
v->mode = VIDEO_MODE_AUTO; v->mode = VIDEO_MODE_AUTO;
v->signal = radio->stereo*0x7000; v->signal = radio->stereo*0x7000;
...@@ -268,31 +281,31 @@ static int usb_dsbr100_do_ioctl(struct inode *inode, struct file *file, ...@@ -268,31 +281,31 @@ static int usb_dsbr100_do_ioctl(struct inode *inode, struct file *file,
radio->curfreq = *freq; radio->curfreq = *freq;
if (dsbr100_setfreq(radio, radio->curfreq)==-1) if (dsbr100_setfreq(radio, radio->curfreq)==-1)
warn("set frequency failed"); warn("Set frequency failed");
return 0; return 0;
} }
case VIDIOCGAUDIO: { case VIDIOCGAUDIO: {
struct video_audio *v = arg; struct video_audio *v = arg;
memset(v,0, sizeof(*v)); memset(v, 0, sizeof(*v));
v->flags|=VIDEO_AUDIO_MUTABLE; v->flags |= VIDEO_AUDIO_MUTABLE;
v->mode=VIDEO_SOUND_STEREO; v->mode = VIDEO_SOUND_STEREO;
v->volume=1; v->volume = 1;
v->step=1; v->step = 1;
strcpy(v->name, "Radio"); strcpy(v->name, "Radio");
return 0; return 0;
} }
case VIDIOCSAUDIO: { case VIDIOCSAUDIO: {
struct video_audio *v = arg; struct video_audio *v = arg;
if(v->audio) if (v->audio)
return -EINVAL; return -EINVAL;
if(v->flags&VIDEO_AUDIO_MUTE) { if (v->flags&VIDEO_AUDIO_MUTE) {
if (dsbr100_stop(radio)==-1) if (dsbr100_stop(radio)==-1)
warn("radio did not respond properly"); warn("Radio did not respond properly");
} }
else else
if (dsbr100_start(radio)==-1) if (dsbr100_start(radio)==-1)
warn("radio did not respond properly"); warn("Radio did not respond properly");
return 0; return 0;
} }
default: default:
...@@ -312,18 +325,18 @@ static int usb_dsbr100_open(struct inode *inode, struct file *file) ...@@ -312,18 +325,18 @@ static int usb_dsbr100_open(struct inode *inode, struct file *file)
usb_dsbr100 *radio=dev->priv; usb_dsbr100 *radio=dev->priv;
if (! radio) { if (! radio) {
warn("radio not initialised"); warn("Radio not initialised");
return -EAGAIN; return -EAGAIN;
} }
if(users) if(users)
{ {
warn("radio in use"); warn("Radio in use");
return -EBUSY; return -EBUSY;
} }
users++; users++;
if (dsbr100_start(radio)<0) if (dsbr100_start(radio)<0)
warn("radio did not start up properly"); warn("Radio did not start up properly");
dsbr100_setfreq(radio,radio->curfreq); dsbr100_setfreq(radio, radio->curfreq);
return 0; return 0;
} }
...@@ -335,7 +348,6 @@ static int usb_dsbr100_close(struct inode *inode, struct file *file) ...@@ -335,7 +348,6 @@ static int usb_dsbr100_close(struct inode *inode, struct file *file)
if (!radio) if (!radio)
return -ENODEV; return -ENODEV;
users--; users--;
dsbr100_stop(radio);
return 0; return 0;
} }
...@@ -343,8 +355,9 @@ static int __init dsbr100_init(void) ...@@ -343,8 +355,9 @@ static int __init dsbr100_init(void)
{ {
usb_dsbr100_radio.priv = NULL; usb_dsbr100_radio.priv = NULL;
usb_register(&usb_dsbr100_driver); usb_register(&usb_dsbr100_driver);
if (video_register_device(&usb_dsbr100_radio,VFL_TYPE_RADIO,radio_nr)==-1) { if (video_register_device(&usb_dsbr100_radio, VFL_TYPE_RADIO,
warn("couldn't register video device"); radio_nr)==-1) {
warn("Couldn't register video device");
return -EINVAL; return -EINVAL;
} }
info(DRIVER_VERSION ":" DRIVER_DESC); info(DRIVER_VERSION ":" DRIVER_DESC);
...@@ -367,9 +380,3 @@ module_exit (dsbr100_exit); ...@@ -367,9 +380,3 @@ module_exit (dsbr100_exit);
MODULE_AUTHOR( DRIVER_AUTHOR ); MODULE_AUTHOR( DRIVER_AUTHOR );
MODULE_DESCRIPTION( DRIVER_DESC ); MODULE_DESCRIPTION( DRIVER_DESC );
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
/*
vi: ts=8
Sigh. Of course, I am one of the ts=2 heretics, but Linus' wish is
my command.
*/
...@@ -65,7 +65,7 @@ static const int debug = 0; ...@@ -65,7 +65,7 @@ static const int debug = 0;
#endif #endif
/* Some default values for inital camera settings, /* Some default values for initial camera settings,
can be set by modprobe */ can be set by modprobe */
static enum frame_sizes size; static enum frame_sizes size;
......
...@@ -129,7 +129,7 @@ static struct Nala_table_entry Nala_table[PSZ_MAX][8] = ...@@ -129,7 +129,7 @@ static struct Nala_table_entry Nala_table[PSZ_MAX][8] =
4 compression modi: none, low, medium, high 4 compression modi: none, low, medium, high
When an uncompressed mode is not available, the next available compressed mode When an uncompressed mode is not available, the next available compressed mode
will be choosen (unless the decompressor is absent). Sometimes there are only will be chosen (unless the decompressor is absent). Sometimes there are only
1 or 2 compressed modes available; in that case entries are duplicated. 1 or 2 compressed modes available; in that case entries are duplicated.
*/ */
struct Timon_table_entry struct Timon_table_entry
......
...@@ -255,7 +255,7 @@ static int pwc_allocate_buffers(struct pwc_device *pdev) ...@@ -255,7 +255,7 @@ static int pwc_allocate_buffers(struct pwc_device *pdev)
return -ENXIO; return -ENXIO;
} }
#endif #endif
/* Allocate Isochronuous pipe buffers */ /* Allocate Isochronous pipe buffers */
for (i = 0; i < MAX_ISO_BUFS; i++) { for (i = 0; i < MAX_ISO_BUFS; i++) {
if (pdev->sbuf[i].data == NULL) { if (pdev->sbuf[i].data == NULL) {
kbuf = kmalloc(ISO_BUFFER_SIZE, GFP_KERNEL); kbuf = kmalloc(ISO_BUFFER_SIZE, GFP_KERNEL);
...@@ -811,7 +811,7 @@ static int pwc_isoc_init(struct pwc_device *pdev) ...@@ -811,7 +811,7 @@ static int pwc_isoc_init(struct pwc_device *pdev)
if (pdev->vmax_packet_size < 0 || pdev->vmax_packet_size > ISO_MAX_FRAME_SIZE) { if (pdev->vmax_packet_size < 0 || pdev->vmax_packet_size > ISO_MAX_FRAME_SIZE) {
Err("Failed to find packet size for video endpoint in current alternate setting.\n"); Err("Failed to find packet size for video endpoint in current alternate setting.\n");
return -ENFILE; /* Odd error, that should be noticable */ return -ENFILE; /* Odd error, that should be noticeable */
} }
/* Set alternate interface */ /* Set alternate interface */
...@@ -2040,7 +2040,7 @@ static int __init usb_pwc_init(void) ...@@ -2040,7 +2040,7 @@ static int __init usb_pwc_init(void)
if (leds[1] >= 0) if (leds[1] >= 0)
led_off = leds[1]; led_off = leds[1];
/* Big device node whoopla. Basicly, it allows you to assign a /* Big device node whoopla. Basically, it allows you to assign a
device node (/dev/videoX) to a camera, based on its type device node (/dev/videoX) to a camera, based on its type
& serial number. The format is [type[.serialnumber]:]node. & serial number. The format is [type[.serialnumber]:]node.
......
...@@ -32,7 +32,7 @@ static LIST_HEAD(pwc_decompressor_list); ...@@ -32,7 +32,7 @@ static LIST_HEAD(pwc_decompressor_list);
/* Should the pwc_decompress structure ever change, we increase the /* Should the pwc_decompress structure ever change, we increase the
version number so that we don't get nasty surprises, or can version number so that we don't get nasty surprises, or can
dynamicly adjust our structure. dynamically adjust our structure.
*/ */
const int pwc_decompressor_version = PWC_MAJOR; const int pwc_decompressor_version = PWC_MAJOR;
......
...@@ -147,7 +147,7 @@ struct pwc_device ...@@ -147,7 +147,7 @@ struct pwc_device
2. data is synchronized and packed into a frame buffer 2. data is synchronized and packed into a frame buffer
3a. in case data is compressed, decompress it directly into image buffer 3a. in case data is compressed, decompress it directly into image buffer
3b. in case data is uncompressed, copy into image buffer with viewport 3b. in case data is uncompressed, copy into image buffer with viewport
4. data is transfered to the user process 4. data is transferred to the user process
Note that MAX_ISO_BUFS != MAX_FRAMES != MAX_IMAGES.... Note that MAX_ISO_BUFS != MAX_FRAMES != MAX_IMAGES....
We have in effect a back-to-back-double-buffer system. We have in effect a back-to-back-double-buffer system.
......
...@@ -692,7 +692,7 @@ static int se401_set_size(struct usb_se401 *se401, int width, int height) ...@@ -692,7 +692,7 @@ static int se401_set_size(struct usb_se401 *se401, int width, int height)
/* /*
This shouldn't really be done in a v4l driver.... This shouldn't really be done in a v4l driver....
But it does make the image look a lot more usable. But it does make the image look a lot more usable.
Basicly it lifts the dark pixels more than the light pixels. Basically it lifts the dark pixels more than the light pixels.
*/ */
static inline void enhance_picture(unsigned char *frame, int len) static inline void enhance_picture(unsigned char *frame, int len)
{ {
......
...@@ -531,7 +531,7 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign ...@@ -531,7 +531,7 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign
return -ENODEV; return -ENODEV;
switch (ioctlnr) { switch (ioctlnr) {
/* query capabilites */ /* query capabilities */
case VIDIOCGCAP: case VIDIOCGCAP:
{ {
struct video_capability b; struct video_capability b;
......
...@@ -687,10 +687,10 @@ static int auerchain_start_wait_urb (pauerchain_t acp, struct urb *urb, int time ...@@ -687,10 +687,10 @@ static int auerchain_start_wait_urb (pauerchain_t acp, struct urb *urb, int time
This function sends a simple control message to a specified endpoint This function sends a simple control message to a specified endpoint
and waits for the message to complete, or timeout. and waits for the message to complete, or timeout.
If successful, it returns the transfered length, othwise a negative error number. If successful, it returns the transferred length, otherwise a negative error number.
Don't use this function from within an interrupt context, like a Don't use this function from within an interrupt context, like a
bottom half handler. If you need a asyncronous message, or need to send bottom half handler. If you need an asynchronous message, or need to send
a message from within interrupt context, use auerchain_submit_urb() a message from within interrupt context, use auerchain_submit_urb()
*/ */
static int auerchain_control_msg (pauerchain_t acp, struct usb_device *dev, unsigned int pipe, __u8 request, __u8 requesttype, static int auerchain_control_msg (pauerchain_t acp, struct usb_device *dev, unsigned int pipe, __u8 request, __u8 requesttype,
...@@ -814,7 +814,7 @@ static int auerbuf_setup (pauerbufctl_t bcp, unsigned int numElements, unsigned ...@@ -814,7 +814,7 @@ static int auerbuf_setup (pauerbufctl_t bcp, unsigned int numElements, unsigned
} }
return 0; return 0;
bl_fail:/* not enought memory. Free allocated elements */ bl_fail:/* not enough memory. Free allocated elements */
dbg ("auerbuf_setup: no more memory"); dbg ("auerbuf_setup: no more memory");
auerbuf_free_buffers (bcp); auerbuf_free_buffers (bcp);
return -ENOMEM; return -ENOMEM;
...@@ -1083,7 +1083,7 @@ static void auerswald_int_complete (struct urb * urb, struct pt_regs *regs) ...@@ -1083,7 +1083,7 @@ static void auerswald_int_complete (struct urb * urb, struct pt_regs *regs)
/* can we do something more? /* can we do something more?
This is a big problem: if this int packet is ignored, the This is a big problem: if this int packet is ignored, the
device will wait forever and not signal any more data. device will wait forever and not signal any more data.
The only real solution is: having enought buffers! The only real solution is: having enough buffers!
Or perhaps temporary disabling the int endpoint? Or perhaps temporary disabling the int endpoint?
*/ */
goto exit; goto exit;
...@@ -1130,7 +1130,7 @@ static void auerswald_int_free (pauerswald_t cp) ...@@ -1130,7 +1130,7 @@ static void auerswald_int_free (pauerswald_t cp)
} }
/* This function is called to activate the interrupt /* This function is called to activate the interrupt
endpoint. This function returns 0 if successfull or an error code. endpoint. This function returns 0 if successful or an error code.
NOTE: no mutex please! NOTE: no mutex please!
*/ */
static int auerswald_int_open (pauerswald_t cp) static int auerswald_int_open (pauerswald_t cp)
...@@ -1181,7 +1181,7 @@ static int auerswald_int_open (pauerswald_t cp) ...@@ -1181,7 +1181,7 @@ static int auerswald_int_open (pauerswald_t cp)
} }
/* This function is called to deactivate the interrupt /* This function is called to deactivate the interrupt
endpoint. This function returns 0 if successfull or an error code. endpoint. This function returns 0 if successful or an error code.
NOTE: no mutex please! NOTE: no mutex please!
*/ */
static int auerswald_int_release (pauerswald_t cp) static int auerswald_int_release (pauerswald_t cp)
...@@ -1713,7 +1713,7 @@ static ssize_t auerchar_read (struct file *file, char *buf, size_t count, loff_t ...@@ -1713,7 +1713,7 @@ static ssize_t auerchar_read (struct file *file, char *buf, size_t count, loff_t
return -ERESTARTSYS; return -ERESTARTSYS;
} }
/* try to read the incomming data again */ /* try to read the incoming data again */
goto doreadlist; goto doreadlist;
} }
...@@ -2075,7 +2075,7 @@ pfail: auerswald_delete (cp); ...@@ -2075,7 +2075,7 @@ pfail: auerswald_delete (cp);
The argument dev specifies the device context and the driver_context The argument dev specifies the device context and the driver_context
returns a pointer to the previously registered driver_context of the returns a pointer to the previously registered driver_context of the
probe function. After returning from the disconnect function the USB probe function. After returning from the disconnect function the USB
framework completly deallocates all data structures associated with framework completely deallocates all data structures associated with
this device. So especially the usb_device structure must not be used this device. So especially the usb_device structure must not be used
any longer by the usb driver. any longer by the usb driver.
*/ */
......
...@@ -193,7 +193,7 @@ struct udsl_instance_data { ...@@ -193,7 +193,7 @@ struct udsl_instance_data {
static const char udsl_driver_name [] = "speedtch"; static const char udsl_driver_name [] = "speedtch";
/* /*
* atm driver prototypes and stuctures * atm driver prototypes and structures
*/ */
static void udsl_atm_dev_close (struct atm_dev *dev); static void udsl_atm_dev_close (struct atm_dev *dev);
...@@ -273,39 +273,60 @@ static void udsl_groom_skb (struct atm_vcc *vcc, struct sk_buff *skb) { ...@@ -273,39 +273,60 @@ static void udsl_groom_skb (struct atm_vcc *vcc, struct sk_buff *skb) {
ctrl->aal5_trailer [7] = crc; ctrl->aal5_trailer [7] = crc;
} }
static char *udsl_write_cell (struct sk_buff *skb, char *target) { unsigned int udsl_write_cells (unsigned int howmany, struct sk_buff *skb, unsigned char **target_p) {
struct udsl_control *ctrl = UDSL_SKB (skb); struct udsl_control *ctrl = UDSL_SKB (skb);
unsigned char *target = *target_p;
unsigned int nc, ne, i;
ctrl->num_cells--; dbg ("udsl_write_cells: howmany=%u, skb->len=%d, num_cells=%u, num_entire=%u, pdu_padding=%u", howmany, skb->len, ctrl->num_cells, ctrl->num_entire, ctrl->pdu_padding);
nc = ctrl->num_cells;
ne = min (howmany, ctrl->num_entire);
for (i = 0; i < ne; i++) {
memcpy (target, ctrl->cell_header, ATM_CELL_HEADER); memcpy (target, ctrl->cell_header, ATM_CELL_HEADER);
target += ATM_CELL_HEADER; target += ATM_CELL_HEADER;
if (ctrl->num_entire) {
ctrl->num_entire--;
memcpy (target, skb->data, ATM_CELL_PAYLOAD); memcpy (target, skb->data, ATM_CELL_PAYLOAD);
target += ATM_CELL_PAYLOAD; target += ATM_CELL_PAYLOAD;
__skb_pull (skb, ATM_CELL_PAYLOAD); __skb_pull (skb, ATM_CELL_PAYLOAD);
return target;
} }
ctrl->num_entire -= ne;
if (!(ctrl->num_cells -= ne) || !(howmany -= ne))
goto out;
memcpy (target, ctrl->cell_header, ATM_CELL_HEADER);
target += ATM_CELL_HEADER;
memcpy (target, skb->data, skb->len); memcpy (target, skb->data, skb->len);
target += skb->len; target += skb->len;
__skb_pull (skb, skb->len); __skb_pull (skb, skb->len);
memset (target, 0, ctrl->pdu_padding); memset (target, 0, ctrl->pdu_padding);
target += ctrl->pdu_padding; target += ctrl->pdu_padding;
if (ctrl->num_cells) { if (--ctrl->num_cells) {
if (!--howmany) {
ctrl->pdu_padding = ATM_CELL_PAYLOAD - ATM_AAL5_TRAILER; ctrl->pdu_padding = ATM_CELL_PAYLOAD - ATM_AAL5_TRAILER;
} else { goto out;
}
memcpy (target, ctrl->cell_header, ATM_CELL_HEADER);
target += ATM_CELL_HEADER;
memset (target, 0, ATM_CELL_PAYLOAD - ATM_AAL5_TRAILER);
target += ATM_CELL_PAYLOAD - ATM_AAL5_TRAILER;
if (--ctrl->num_cells)
BUG();
}
memcpy (target, ctrl->aal5_trailer, ATM_AAL5_TRAILER); memcpy (target, ctrl->aal5_trailer, ATM_AAL5_TRAILER);
target += ATM_AAL5_TRAILER; target += ATM_AAL5_TRAILER;
/* set pti bit in last cell */ /* set pti bit in last cell */
*(target + 3 - ATM_CELL_SIZE) |= 0x2; *(target + 3 - ATM_CELL_SIZE) |= 0x2;
}
return target; out:
*target_p = target;
return nc - ctrl->num_cells;
} }
...@@ -500,14 +521,12 @@ static void udsl_complete_send (struct urb *urb, struct pt_regs *regs) ...@@ -500,14 +521,12 @@ static void udsl_complete_send (struct urb *urb, struct pt_regs *regs)
static void udsl_process_send (unsigned long data) static void udsl_process_send (unsigned long data)
{ {
struct udsl_send_buffer *buf; struct udsl_send_buffer *buf;
unsigned int cells_to_write;
int err; int err;
unsigned long flags; unsigned long flags;
unsigned int i;
struct udsl_instance_data *instance = (struct udsl_instance_data *) data; struct udsl_instance_data *instance = (struct udsl_instance_data *) data;
unsigned int num_written;
struct sk_buff *skb; struct sk_buff *skb;
struct udsl_sender *snd; struct udsl_sender *snd;
unsigned char *target;
dbg ("udsl_process_send entered"); dbg ("udsl_process_send entered");
...@@ -577,16 +596,11 @@ static void udsl_process_send (unsigned long data) ...@@ -577,16 +596,11 @@ static void udsl_process_send (unsigned long data)
instance->current_buffer = buf; instance->current_buffer = buf;
} }
cells_to_write = min (buf->free_cells, UDSL_SKB (skb)->num_cells); num_written = udsl_write_cells (buf->free_cells, skb, &buf->free_start);
target = buf->free_start;
dbg ("writing %u cells from skb 0x%p to buffer 0x%p", cells_to_write, skb, buf);
for (i = 0; i < cells_to_write; i++) dbg ("wrote %u cells from skb 0x%p to buffer 0x%p", num_written, skb, buf);
target = udsl_write_cell (skb, target);
buf->free_start = target; if (!(buf->free_cells -= num_written)) {
if (!(buf->free_cells -= cells_to_write)) {
list_add_tail (&buf->list, &instance->filled_buffers); list_add_tail (&buf->list, &instance->filled_buffers);
instance->current_buffer = NULL; instance->current_buffer = NULL;
dbg ("queued filled buffer"); dbg ("queued filled buffer");
......
...@@ -1707,7 +1707,7 @@ static int usbnet_stop (struct net_device *net) ...@@ -1707,7 +1707,7 @@ static int usbnet_stop (struct net_device *net)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
// posts reads, and enables write queing // posts reads, and enables write queuing
// precondition: never called in_interrupt // precondition: never called in_interrupt
......
...@@ -215,7 +215,7 @@ static int belkin_sa_open (struct usb_serial_port *port, struct file *filp) ...@@ -215,7 +215,7 @@ static int belkin_sa_open (struct usb_serial_port *port, struct file *filp)
dbg("%s port %d", __FUNCTION__, port->number); dbg("%s port %d", __FUNCTION__, port->number);
/*Start reading from the device*/ /*Start reading from the device*/
/* TODO: Look at possibility of submitting mulitple URBs to device to /* TODO: Look at possibility of submitting multiple URBs to device to
* enhance buffering. Win trace shows 16 initial read URBs. * enhance buffering. Win trace shows 16 initial read URBs.
*/ */
port->read_urb->dev = port->serial->dev; port->read_urb->dev = port->serial->dev;
......
...@@ -302,7 +302,7 @@ static void cyberjack_read_int_callback( struct urb *urb, struct pt_regs *regs ) ...@@ -302,7 +302,7 @@ static void cyberjack_read_int_callback( struct urb *urb, struct pt_regs *regs )
short old_rdtodo = priv->rdtodo; short old_rdtodo = priv->rdtodo;
int result; int result;
/* This is a announcement of comming bulk_ins. */ /* This is a announcement of coming bulk_ins. */
unsigned short size = ((unsigned short)data[3]<<8)+data[2]+3; unsigned short size = ((unsigned short)data[3]<<8)+data[2]+3;
if( (size>259) || (size==0) ) { if( (size>259) || (size==0) ) {
......
...@@ -1086,7 +1086,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp) ...@@ -1086,7 +1086,7 @@ static int edge_open (struct usb_serial_port *port, struct file * filp)
return -ENODEV; return -ENODEV;
} }
/* now wait for the port to be completly opened */ /* now wait for the port to be completely opened */
timeout = OPEN_TIMEOUT; timeout = OPEN_TIMEOUT;
while (timeout && edge_port->openPending == TRUE) { while (timeout && edge_port->openPending == TRUE) {
timeout = interruptible_sleep_on_timeout (&edge_port->wait_open, timeout); timeout = interruptible_sleep_on_timeout (&edge_port->wait_open, timeout);
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
The data to and from all ports on the peripheral is multiplexed The data to and from all ports on the peripheral is multiplexed
through a single endpoint pair (EP1 since it supports 64-byte through a single endpoint pair (EP1 since it supports 64-byte
MaxPacketSize). Therefore, the data, commands, and status for MaxPacketSize). Therefore, the data, commands, and status for
each port must be preceeded by a short header identifying the each port must be preceded by a short header identifying the
destination port. The header also identifies the bytes that follow destination port. The header also identifies the bytes that follow
as data or as command/status info. as data or as command/status info.
......
...@@ -468,7 +468,7 @@ static int TIIsTxActive (struct edgeport_port *port) ...@@ -468,7 +468,7 @@ static int TIIsTxActive (struct edgeport_port *port)
{ {
int status; int status;
struct out_endpoint_desc_block *oedb; struct out_endpoint_desc_block *oedb;
__u8 lsr; __u8 *lsr;
int bytes_left = 0; int bytes_left = 0;
oedb = kmalloc (sizeof (* oedb), GFP_KERNEL); oedb = kmalloc (sizeof (* oedb), GFP_KERNEL);
...@@ -477,6 +477,13 @@ static int TIIsTxActive (struct edgeport_port *port) ...@@ -477,6 +477,13 @@ static int TIIsTxActive (struct edgeport_port *port)
return -ENOMEM; return -ENOMEM;
} }
lsr = kmalloc (1, GFP_KERNEL); /* Sigh, that's right, just one byte,
as not all platforms can do DMA
from stack */
if (!lsr) {
kfree(oedb);
return -ENOMEM;
}
/* Read the DMA Count Registers */ /* Read the DMA Count Registers */
status = TIReadRam (port->port->serial->dev, status = TIReadRam (port->port->serial->dev,
port->dma_address, port->dma_address,
...@@ -492,22 +499,25 @@ static int TIIsTxActive (struct edgeport_port *port) ...@@ -492,22 +499,25 @@ static int TIIsTxActive (struct edgeport_port *port)
status = TIReadRam (port->port->serial->dev, status = TIReadRam (port->port->serial->dev,
port->uart_base + UMPMEM_OFFS_UART_LSR, port->uart_base + UMPMEM_OFFS_UART_LSR,
1, 1,
&lsr); lsr);
if (status) if (status)
goto exit_is_tx_active; goto exit_is_tx_active;
dbg ("%s - LSR = 0x%X", __FUNCTION__, lsr); dbg ("%s - LSR = 0x%X", __FUNCTION__, *lsr);
/* If either buffer has data or we are transmitting then return TRUE */ /* If either buffer has data or we are transmitting then return TRUE */
if ((oedb->XByteCount & 0x80 ) != 0 ) if ((oedb->XByteCount & 0x80 ) != 0 )
bytes_left += 64; bytes_left += 64;
if ((lsr & UMP_UART_LSR_TX_MASK ) == 0 ) if ((*lsr & UMP_UART_LSR_TX_MASK ) == 0 )
bytes_left += 1; bytes_left += 1;
/* We return Not Active if we get any kind of error */ /* We return Not Active if we get any kind of error */
exit_is_tx_active: exit_is_tx_active:
dbg ("%s - return %d", __FUNCTION__, bytes_left ); dbg ("%s - return %d", __FUNCTION__, bytes_left );
kfree(lsr);
kfree(oedb);
return bytes_left; return bytes_left;
} }
...@@ -1151,8 +1161,12 @@ static int TIDownloadFirmware (struct edgeport_serial *serial) ...@@ -1151,8 +1161,12 @@ static int TIDownloadFirmware (struct edgeport_serial *serial)
dbg ( "%s - HARDWARE RESET return %d", __FUNCTION__, status); dbg ( "%s - HARDWARE RESET return %d", __FUNCTION__, status);
/* return an error on purpose. */ /* return an error on purpose. */
kfree (firmware_version);
kfree (rom_desc);
kfree (ti_manuf_desc);
return -ENODEV; return -ENODEV;
} }
kfree (firmware_version);
} }
// Search for type 0xF2 record (firmware blank record) // Search for type 0xF2 record (firmware blank record)
else if ((start_address = TIGetDescriptorAddress (serial, I2C_DESC_TYPE_FIRMWARE_BLANK, rom_desc)) != 0) { else if ((start_address = TIGetDescriptorAddress (serial, I2C_DESC_TYPE_FIRMWARE_BLANK, rom_desc)) != 0) {
......
...@@ -471,7 +471,7 @@ static void ir_read_bulk_callback (struct urb *urb, struct pt_regs *regs) ...@@ -471,7 +471,7 @@ static void ir_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
/* /*
* Bypass flip-buffers, and feed the ldisc directly * Bypass flip-buffers, and feed the ldisc directly
* due to our potentally large buffer size. Since we * due to our potentially large buffer size. Since we
* used to set low_latency, this is exactly what the * used to set low_latency, this is exactly what the
* tty layer did anyway :) * tty layer did anyway :)
*/ */
...@@ -553,7 +553,7 @@ static void ir_set_termios (struct usb_serial_port *port, struct termios *old_te ...@@ -553,7 +553,7 @@ static void ir_set_termios (struct usb_serial_port *port, struct termios *old_te
/* /*
* FIXME, we should compare the baud request against the * FIXME, we should compare the baud request against the
* capability stated in the IR header that we got in the * capability stated in the IR header that we got in the
* startup funtion. * startup function.
*/ */
switch (cflag & CBAUD) { switch (cflag & CBAUD) {
case B2400: ir_baud = SPEED_2400; break; case B2400: ir_baud = SPEED_2400; break;
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
notice, this list of conditions and the following disclaimer in the notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution. documentation and/or other materials provided with the distribution.
3. The name of InnoSys Incorprated may not be used to endorse or promote 3. The name of InnoSys Incorporated may not be used to endorse or promote
products derived from this software without specific prior written products derived from this software without specific prior written
permission. permission.
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
notice, this list of conditions and the following disclaimer in the notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution. documentation and/or other materials provided with the distribution.
3. The name of InnoSys Incorprated may not be used to endorse or promote 3. The name of InnoSys Incorporated may not be used to endorse or promote
products derived from this software without specific prior written products derived from this software without specific prior written
permission. permission.
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
notice, this list of conditions and the following disclaimer in the notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution. documentation and/or other materials provided with the distribution.
3. The name of InnoSys Incorprated may not be used to endorse or promote 3. The name of InnoSys Incorporated may not be used to endorse or promote
products derived from this software without specific prior written products derived from this software without specific prior written
permission. permission.
......
...@@ -253,6 +253,7 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp) ...@@ -253,6 +253,7 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp)
port->write_urb = usb_alloc_urb(0, GFP_KERNEL); port->write_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!port->write_urb) { if (!port->write_urb) {
dbg("%s - port %d usb_alloc_urb failed", __FUNCTION__, port->number); dbg("%s - port %d usb_alloc_urb failed", __FUNCTION__, port->number);
kfree(transfer_buffer);
return -1; return -1;
} }
} }
...@@ -260,6 +261,7 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp) ...@@ -260,6 +261,7 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp)
// allocate memory for write_urb transfer buffer // allocate memory for write_urb transfer buffer
port->write_urb->transfer_buffer = (unsigned char *) kmalloc(write_urb_transfer_buffer_length, GFP_KERNEL); port->write_urb->transfer_buffer = (unsigned char *) kmalloc(write_urb_transfer_buffer_length, GFP_KERNEL);
if (! port->write_urb->transfer_buffer) { if (! port->write_urb->transfer_buffer) {
kfree(transfer_buffer);
return -1; return -1;
} }
......
...@@ -76,6 +76,7 @@ static struct usb_device_id id_table [] = { ...@@ -76,6 +76,7 @@ static struct usb_device_id id_table [] = {
{ USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID) }, { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID) },
{ USB_DEVICE(TRIPP_VENDOR_ID, TRIPP_PRODUCT_ID) }, { USB_DEVICE(TRIPP_VENDOR_ID, TRIPP_PRODUCT_ID) },
{ USB_DEVICE(RADIOSHACK_VENDOR_ID, RADIOSHACK_PRODUCT_ID) }, { USB_DEVICE(RADIOSHACK_VENDOR_ID, RADIOSHACK_PRODUCT_ID) },
{ USB_DEVICE(DCU10_VENDOR_ID, DCU10_PRODUCT_ID) },
{ } /* Terminating entry */ { } /* Terminating entry */
}; };
......
...@@ -34,3 +34,6 @@ ...@@ -34,3 +34,6 @@
#define RADIOSHACK_VENDOR_ID 0x1453 #define RADIOSHACK_VENDOR_ID 0x1453
#define RADIOSHACK_PRODUCT_ID 0x4026 #define RADIOSHACK_PRODUCT_ID 0x4026
#define DCU10_VENDOR_ID 0x0731
#define DCU10_PRODUCT_ID 0x0528
...@@ -229,7 +229,7 @@ ...@@ -229,7 +229,7 @@
* (01/23/2000) gkh * (01/23/2000) gkh
* Fixed problem of crash when trying to open a port that didn't have a * Fixed problem of crash when trying to open a port that didn't have a
* device assigned to it. Made the minor node finding a little smarter, * device assigned to it. Made the minor node finding a little smarter,
* now it looks to find a continous space for the new device. * now it looks to find a continuous space for the new device.
* *
* (01/21/2000) gkh * (01/21/2000) gkh
* Fixed bug in visor_startup with patch from Miles Lott (milos@insync.net) * Fixed bug in visor_startup with patch from Miles Lott (milos@insync.net)
...@@ -1293,7 +1293,7 @@ static int __init usb_serial_init(void) ...@@ -1293,7 +1293,7 @@ static int __init usb_serial_init(void)
int i; int i;
int result = 0; int result = 0;
/* Initalize our global data */ /* Initialize our global data */
for (i = 0; i < SERIAL_TTY_MINORS; ++i) { for (i = 0; i < SERIAL_TTY_MINORS; ++i) {
serial_table[i] = NULL; serial_table[i] = NULL;
} }
......
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
* usb_serial_port: structure for the specific ports of a device. * usb_serial_port: structure for the specific ports of a device.
* @magic: magic number for internal validity of this pointer. * @magic: magic number for internal validity of this pointer.
* @serial: pointer back to the struct usb_serial owner of this port. * @serial: pointer back to the struct usb_serial owner of this port.
* @tty: pointer to the coresponding tty for this port. * @tty: pointer to the corresponding tty for this port.
* @number: the number of the port (the minor number). * @number: the number of the port (the minor number).
* @interrupt_in_buffer: pointer to the interrupt in buffer for this port. * @interrupt_in_buffer: pointer to the interrupt in buffer for this port.
* @interrupt_in_urb: pointer to the interrupt in struct urb for this port. * @interrupt_in_urb: pointer to the interrupt in struct urb for this port.
......
...@@ -12,6 +12,10 @@ ...@@ -12,6 +12,10 @@
* *
* See Documentation/usb/usb-serial.txt for more information on using this driver * See Documentation/usb/usb-serial.txt for more information on using this driver
* *
* (03/09/2003) gkh
* Added support for the Sony Clie NZ90V device. Thanks to Martin Brachtl
* <brachtl@redgrep.cz> for the information.
*
* (03/05/2003) gkh * (03/05/2003) gkh
* Think Treo support is now working. * Think Treo support is now working.
* *
...@@ -198,6 +202,8 @@ static struct usb_device_id id_table [] = { ...@@ -198,6 +202,8 @@ static struct usb_device_id id_table [] = {
.driver_info = (kernel_ulong_t)&palm_os_4_probe }, .driver_info = (kernel_ulong_t)&palm_os_4_probe },
{ USB_DEVICE(PALM_VENDOR_ID, PALM_I705_ID), { USB_DEVICE(PALM_VENDOR_ID, PALM_I705_ID),
.driver_info = (kernel_ulong_t)&palm_os_4_probe }, .driver_info = (kernel_ulong_t)&palm_os_4_probe },
{ USB_DEVICE(PALM_VENDOR_ID, PALM_M100_ID),
.driver_info = (kernel_ulong_t)&palm_os_4_probe },
{ USB_DEVICE(PALM_VENDOR_ID, PALM_M125_ID), { USB_DEVICE(PALM_VENDOR_ID, PALM_M125_ID),
.driver_info = (kernel_ulong_t)&palm_os_4_probe }, .driver_info = (kernel_ulong_t)&palm_os_4_probe },
{ USB_DEVICE(PALM_VENDOR_ID, PALM_M130_ID), { USB_DEVICE(PALM_VENDOR_ID, PALM_M130_ID),
...@@ -215,6 +221,8 @@ static struct usb_device_id id_table [] = { ...@@ -215,6 +221,8 @@ static struct usb_device_id id_table [] = {
{ USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_4_1_ID) }, { USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_4_1_ID) },
{ USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_NX60_ID), { USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_NX60_ID),
.driver_info = (kernel_ulong_t)&palm_os_4_probe }, .driver_info = (kernel_ulong_t)&palm_os_4_probe },
{ USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_NZ90V_ID),
.driver_info = (kernel_ulong_t)&palm_os_4_probe },
{ } /* Terminating entry */ { } /* Terminating entry */
}; };
...@@ -230,6 +238,7 @@ static struct usb_device_id id_table_combined [] = { ...@@ -230,6 +238,7 @@ static struct usb_device_id id_table_combined [] = {
{ USB_DEVICE(PALM_VENDOR_ID, PALM_M505_ID) }, { USB_DEVICE(PALM_VENDOR_ID, PALM_M505_ID) },
{ USB_DEVICE(PALM_VENDOR_ID, PALM_M515_ID) }, { USB_DEVICE(PALM_VENDOR_ID, PALM_M515_ID) },
{ USB_DEVICE(PALM_VENDOR_ID, PALM_I705_ID) }, { USB_DEVICE(PALM_VENDOR_ID, PALM_I705_ID) },
{ USB_DEVICE(PALM_VENDOR_ID, PALM_M100_ID) },
{ USB_DEVICE(PALM_VENDOR_ID, PALM_M125_ID) }, { USB_DEVICE(PALM_VENDOR_ID, PALM_M125_ID) },
{ USB_DEVICE(PALM_VENDOR_ID, PALM_M130_ID) }, { USB_DEVICE(PALM_VENDOR_ID, PALM_M130_ID) },
{ USB_DEVICE(PALM_VENDOR_ID, PALM_TUNGSTEN_T_ID) }, { USB_DEVICE(PALM_VENDOR_ID, PALM_TUNGSTEN_T_ID) },
...@@ -240,6 +249,7 @@ static struct usb_device_id id_table_combined [] = { ...@@ -240,6 +249,7 @@ static struct usb_device_id id_table_combined [] = {
{ USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_S360_ID) }, { USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_S360_ID) },
{ USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_4_1_ID) }, { USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_4_1_ID) },
{ USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_NX60_ID) }, { USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_NX60_ID) },
{ USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_NZ90V_ID) },
{ } /* Terminating entry */ { } /* Terminating entry */
}; };
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#define PALM_TUNGSTEN_T_ID 0x0060 #define PALM_TUNGSTEN_T_ID 0x0060
#define PALM_TUNGSTEN_Z_ID 0x0031 #define PALM_TUNGSTEN_Z_ID 0x0031
#define PALM_ZIRE_ID 0x0070 #define PALM_ZIRE_ID 0x0070
#define PALM_M100_ID 0x0080
#define SONY_VENDOR_ID 0x054C #define SONY_VENDOR_ID 0x054C
#define SONY_CLIE_3_5_ID 0x0038 #define SONY_CLIE_3_5_ID 0x0038
...@@ -38,6 +39,7 @@ ...@@ -38,6 +39,7 @@
#define SONY_CLIE_S360_ID 0x0095 #define SONY_CLIE_S360_ID 0x0095
#define SONY_CLIE_4_1_ID 0x009A #define SONY_CLIE_4_1_ID 0x009A
#define SONY_CLIE_NX60_ID 0x00DA #define SONY_CLIE_NX60_ID 0x00DA
#define SONY_CLIE_NZ90V_ID 0x00E9
/**************************************************************************** /****************************************************************************
* Handspring Visor Vendor specific request codes (bRequest values) * Handspring Visor Vendor specific request codes (bRequest values)
......
...@@ -650,7 +650,7 @@ static void isd200_log_config( struct isd200_info* info ) ...@@ -650,7 +650,7 @@ static void isd200_log_config( struct isd200_info* info )
/************************************************************************** /**************************************************************************
* isd200_write_config * isd200_write_config
* *
* Write the ISD200 Configuraton data * Write the ISD200 Configuration data
* *
* RETURNS: * RETURNS:
* ISD status code * ISD status code
...@@ -693,7 +693,7 @@ int isd200_write_config( struct us_data *us ) ...@@ -693,7 +693,7 @@ int isd200_write_config( struct us_data *us )
/************************************************************************** /**************************************************************************
* isd200_read_config * isd200_read_config
* *
* Reads the ISD200 Configuraton data * Reads the ISD200 Configuration data
* *
* RETURNS: * RETURNS:
* ISD status code * ISD status code
...@@ -977,7 +977,7 @@ int isd200_get_inquiry_data( struct us_data *us ) ...@@ -977,7 +977,7 @@ int isd200_get_inquiry_data( struct us_data *us )
/* check for an ATA device */ /* check for an ATA device */
if (info->DeviceFlags & DF_ATA_DEVICE) { if (info->DeviceFlags & DF_ATA_DEVICE) {
/* this must be an ATA device */ /* this must be an ATA device */
/* perform an ATA Commmand Identify */ /* perform an ATA Command Identify */
transferStatus = isd200_action( us, ACTION_IDENTIFY, transferStatus = isd200_action( us, ACTION_IDENTIFY,
&info->drive, &info->drive,
sizeof(struct hd_driveid) ); sizeof(struct hd_driveid) );
......
...@@ -118,7 +118,7 @@ struct bulk_cs_wrap { ...@@ -118,7 +118,7 @@ struct bulk_cs_wrap {
*/ */
#define USB_STOR_XFER_GOOD 0 /* good transfer */ #define USB_STOR_XFER_GOOD 0 /* good transfer */
#define USB_STOR_XFER_SHORT 1 /* transfered less than expected */ #define USB_STOR_XFER_SHORT 1 /* transferred less than expected */
#define USB_STOR_XFER_STALLED 2 /* endpoint stalled */ #define USB_STOR_XFER_STALLED 2 /* endpoint stalled */
#define USB_STOR_XFER_ERROR 3 /* transfer died in the middle */ #define USB_STOR_XFER_ERROR 3 /* transfer died in the middle */
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
#define DRIVER_AUTHOR "Greg Kroah-Hartman, greg@kroah.com" #define DRIVER_AUTHOR "Greg Kroah-Hartman, greg@kroah.com"
#define DRIVER_DESC "USB Skeleton Driver" #define DRIVER_DESC "USB Skeleton Driver"
/* Module paramaters */ /* Module parameters */
MODULE_PARM(debug, "i"); MODULE_PARM(debug, "i");
MODULE_PARM_DESC(debug, "Debug enabled or not"); MODULE_PARM_DESC(debug, "Debug enabled or not");
......
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