Commit 59584359 authored by Linus Torvalds's avatar Linus Torvalds

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

into home.transmeta.com:/home/torvalds/v2.5/linux
parents 04b50ac4 e4386a9f
...@@ -389,8 +389,8 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb) ...@@ -389,8 +389,8 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
break; break;
case DeviceOutRequest | USB_REQ_SET_ADDRESS: case DeviceOutRequest | USB_REQ_SET_ADDRESS:
// wValue == urb->dev->devaddr // wValue == urb->dev->devaddr
dbg ("%s root hub device address %d", dev_dbg (*hcd->controller, "root hub device address %d\n",
hcd->self.bus_name, wValue); wValue);
break; break;
/* INTERFACE REQUESTS (no defined feature/status flags) */ /* INTERFACE REQUESTS (no defined feature/status flags) */
...@@ -1188,7 +1188,6 @@ static int hcd_unlink_urb (struct urb *urb) ...@@ -1188,7 +1188,6 @@ static int hcd_unlink_urb (struct urb *urb)
if (urb->transfer_flags & URB_ASYNC_UNLINK) if (urb->transfer_flags & URB_ASYNC_UNLINK)
return -EINPROGRESS; return -EINPROGRESS;
dev_dbg (*sys, "wait for giveback urb %p\n", urb);
wait_for_completion (&splice.done); wait_for_completion (&splice.done);
return 0; return 0;
......
...@@ -57,6 +57,12 @@ static inline char *portspeed (int portstatus) ...@@ -57,6 +57,12 @@ static inline char *portspeed (int portstatus)
} }
#endif #endif
/* for dev_info, dev_dbg, etc */
static inline struct device *hubdev (struct usb_device *dev)
{
return &dev->actconfig->interface [0].dev;
}
/* USB 2.0 spec Section 11.24.4.5 */ /* USB 2.0 spec Section 11.24.4.5 */
static int usb_get_hub_descriptor(struct usb_device *dev, void *data, int size) static int usb_get_hub_descriptor(struct usb_device *dev, void *data, int size)
{ {
...@@ -298,7 +304,7 @@ static int usb_hub_configure(struct usb_hub *hub, ...@@ -298,7 +304,7 @@ static int usb_hub_configure(struct usb_hub *hub,
} }
dev->maxchild = hub->descriptor->bNbrPorts; dev->maxchild = hub->descriptor->bNbrPorts;
info("%d port%s detected", dev->maxchild, dev_info (*hubdev (dev), "%d port%s detected\n", dev->maxchild,
(dev->maxchild == 1) ? "" : "s"); (dev->maxchild == 1) ? "" : "s");
le16_to_cpus(&hub->descriptor->wHubCharacteristics); le16_to_cpus(&hub->descriptor->wHubCharacteristics);
...@@ -521,7 +527,7 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) ...@@ -521,7 +527,7 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
} }
/* We found a hub */ /* We found a hub */
info("USB hub found at %s", dev->devpath); dev_info (*hubdev (dev), "USB hub found\n");
hub = kmalloc(sizeof(*hub), GFP_KERNEL); hub = kmalloc(sizeof(*hub), GFP_KERNEL);
if (!hub) { if (!hub) {
...@@ -651,8 +657,6 @@ static int usb_hub_port_status(struct usb_device *hub, int port, ...@@ -651,8 +657,6 @@ static int usb_hub_port_status(struct usb_device *hub, int port,
else { else {
*status = le16_to_cpu(portsts->wPortStatus); *status = le16_to_cpu(portsts->wPortStatus);
*change = le16_to_cpu(portsts->wPortChange); *change = le16_to_cpu(portsts->wPortChange);
dbg("port %d, portstatus %x, change %x, %s", port + 1,
*status, *change, portspeed(*status));
ret = 0; ret = 0;
} }
kfree(portsts); kfree(portsts);
...@@ -710,8 +714,9 @@ static int usb_hub_port_wait_reset(struct usb_device *hub, int port, ...@@ -710,8 +714,9 @@ static int usb_hub_port_wait_reset(struct usb_device *hub, int port,
if (delay_time >= 2 * HUB_SHORT_RESET_TIME) if (delay_time >= 2 * HUB_SHORT_RESET_TIME)
delay = HUB_LONG_RESET_TIME; delay = HUB_LONG_RESET_TIME;
dbg("port %d of hub %s not reset yet, waiting %dms", port + 1, dev_dbg (*hubdev (hub),
hub->devpath, delay); "port %d not reset yet, waiting %dms\n",
port + 1, delay);
} }
return -1; return -1;
...@@ -735,14 +740,15 @@ static int usb_hub_port_reset(struct usb_device *hub, int port, ...@@ -735,14 +740,15 @@ static int usb_hub_port_reset(struct usb_device *hub, int port,
return status; return status;
} }
dbg("port %d of hub %s not enabled, trying reset again...", dev_dbg (*hubdev (hub),
port + 1, hub->devpath); "port %d not enabled, trying reset again...\n",
port + 1);
delay = HUB_LONG_RESET_TIME; delay = HUB_LONG_RESET_TIME;
} }
err("Cannot enable port %i of hub %s, disabling port.", dev_err (*hubdev (hub),
port + 1, hub->devpath); "Cannot enable port %i. Maybe the USB cable is bad?\n",
err("Maybe the USB cable is bad?"); port + 1);
return -1; return -1;
} }
...@@ -808,8 +814,9 @@ static int usb_hub_port_debounce(struct usb_device *hub, int port) ...@@ -808,8 +814,9 @@ static int usb_hub_port_debounce(struct usb_device *hub, int port)
} }
/* XXX Replace this with dbg() when 2.6 is about to ship. */ /* XXX Replace this with dbg() when 2.6 is about to ship. */
info("debounce: hub %d port %d: delay %dms stable %d status 0x%x\n", dev_info (*hubdev (hub),
hub->devnum, port, delay_time, stable_count, portstatus); "debounce: port %d: delay %dms stable %d status 0x%x\n",
port + 1, delay_time, stable_count, portstatus);
return ((portstatus&USB_PORT_STAT_CONNECTION)) ? 0 : 1; return ((portstatus&USB_PORT_STAT_CONNECTION)) ? 0 : 1;
} }
...@@ -822,9 +829,9 @@ static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port, ...@@ -822,9 +829,9 @@ static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port,
unsigned int delay = HUB_SHORT_RESET_TIME; unsigned int delay = HUB_SHORT_RESET_TIME;
int i; int i;
dbg("hub %s port %d, portstatus %x, change %x, %s", dev_dbg (hubstate->intf->dev,
hub->devpath, port + 1, "port %d, status %x, change %x, %s\n",
portstatus, portchange, portspeed (portstatus)); port + 1, portstatus, portchange, portspeed (portstatus));
/* Clear the connection change status */ /* Clear the connection change status */
usb_clear_port_feature(hub, port + 1, USB_PORT_FEAT_C_CONNECTION); usb_clear_port_feature(hub, port + 1, USB_PORT_FEAT_C_CONNECTION);
...@@ -842,7 +849,9 @@ static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port, ...@@ -842,7 +849,9 @@ static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port,
} }
if (usb_hub_port_debounce(hub, port)) { if (usb_hub_port_debounce(hub, port)) {
err("connect-debounce failed, port %d disabled", port+1); dev_err (hubstate->intf->dev,
"connect-debounce failed, port %d disabled\n",
port+1);
usb_hub_port_disable(hub, port); usb_hub_port_disable(hub, port);
return; return;
} }
...@@ -861,7 +870,8 @@ static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port, ...@@ -861,7 +870,8 @@ static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port,
/* Allocate a new device struct */ /* Allocate a new device struct */
dev = usb_alloc_dev(hub, hub->bus); dev = usb_alloc_dev(hub, hub->bus);
if (!dev) { if (!dev) {
err("couldn't allocate usb_device"); dev_err (hubstate->intf->dev,
"couldn't allocate usb_device\n");
break; break;
} }
...@@ -904,10 +914,12 @@ static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port, ...@@ -904,10 +914,12 @@ static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port,
len = snprintf (dev->devpath, sizeof dev->devpath, len = snprintf (dev->devpath, sizeof dev->devpath,
"%d", port + 1); "%d", port + 1);
if (len == sizeof dev->devpath) if (len == sizeof dev->devpath)
warn ("devpath size! usb/%03d/%03d path %s", dev_err (hubstate->intf->dev,
"devpath size! usb/%03d/%03d path %s\n",
dev->bus->busnum, dev->devnum, dev->devpath); dev->bus->busnum, dev->devnum, dev->devpath);
info("new USB device %s-%s, assigned address %d", dev_info (hubstate->intf->dev,
dev->bus->bus_name, dev->devpath, dev->devnum); "new USB device on port %d, assigned address %d\n",
port + 1, dev->devnum);
/* put the device in the global device tree. the hub port /* put the device in the global device tree. the hub port
* is the "bus_id"; hubs show in hierarchy like bridges * is the "bus_id"; hubs show in hierarchy like bridges
...@@ -992,12 +1004,11 @@ static void usb_hub_events(void) ...@@ -992,12 +1004,11 @@ static void usb_hub_events(void)
} }
if (portchange & USB_PORT_STAT_C_CONNECTION) { if (portchange & USB_PORT_STAT_C_CONNECTION) {
dbg("hub %s port %d connection change",
dev->devpath, i + 1);
usb_hub_port_connect_change(hub, i, portstatus, portchange); usb_hub_port_connect_change(hub, i, portstatus, portchange);
} else if (portchange & USB_PORT_STAT_C_ENABLE) { } else if (portchange & USB_PORT_STAT_C_ENABLE) {
dbg("hub %s port %d enable change, status %x", dev_dbg (*hubdev (dev),
dev->devpath, i + 1, portstatus); "port %d enable change, status %x\n",
i + 1, portstatus);
usb_clear_port_feature(dev, usb_clear_port_feature(dev,
i + 1, USB_PORT_FEAT_C_ENABLE); i + 1, USB_PORT_FEAT_C_ENABLE);
......
...@@ -487,10 +487,15 @@ static void fs_remove_file (struct dentry *dentry) ...@@ -487,10 +487,15 @@ static void fs_remove_file (struct dentry *dentry)
* It will be removed when the 2.7.x development cycle is started. * It will be removed when the 2.7.x development cycle is started.
* You have been warned :) * You have been warned :)
*/ */
static struct file_system_type usbdevice_fs_type;
static struct super_block *usb_get_sb(struct file_system_type *fs_type, static struct super_block *usb_get_sb(struct file_system_type *fs_type,
int flags, char *dev_name, void *data) int flags, char *dev_name, void *data)
{ {
if (fs_type == &usbdevice_fs_type)
printk (KERN_INFO "Please use the 'usbfs' filetype instead, "
"the 'usbdevfs' name is depreciated.\n");
return get_sb_single(fs_type, flags, data, usbfs_fill_super); return get_sb_single(fs_type, flags, data, usbfs_fill_super);
} }
......
...@@ -18,21 +18,45 @@ ...@@ -18,21 +18,45 @@
/* this file is part of ehci-hcd.c */ /* this file is part of ehci-hcd.c */
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,50)
#define ehci_dbg(ehci, fmt, args...) \ #define ehci_dbg(ehci, fmt, args...) \
dev_dbg (*(ehci)->hcd.controller, fmt, ## args ) dev_dbg (*(ehci)->hcd.controller, fmt, ## args )
#define ehci_err(ehci, fmt, args...) \
dev_err (*(ehci)->hcd.controller, fmt, ## args )
#define ehci_info(ehci, fmt, args...) \
dev_info (*(ehci)->hcd.controller, fmt, ## args )
#define ehci_warn(ehci, fmt, args...) \
dev_warn (*(ehci)->hcd.controller, fmt, ## args )
#ifdef EHCI_VERBOSE_DEBUG
#define ehci_vdbg(ehci, fmt, args...) \
dev_dbg (*(ehci)->hcd.controller, fmt, ## args )
#else #else
#define ehci_vdbg(ehci, fmt, args...) do { } while (0)
#ifdef DEBUG
#define ehci_dbg(ehci, fmt, args...) \
printk(KERN_DEBUG "%s %s: " fmt, hcd_name, \
(ehci)->hcd.pdev->slot_name, ## args )
#else
#define ehci_dbg(ehci, fmt, args...) do { } while (0)
#endif
#define ehci_err(ehci, fmt, args...) \
printk(KERN_ERR "%s %s: " fmt, hcd_name, \
(ehci)->hcd.pdev->slot_name, ## args )
#define ehci_info(ehci, fmt, args...) \
printk(KERN_INFO "%s %s: " fmt, hcd_name, \
(ehci)->hcd.pdev->slot_name, ## args )
#define ehci_warn(ehci, fmt, args...) \
printk(KERN_WARNING "%s %s: " fmt, hcd_name, \
(ehci)->hcd.pdev->slot_name, ## args )
#endif #endif
#ifdef EHCI_VERBOSE_DEBUG #ifdef EHCI_VERBOSE_DEBUG
# define vdbg dbg # define vdbg dbg
# define ehci_vdbg ehci_dbg
#else #else
static inline void vdbg (char *fmt, ...) { } # define vdbg(fmt,args...) do { } while (0)
# define ehci_vdbg(ehci, fmt, args...) do { } while (0)
#endif #endif
#ifdef DEBUG #ifdef DEBUG
...@@ -289,7 +313,8 @@ static void qh_lines (struct ehci_qh *qh, char **nextp, unsigned *sizep) ...@@ -289,7 +313,8 @@ static void qh_lines (struct ehci_qh *qh, char **nextp, unsigned *sizep)
scratch = cpu_to_le32p (&qh->hw_info1); scratch = cpu_to_le32p (&qh->hw_info1);
hw_curr = cpu_to_le32p (&qh->hw_current); hw_curr = cpu_to_le32p (&qh->hw_current);
temp = snprintf (next, size, "qh/%p dev%d %cs ep%d %08x %08x (%08x %08x)", temp = snprintf (next, size,
"qh/%p dev%d %cs ep%d %08x %08x (%08x %08x)",
qh, scratch & 0x007f, qh, scratch & 0x007f,
speed_char (scratch), speed_char (scratch),
(scratch >> 8) & 0x000f, (scratch >> 8) & 0x000f,
......
This diff is collapsed.
...@@ -315,7 +315,7 @@ static int ehci_hub_control ( ...@@ -315,7 +315,7 @@ static int ehci_hub_control (
wIndex + 1); wIndex + 1);
temp |= PORT_OWNER; temp |= PORT_OWNER;
} else { } else {
ehci_vdbg (ehci, "port %d reset", wIndex + 1); ehci_vdbg (ehci, "port %d reset\n", wIndex + 1);
temp |= PORT_RESET; temp |= PORT_RESET;
temp &= ~PORT_PE; temp &= ~PORT_PE;
......
...@@ -73,8 +73,11 @@ static struct ehci_qtd *ehci_qtd_alloc (struct ehci_hcd *ehci, int flags) ...@@ -73,8 +73,11 @@ static struct ehci_qtd *ehci_qtd_alloc (struct ehci_hcd *ehci, int flags)
dma_addr_t dma; dma_addr_t dma;
qtd = pci_pool_alloc (ehci->qtd_pool, flags, &dma); qtd = pci_pool_alloc (ehci->qtd_pool, flags, &dma);
if (qtd != 0) if (qtd != 0) {
ehci_qtd_init (qtd, dma); ehci_qtd_init (qtd, dma);
if (ehci->async)
qtd->hw_alt_next = ehci->async->hw_alt_next;
}
return qtd; return qtd;
} }
......
This diff is collapsed.
...@@ -190,7 +190,7 @@ static int enable_periodic (struct ehci_hcd *ehci) ...@@ -190,7 +190,7 @@ static int enable_periodic (struct ehci_hcd *ehci)
/* posted write ... PSS happens later */ /* posted write ... PSS happens later */
ehci->hcd.state = USB_STATE_RUNNING; ehci->hcd.state = USB_STATE_RUNNING;
/* make sure tasklet scans these */ /* make sure ehci_work scans these */
ehci->next_uframe = readl (&ehci->regs->frame_index) ehci->next_uframe = readl (&ehci->regs->frame_index)
% (ehci->periodic_size << 3); % (ehci->periodic_size << 3);
return 0; return 0;
...@@ -495,7 +495,8 @@ static unsigned ...@@ -495,7 +495,8 @@ static unsigned
intr_complete ( intr_complete (
struct ehci_hcd *ehci, struct ehci_hcd *ehci,
unsigned frame, unsigned frame,
struct ehci_qh *qh struct ehci_qh *qh,
struct pt_regs *regs
) { ) {
unsigned count; unsigned count;
...@@ -509,7 +510,7 @@ intr_complete ( ...@@ -509,7 +510,7 @@ intr_complete (
} }
/* handle any completions */ /* handle any completions */
count = qh_completions (ehci, qh); count = qh_completions (ehci, qh, regs);
if (unlikely (list_empty (&qh->qtd_list))) if (unlikely (list_empty (&qh->qtd_list)))
intr_deschedule (ehci, qh, 0); intr_deschedule (ehci, qh, 0);
...@@ -867,7 +868,8 @@ static unsigned ...@@ -867,7 +868,8 @@ static unsigned
itd_complete ( itd_complete (
struct ehci_hcd *ehci, struct ehci_hcd *ehci,
struct ehci_itd *itd, struct ehci_itd *itd,
unsigned uframe unsigned uframe,
struct pt_regs *regs
) { ) {
struct urb *urb = itd->urb; struct urb *urb = itd->urb;
struct usb_iso_packet_descriptor *desc; struct usb_iso_packet_descriptor *desc;
...@@ -922,7 +924,7 @@ itd_complete ( ...@@ -922,7 +924,7 @@ itd_complete (
/* complete() can reenter this HCD */ /* complete() can reenter this HCD */
spin_unlock (&ehci->lock); spin_unlock (&ehci->lock);
usb_hcd_giveback_urb (&ehci->hcd, urb, NULL); usb_hcd_giveback_urb (&ehci->hcd, urb, regs);
spin_lock (&ehci->lock); spin_lock (&ehci->lock);
/* defer stopping schedule; completion can submit */ /* defer stopping schedule; completion can submit */
...@@ -973,7 +975,7 @@ static int itd_submit (struct ehci_hcd *ehci, struct urb *urb, int mem_flags) ...@@ -973,7 +975,7 @@ static int itd_submit (struct ehci_hcd *ehci, struct urb *urb, int mem_flags)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
static void static void
scan_periodic (struct ehci_hcd *ehci) scan_periodic (struct ehci_hcd *ehci, struct pt_regs *regs)
{ {
unsigned frame, clock, now_uframe, mod; unsigned frame, clock, now_uframe, mod;
unsigned count = 0; unsigned count = 0;
...@@ -999,14 +1001,6 @@ scan_periodic (struct ehci_hcd *ehci) ...@@ -999,14 +1001,6 @@ scan_periodic (struct ehci_hcd *ehci)
u32 type, *hw_p; u32 type, *hw_p;
unsigned uframes; unsigned uframes;
/* keep latencies down: let any irqs in */
if (count > max_completions) {
spin_unlock_irq (&ehci->lock);
cpu_relax ();
count = 0;
spin_lock_irq (&ehci->lock);
}
restart: restart:
/* scan schedule to _before_ current frame index */ /* scan schedule to _before_ current frame index */
if (frame == clock) if (frame == clock)
...@@ -1031,7 +1025,7 @@ scan_periodic (struct ehci_hcd *ehci) ...@@ -1031,7 +1025,7 @@ scan_periodic (struct ehci_hcd *ehci)
temp = q.qh->qh_next; temp = q.qh->qh_next;
type = Q_NEXT_TYPE (q.qh->hw_next); type = Q_NEXT_TYPE (q.qh->hw_next);
count += intr_complete (ehci, frame, count += intr_complete (ehci, frame,
qh_get (q.qh)); qh_get (q.qh), regs);
qh_put (ehci, q.qh); qh_put (ehci, q.qh);
q = temp; q = temp;
break; break;
...@@ -1064,7 +1058,7 @@ scan_periodic (struct ehci_hcd *ehci) ...@@ -1064,7 +1058,7 @@ scan_periodic (struct ehci_hcd *ehci)
/* might free q.itd ... */ /* might free q.itd ... */
count += itd_complete (ehci, count += itd_complete (ehci,
temp.itd, uf); temp.itd, uf, regs);
break; break;
} }
} }
......
...@@ -65,9 +65,6 @@ struct ehci_hcd { /* one per controller */ ...@@ -65,9 +65,6 @@ struct ehci_hcd { /* one per controller */
int next_uframe; /* scan periodic, start here */ int next_uframe; /* scan periodic, start here */
unsigned periodic_sched; /* periodic activity count */ unsigned periodic_sched; /* periodic activity count */
/* deferred work from IRQ, etc */
struct tasklet_struct tasklet;
/* per root hub port */ /* per root hub port */
unsigned long reset_done [EHCI_MAX_ROOT_PORTS]; unsigned long reset_done [EHCI_MAX_ROOT_PORTS];
......
...@@ -87,7 +87,7 @@ typedef struct { ...@@ -87,7 +87,7 @@ typedef struct {
} ibmcam_t; } ibmcam_t;
#define IBMCAM_T(uvd) ((ibmcam_t *)((uvd)->user_data)) #define IBMCAM_T(uvd) ((ibmcam_t *)((uvd)->user_data))
usbvideo_t *cams = NULL; struct usbvideo *cams = NULL;
static int debug = 0; static int debug = 0;
...@@ -249,7 +249,7 @@ static videosize_t ibmcam_size_to_videosize(int size) ...@@ -249,7 +249,7 @@ static videosize_t ibmcam_size_to_videosize(int size)
* History: * History:
* 1/21/00 Created. * 1/21/00 Created.
*/ */
static ParseState_t ibmcam_find_header(struct uvd *uvd) /* FIXME: Add frame here */ static enum ParseState ibmcam_find_header(struct uvd *uvd) /* FIXME: Add frame here */
{ {
struct usbvideo_frame *frame; struct usbvideo_frame *frame;
ibmcam_t *icam; ibmcam_t *icam;
...@@ -397,7 +397,7 @@ case IBMCAM_MODEL_4: ...@@ -397,7 +397,7 @@ case IBMCAM_MODEL_4:
* 21-Jan-2000 Created. * 21-Jan-2000 Created.
* 12-Oct-2000 Reworked to reflect interlaced nature of the data. * 12-Oct-2000 Reworked to reflect interlaced nature of the data.
*/ */
static ParseState_t ibmcam_parse_lines( static enum ParseState ibmcam_parse_lines(
struct uvd *uvd, struct uvd *uvd,
struct usbvideo_frame *frame, struct usbvideo_frame *frame,
long *pcopylen) long *pcopylen)
...@@ -662,7 +662,7 @@ static ParseState_t ibmcam_parse_lines( ...@@ -662,7 +662,7 @@ static ParseState_t ibmcam_parse_lines(
* them both as R component in attempt to at least partially recover the * them both as R component in attempt to at least partially recover the
* lost resolution. * lost resolution.
*/ */
static ParseState_t ibmcam_model2_320x240_parse_lines( static enum ParseState ibmcam_model2_320x240_parse_lines(
struct uvd *uvd, struct uvd *uvd,
struct usbvideo_frame *frame, struct usbvideo_frame *frame,
long *pcopylen) long *pcopylen)
...@@ -816,7 +816,7 @@ static ParseState_t ibmcam_model2_320x240_parse_lines( ...@@ -816,7 +816,7 @@ static ParseState_t ibmcam_model2_320x240_parse_lines(
return scan_Continue; return scan_Continue;
} }
static ParseState_t ibmcam_model3_parse_lines( static enum ParseState ibmcam_model3_parse_lines(
struct uvd *uvd, struct uvd *uvd,
struct usbvideo_frame *frame, struct usbvideo_frame *frame,
long *pcopylen) long *pcopylen)
...@@ -961,7 +961,7 @@ static ParseState_t ibmcam_model3_parse_lines( ...@@ -961,7 +961,7 @@ static ParseState_t ibmcam_model3_parse_lines(
* History: * History:
* 10-Feb-2001 Created. * 10-Feb-2001 Created.
*/ */
static ParseState_t ibmcam_model4_128x96_parse_lines( static enum ParseState ibmcam_model4_128x96_parse_lines(
struct uvd *uvd, struct uvd *uvd,
struct usbvideo_frame *frame, struct usbvideo_frame *frame,
long *pcopylen) long *pcopylen)
...@@ -1051,7 +1051,7 @@ static ParseState_t ibmcam_model4_128x96_parse_lines( ...@@ -1051,7 +1051,7 @@ static ParseState_t ibmcam_model4_128x96_parse_lines(
*/ */
void ibmcam_ProcessIsocData(struct uvd *uvd, struct usbvideo_frame *frame) void ibmcam_ProcessIsocData(struct uvd *uvd, struct usbvideo_frame *frame)
{ {
ParseState_t newstate; enum ParseState newstate;
long copylen = 0; long copylen = 0;
int mod = IBMCAM_T(uvd)->camera_model; int mod = IBMCAM_T(uvd)->camera_model;
......
...@@ -51,7 +51,7 @@ enum frame_sizes { ...@@ -51,7 +51,7 @@ enum frame_sizes {
#define MAX_FRAME_SIZE SIZE_320X240 #define MAX_FRAME_SIZE SIZE_320X240
static usbvideo_t *cams; static struct usbvideo *cams;
#ifdef CONFIG_USB_DEBUG #ifdef CONFIG_USB_DEBUG
static int debug; static int debug;
......
...@@ -446,8 +446,8 @@ int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frame ...@@ -446,8 +446,8 @@ int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frame
Info("Video mode %s@%d fps is only supported with the decompressor module (pwcx).\n", size2name[size], frames); Info("Video mode %s@%d fps is only supported with the decompressor module (pwcx).\n", size2name[size], frames);
else { else {
Err("Failed to set video mode %s@%d fps; return code = %d\n", size2name[size], frames, ret); Err("Failed to set video mode %s@%d fps; return code = %d\n", size2name[size], frames, ret);
return ret;
} }
return ret;
} }
pdev->view.x = width; pdev->view.x = width;
pdev->view.y = height; pdev->view.y = height;
...@@ -1535,6 +1535,14 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) ...@@ -1535,6 +1535,14 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg)
break; break;
} }
case VIDIOCPWCGREALSIZE:
{
struct pwc_imagesize *size = arg;
size->width = pdev->image.x;
size->height = pdev->image.y;
break;
}
default: default:
ret = -ENOIOCTLCMD; ret = -ENOIOCTLCMD;
......
...@@ -77,7 +77,7 @@ static struct usb_device_id pwc_device_table [] = { ...@@ -77,7 +77,7 @@ static struct usb_device_id pwc_device_table [] = {
{ USB_DEVICE(0x0471, 0x0312) }, { USB_DEVICE(0x0471, 0x0312) },
{ USB_DEVICE(0x069A, 0x0001) }, /* Askey */ { USB_DEVICE(0x069A, 0x0001) }, /* Askey */
{ USB_DEVICE(0x046D, 0x08b0) }, /* Logitech QuickCam Pro 3000 */ { USB_DEVICE(0x046D, 0x08b0) }, /* Logitech QuickCam Pro 3000 */
{ USB_DEVICE(0x046D, 0x08b1) }, /* Logitech QuickCam for Notebooks */ { USB_DEVICE(0x046D, 0x08b1) }, /* Logitech QuickCam Notebook Pro */
{ USB_DEVICE(0x046D, 0x08b2) }, /* Logitech QuickCam Pro 4000 */ { USB_DEVICE(0x046D, 0x08b2) }, /* Logitech QuickCam Pro 4000 */
{ USB_DEVICE(0x046D, 0x08b3) }, /* Logitech QuickCam Zoom */ { USB_DEVICE(0x046D, 0x08b3) }, /* Logitech QuickCam Zoom */
{ USB_DEVICE(0x055D, 0x9000) }, /* Samsung */ { USB_DEVICE(0x055D, 0x9000) }, /* Samsung */
...@@ -1064,7 +1064,6 @@ static int pwc_video_open(struct inode *inode, struct file *file) ...@@ -1064,7 +1064,6 @@ static int pwc_video_open(struct inode *inode, struct file *file)
i = pwc_isoc_init(pdev); i = pwc_isoc_init(pdev);
if (i) { if (i) {
Trace(TRACE_OPEN, "Failed to init ISOC stuff = %d.\n", i); Trace(TRACE_OPEN, "Failed to init ISOC stuff = %d.\n", i);
MOD_DEC_USE_COUNT;
up(&pdev->modlock); up(&pdev->modlock);
return i; return i;
} }
...@@ -1689,8 +1688,8 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id ...@@ -1689,8 +1688,8 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
type_id = 730; type_id = 730;
break; break;
case 0x08b1: case 0x08b1:
Info("Logitech QuickCam for Noteboos USB webcam detected.\n"); Info("Logitech QuickCam Notebook Pro USB webcam detected.\n");
name = "Logitech QuickCam Notebook"; name = "Logitech QuickCam Notebook Pro";
type_id = 740; /* ?? unknown sensor */ type_id = 740; /* ?? unknown sensor */
break; break;
case 0x08b2: case 0x08b2:
......
...@@ -18,12 +18,13 @@ ...@@ -18,12 +18,13 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
/* This is pwc-ioctl.h belonging to PWC 8.7 */ /* This is pwc-ioctl.h belonging to PWC 8.10 */
/* /*
Changes Changes
2001/08/03 Alvarado Added ioctl constants to access methods for 2001/08/03 Alvarado Added ioctl constants to access methods for
changing white balance and red/blue gains changing white balance and red/blue gains
2002/12/15 G. H. Fernandez-Toribio VIDIOCGREALSIZE
*/ */
/* These are private ioctl() commands, specific for the Philips webcams. /* These are private ioctl() commands, specific for the Philips webcams.
...@@ -104,7 +105,12 @@ struct pwc_leds ...@@ -104,7 +105,12 @@ struct pwc_leds
int led_off; /* Led off-time; range = 0..25000 */ int led_off; /* Led off-time; range = 0..25000 */
}; };
/* Image size (used with GREALSIZE) */
struct pwc_imagesize
{
int width;
int height;
};
/* Restore user settings */ /* Restore user settings */
#define VIDIOCPWCRUSER _IO('v', 192) #define VIDIOCPWCRUSER _IO('v', 192)
...@@ -173,4 +179,7 @@ struct pwc_leds ...@@ -173,4 +179,7 @@ struct pwc_leds
#define VIDIOCPWCSDYNNOISE _IOW('v', 209, int) #define VIDIOCPWCSDYNNOISE _IOW('v', 209, int)
#define VIDIOCPWCGDYNNOISE _IOR('v', 209, int) #define VIDIOCPWCGDYNNOISE _IOR('v', 209, int)
/* Real image size as used by the camera; tells you whether or not there's a gray border around the image */
#define VIDIOCPWCGREALSIZE _IOR('v', 210, struct pwc_imagesize)
#endif #endif
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
significant change should be reflected by increasing the significant change should be reflected by increasing the
pwc_decompressor_version major number. pwc_decompressor_version major number.
*/ */
#ifndef PWC_DEC_H #ifndef PWC_UNCOMPRESS_H
#define PWC_DEC_H #define PWC_UNCOMPRESS_H
#include <linux/config.h> #include <linux/config.h>
#include <linux/list.h> #include <linux/list.h>
......
...@@ -60,8 +60,8 @@ ...@@ -60,8 +60,8 @@
/* Version block */ /* Version block */
#define PWC_MAJOR 8 #define PWC_MAJOR 8
#define PWC_MINOR 9 #define PWC_MINOR 10
#define PWC_VERSION "8.9" #define PWC_VERSION "8.10"
#define PWC_NAME "pwc" #define PWC_NAME "pwc"
/* Turn certain features on/off */ /* Turn certain features on/off */
......
...@@ -25,7 +25,7 @@ typedef struct { ...@@ -25,7 +25,7 @@ typedef struct {
} ultracam_t; } ultracam_t;
#define ULTRACAM_T(uvd) ((ultracam_t *)((uvd)->user_data)) #define ULTRACAM_T(uvd) ((ultracam_t *)((uvd)->user_data))
static usbvideo_t *cams = NULL; static struct usbvideo *cams = NULL;
static int debug = 0; static int debug = 0;
......
...@@ -42,8 +42,8 @@ MODULE_PARM(video_nr, "i"); ...@@ -42,8 +42,8 @@ MODULE_PARM(video_nr, "i");
* Local prototypes. * Local prototypes.
*/ */
#if USES_PROC_FS #if USES_PROC_FS
static void usbvideo_procfs_level1_create(usbvideo_t *ut); static void usbvideo_procfs_level1_create(struct usbvideo *ut);
static void usbvideo_procfs_level1_destroy(usbvideo_t *ut); static void usbvideo_procfs_level1_destroy(struct usbvideo *ut);
static void usbvideo_procfs_level2_create(struct uvd *uvd); static void usbvideo_procfs_level2_create(struct uvd *uvd);
static void usbvideo_procfs_level2_destroy(struct uvd *uvd); static void usbvideo_procfs_level2_destroy(struct uvd *uvd);
static int usbvideo_default_procfs_read_proc( static int usbvideo_default_procfs_read_proc(
...@@ -765,7 +765,7 @@ static void usbvideo_ClientDecModCount(struct uvd *uvd) ...@@ -765,7 +765,7 @@ static void usbvideo_ClientDecModCount(struct uvd *uvd)
} }
int usbvideo_register( int usbvideo_register(
usbvideo_t **pCams, struct usbvideo **pCams,
const int num_cams, const int num_cams,
const int num_extra, const int num_extra,
const char *driverName, const char *driverName,
...@@ -773,7 +773,7 @@ int usbvideo_register( ...@@ -773,7 +773,7 @@ int usbvideo_register(
struct module *md, struct module *md,
const struct usb_device_id *id_table) const struct usb_device_id *id_table)
{ {
usbvideo_t *cams; struct usbvideo *cams;
int i, base_size; int i, base_size;
/* Check parameters for sanity */ /* Check parameters for sanity */
...@@ -788,10 +788,10 @@ int usbvideo_register( ...@@ -788,10 +788,10 @@ int usbvideo_register(
return -EINVAL; return -EINVAL;
} }
base_size = num_cams * sizeof(struct uvd) + sizeof(usbvideo_t); base_size = num_cams * sizeof(struct uvd) + sizeof(struct usbvideo);
cams = (usbvideo_t *) kmalloc(base_size, GFP_KERNEL); cams = (struct usbvideo *) kmalloc(base_size, GFP_KERNEL);
if (cams == NULL) { if (cams == NULL) {
err("Failed to allocate %d. bytes for usbvideo_t", base_size); err("Failed to allocate %d. bytes for usbvideo struct", base_size);
return -ENOMEM; return -ENOMEM;
} }
dbg("%s: Allocated $%p (%d. bytes) for %d. cameras", dbg("%s: Allocated $%p (%d. bytes) for %d. cameras",
...@@ -823,7 +823,7 @@ int usbvideo_register( ...@@ -823,7 +823,7 @@ int usbvideo_register(
#else /* !USES_PROC_FS */ #else /* !USES_PROC_FS */
/* Report a warning so that user knows why there is no /proc entries */ /* Report a warning so that user knows why there is no /proc entries */
if ((cams->cb.procfs_read != NULL) || (cams->cb.procfs_write == NULL)) { if ((cams->cb.procfs_read != NULL) || (cams->cb.procfs_write == NULL)) {
dbg("%s: /proc fs support requested but not configured!", proc); dbg("%s: /proc fs support requested but not configured!", __FUNCTION__);
} }
#endif #endif
cams->num_cameras = num_cams; cams->num_cameras = num_cams;
...@@ -889,9 +889,9 @@ EXPORT_SYMBOL(usbvideo_register); ...@@ -889,9 +889,9 @@ EXPORT_SYMBOL(usbvideo_register);
* if you had some dynamically allocated components in ->user field then * if you had some dynamically allocated components in ->user field then
* you should free them before calling here. * you should free them before calling here.
*/ */
void usbvideo_Deregister(usbvideo_t **pCams) void usbvideo_Deregister(struct usbvideo **pCams)
{ {
usbvideo_t *cams; struct usbvideo *cams;
int i; int i;
if (pCams == NULL) { if (pCams == NULL) {
...@@ -1049,12 +1049,12 @@ static void usbvideo_CameraRelease(struct uvd *uvd) ...@@ -1049,12 +1049,12 @@ static void usbvideo_CameraRelease(struct uvd *uvd)
* History: * History:
* 27-Jan-2000 Created. * 27-Jan-2000 Created.
*/ */
static int usbvideo_find_struct(usbvideo_t *cams) static int usbvideo_find_struct(struct usbvideo *cams)
{ {
int u, rv = -1; int u, rv = -1;
if (cams == NULL) { if (cams == NULL) {
err("No usbvideo_t handle?"); err("No usbvideo handle?");
return -1; return -1;
} }
down(&cams->lock); down(&cams->lock);
...@@ -1089,13 +1089,13 @@ static struct video_device usbvideo_template = { ...@@ -1089,13 +1089,13 @@ static struct video_device usbvideo_template = {
.fops = &usbvideo_fops, .fops = &usbvideo_fops,
}; };
struct uvd *usbvideo_AllocateDevice(usbvideo_t *cams) struct uvd *usbvideo_AllocateDevice(struct usbvideo *cams)
{ {
int i, devnum; int i, devnum;
struct uvd *uvd = NULL; struct uvd *uvd = NULL;
if (cams == NULL) { if (cams == NULL) {
err("No usbvideo_t handle?"); err("No usbvideo handle?");
return NULL; return NULL;
} }
...@@ -2357,7 +2357,7 @@ static void usbvideo_SoftwareContrastAdjustment(struct uvd *uvd, ...@@ -2357,7 +2357,7 @@ static void usbvideo_SoftwareContrastAdjustment(struct uvd *uvd,
extern struct proc_dir_entry *video_proc_entry; extern struct proc_dir_entry *video_proc_entry;
static void usbvideo_procfs_level1_create(usbvideo_t *ut) static void usbvideo_procfs_level1_create(struct usbvideo *ut)
{ {
if (ut == NULL) { if (ut == NULL) {
err("%s: ut == NULL", __FUNCTION__); err("%s: ut == NULL", __FUNCTION__);
...@@ -2376,7 +2376,7 @@ static void usbvideo_procfs_level1_create(usbvideo_t *ut) ...@@ -2376,7 +2376,7 @@ static void usbvideo_procfs_level1_create(usbvideo_t *ut)
} }
} }
static void usbvideo_procfs_level1_destroy(usbvideo_t *ut) static void usbvideo_procfs_level1_destroy(struct usbvideo *ut)
{ {
if (ut == NULL) { if (ut == NULL) {
err("%s: ut == NULL", __FUNCTION__); err("%s: ut == NULL", __FUNCTION__);
......
...@@ -126,37 +126,37 @@ struct RingQueue { ...@@ -126,37 +126,37 @@ struct RingQueue {
wait_queue_head_t wqh; /* Processes waiting */ wait_queue_head_t wqh; /* Processes waiting */
}; };
typedef enum { enum ScanState {
ScanState_Scanning, /* Scanning for header */ ScanState_Scanning, /* Scanning for header */
ScanState_Lines /* Parsing lines */ ScanState_Lines /* Parsing lines */
} ScanState_t; };
/* Completion states of the data parser */ /* Completion states of the data parser */
typedef enum { enum ParseState {
scan_Continue, /* Just parse next item */ scan_Continue, /* Just parse next item */
scan_NextFrame, /* Frame done, send it to V4L */ scan_NextFrame, /* Frame done, send it to V4L */
scan_Out, /* Not enough data for frame */ scan_Out, /* Not enough data for frame */
scan_EndParse /* End parsing */ scan_EndParse /* End parsing */
} ParseState_t; };
typedef enum { enum FrameState {
FrameState_Unused, /* Unused (no MCAPTURE) */ FrameState_Unused, /* Unused (no MCAPTURE) */
FrameState_Ready, /* Ready to start grabbing */ FrameState_Ready, /* Ready to start grabbing */
FrameState_Grabbing, /* In the process of being grabbed into */ FrameState_Grabbing, /* In the process of being grabbed into */
FrameState_Done, /* Finished grabbing, but not been synced yet */ FrameState_Done, /* Finished grabbing, but not been synced yet */
FrameState_Done_Hold, /* Are syncing or reading */ FrameState_Done_Hold, /* Are syncing or reading */
FrameState_Error, /* Something bad happened while processing */ FrameState_Error, /* Something bad happened while processing */
} FrameState_t; };
/* /*
* Some frames may contain only even or odd lines. This type * Some frames may contain only even or odd lines. This type
* specifies what type of deinterlacing is required. * specifies what type of deinterlacing is required.
*/ */
typedef enum { enum Deinterlace {
Deinterlace_None=0, Deinterlace_None=0,
Deinterlace_FillOddLines, Deinterlace_FillOddLines,
Deinterlace_FillEvenLines Deinterlace_FillEvenLines
} Deinterlace_t; };
#define USBVIDEO_NUMFRAMES 2 /* How many frames we work with */ #define USBVIDEO_NUMFRAMES 2 /* How many frames we work with */
#define USBVIDEO_NUMSBUF 2 /* How many URBs linked in a ring */ #define USBVIDEO_NUMSBUF 2 /* How many URBs linked in a ring */
...@@ -175,9 +175,9 @@ struct usbvideo_frame { ...@@ -175,9 +175,9 @@ struct usbvideo_frame {
videosize_t request; /* That's what the application asked for */ videosize_t request; /* That's what the application asked for */
unsigned short palette; /* The desired format */ unsigned short palette; /* The desired format */
FrameState_t frameState;/* State of grabbing */ enum FrameState frameState;/* State of grabbing */
ScanState_t scanstate; /* State of scanning */ enum ScanState scanstate; /* State of scanning */
Deinterlace_t deinterlace; enum Deinterlace deinterlace;
int flags; /* USBVIDEO_FRAME_FLAG_xxx bit flags */ int flags; /* USBVIDEO_FRAME_FLAG_xxx bit flags */
int curline; /* Line of frame we're working on */ int curline; /* Line of frame we're working on */
...@@ -199,12 +199,12 @@ struct usbvideo_statistics { ...@@ -199,12 +199,12 @@ struct usbvideo_statistics {
unsigned long iso_err_count; /* How many bad ISO packets received */ unsigned long iso_err_count; /* How many bad ISO packets received */
}; };
struct s_usbvideo_t; struct usbvideo;
struct uvd { struct uvd {
struct video_device vdev; /* Must be the first field! */ struct video_device vdev; /* Must be the first field! */
struct usb_device *dev; struct usb_device *dev;
struct s_usbvideo_t *handle; /* Points back to the usbvideo_t */ struct usbvideo *handle; /* Points back to the struct usbvideo */
void *user_data; /* Camera-dependent data */ void *user_data; /* Camera-dependent data */
int user_size; /* Size of that camera-dependent data */ int user_size; /* Size of that camera-dependent data */
int debug; /* Debug level for usbvideo */ int debug; /* Debug level for usbvideo */
...@@ -273,7 +273,7 @@ struct usbvideo_cb { ...@@ -273,7 +273,7 @@ struct usbvideo_cb {
int (*setVideoMode)(struct uvd *uvd, struct video_window *vw); int (*setVideoMode)(struct uvd *uvd, struct video_window *vw);
}; };
struct s_usbvideo_t { struct usbvideo {
int num_cameras; /* As allocated */ int num_cameras; /* As allocated */
struct usb_driver usbdrv; /* Interface to the USB stack */ struct usb_driver usbdrv; /* Interface to the USB stack */
char drvName[80]; /* Driver name */ char drvName[80]; /* Driver name */
...@@ -285,7 +285,7 @@ struct s_usbvideo_t { ...@@ -285,7 +285,7 @@ struct s_usbvideo_t {
struct proc_dir_entry *procfs_dEntry; /* /proc/video/MYDRIVER */ struct proc_dir_entry *procfs_dEntry; /* /proc/video/MYDRIVER */
struct module *md_module; /* Minidriver module */ struct module *md_module; /* Minidriver module */
}; };
typedef struct s_usbvideo_t usbvideo_t;
/* /*
* This macro retrieves callback address from the struct uvd object. * This macro retrieves callback address from the struct uvd object.
...@@ -332,16 +332,16 @@ void usbvideo_TestPattern(struct uvd *uvd, int fullframe, int pmode); ...@@ -332,16 +332,16 @@ void usbvideo_TestPattern(struct uvd *uvd, int fullframe, int pmode);
unsigned long usbvideo_kvirt_to_pa(unsigned long adr); unsigned long usbvideo_kvirt_to_pa(unsigned long adr);
int usbvideo_register( int usbvideo_register(
usbvideo_t **pCams, struct usbvideo **pCams,
const int num_cams, const int num_cams,
const int num_extra, const int num_extra,
const char *driverName, const char *driverName,
const struct usbvideo_cb *cbTable, const struct usbvideo_cb *cbTable,
struct module *md, struct module *md,
const struct usb_device_id *id_table); const struct usb_device_id *id_table);
struct uvd *usbvideo_AllocateDevice(usbvideo_t *cams); struct uvd *usbvideo_AllocateDevice(struct usbvideo *cams);
int usbvideo_RegisterVideoDevice(struct uvd *uvd); int usbvideo_RegisterVideoDevice(struct uvd *uvd);
void usbvideo_Deregister(usbvideo_t **uvt); void usbvideo_Deregister(struct usbvideo **uvt);
int usbvideo_v4l_initialize(struct video_device *dev); int usbvideo_v4l_initialize(struct video_device *dev);
......
...@@ -144,8 +144,9 @@ struct udsl_instance_data *minor_data[MAX_UDSL]; ...@@ -144,8 +144,9 @@ struct udsl_instance_data *minor_data[MAX_UDSL];
static const char udsl_driver_name[] = "Alcatel SpeedTouch USB"; static const char udsl_driver_name[] = "Alcatel SpeedTouch USB";
/* data thread */ /* data thread */
static int datapid = 0;
DECLARE_WAIT_QUEUE_HEAD (udsl_wqh); DECLARE_WAIT_QUEUE_HEAD (udsl_wqh);
static DECLARE_COMPLETION(thread_grave);
static unsigned int datapid;
#ifdef DEBUG_PACKET #ifdef DEBUG_PACKET
int udsl_print_packet (const unsigned char *data, int len); int udsl_print_packet (const unsigned char *data, int len);
...@@ -431,21 +432,36 @@ int udsl_atm_processqueue_thread (void *data) ...@@ -431,21 +432,36 @@ int udsl_atm_processqueue_thread (void *data)
strcpy (current->comm, "kSpeedSARd"); strcpy (current->comm, "kSpeedSARd");
add_wait_queue (&udsl_wqh, &wait); add_wait_queue (&udsl_wqh, &wait);
set_current_state(TASK_INTERRUPTIBLE);
for (;;) { for (;;) {
interruptible_sleep_on (&udsl_wqh); schedule();
if (signal_pending (current)) if (signal_pending (current))
break; break;
PDEBUG ("SpeedSARd awoke\n"); PDEBUG ("SpeedSARd awoke\n");
retry:
for (i = 0; i < MAX_UDSL; i++) for (i = 0; i < MAX_UDSL; i++)
if (minor_data[i]) if (minor_data[i])
udsl_atm_processqueue (minor_data[i]); udsl_atm_processqueue (minor_data[i]);
set_current_state(TASK_INTERRUPTIBLE);
/* we must check for data recieved and restart processing if there's any */
for (i = 0; i < MAX_UDSL; i++) {
spin_lock_irq(&minor_data[i]->recvqlock);
if (!skb_queue_empty(&minor_data[i]->recvqueue)) {
spin_unlock_irq(&minor_data[i]->recvqlock);
set_current_state(TASK_RUNNING);
goto retry;
} else {
spin_unlock_irq(&minor_data[i]->recvqlock);
}
}
}; };
set_current_state(TASK_RUNNING);
remove_wait_queue (&udsl_wqh, &wait); remove_wait_queue (&udsl_wqh, &wait);
datapid = 0;
PDEBUG ("SpeedSARd is exiting\n"); PDEBUG ("SpeedSARd is exiting\n");
return 0; complete_and_exit(&thread_grave, 0);
return 0; //never reached
} }
...@@ -461,16 +477,7 @@ void udsl_atm_sar_stop (void) ...@@ -461,16 +477,7 @@ void udsl_atm_sar_stop (void)
/* Kill the thread */ /* Kill the thread */
ret = kill_proc (datapid, SIGTERM, 1); ret = kill_proc (datapid, SIGTERM, 1);
if (!ret) { if (!ret) {
/* Wait 10 seconds */ wait_for_completion(&thread_grave);
int count = 10 * 100;
while (datapid && --count) {
current->state = TASK_INTERRUPTIBLE;
schedule_timeout (1);
}
if (!count)
err ("giving up on killing SpeedSAR thread.");
} }
} }
...@@ -598,7 +605,7 @@ static void udsl_usb_send_data_complete (struct urb *urb, struct pt_regs *regs) ...@@ -598,7 +605,7 @@ static void udsl_usb_send_data_complete (struct urb *urb, struct pt_regs *regs)
(unsigned char *) ctx->skb->data, (unsigned char *) ctx->skb->data,
ctx->skb->len, udsl_usb_send_data_complete, ctx); ctx->skb->len, udsl_usb_send_data_complete, ctx);
err = usb_submit_urb (urb, GFP_KERNEL); err = usb_submit_urb (urb, GFP_ATOMIC);
PDEBUG ("udsl_usb_send_data_completion (send packet %p with length %d), retval = %d\n", PDEBUG ("udsl_usb_send_data_completion (send packet %p with length %d), retval = %d\n",
ctx->skb, ctx->skb->len, err); ctx->skb, ctx->skb->len, err);
...@@ -747,7 +754,7 @@ void udsl_usb_data_receive (struct urb *urb, struct pt_regs *regs) ...@@ -747,7 +754,7 @@ void udsl_usb_data_receive (struct urb *urb, struct pt_regs *regs)
usb_rcvbulkpipe (instance->usb_dev, UDSL_ENDPOINT_DATA_IN), usb_rcvbulkpipe (instance->usb_dev, UDSL_ENDPOINT_DATA_IN),
(unsigned char *) ctx->skb->data, (unsigned char *) ctx->skb->data,
UDSL_RECEIVE_BUFFER_SIZE, udsl_usb_data_receive, ctx); UDSL_RECEIVE_BUFFER_SIZE, udsl_usb_data_receive, ctx);
usb_submit_urb (urb, GFP_KERNEL); usb_submit_urb (urb, GFP_ATOMIC);
return; return;
}; };
...@@ -845,7 +852,6 @@ static int udsl_usb_data_exit (struct udsl_instance_data *instance) ...@@ -845,7 +852,6 @@ static int udsl_usb_data_exit (struct udsl_instance_data *instance)
if ((!ctx->urb) || (!ctx->skb)) if ((!ctx->urb) || (!ctx->skb))
continue; continue;
if (ctx->urb->status == -EINPROGRESS)
usb_unlink_urb (ctx->urb); usb_unlink_urb (ctx->urb);
usb_free_urb (ctx->urb); usb_free_urb (ctx->urb);
...@@ -856,7 +862,6 @@ static int udsl_usb_data_exit (struct udsl_instance_data *instance) ...@@ -856,7 +862,6 @@ static int udsl_usb_data_exit (struct udsl_instance_data *instance)
for (i = 0; i < UDSL_NUMBER_SND_URBS; i++) { for (i = 0; i < UDSL_NUMBER_SND_URBS; i++) {
struct udsl_usb_send_data_context *ctx = &(instance->send_ctx[i]); struct udsl_usb_send_data_context *ctx = &(instance->send_ctx[i]);
if (ctx->urb->status == -EINPROGRESS)
usb_unlink_urb (ctx->urb); usb_unlink_urb (ctx->urb);
if (ctx->skb) if (ctx->skb)
......
...@@ -98,7 +98,7 @@ ioctl_lcd(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -98,7 +98,7 @@ ioctl_lcd(struct inode *inode, struct file *file, unsigned int cmd,
return -EFAULT; return -EFAULT;
break; break;
default: default:
return -ENOIOCTLCMD; return -ENOTTY;
break; break;
} }
......
This diff is collapsed.
...@@ -126,6 +126,7 @@ static struct usb_driver belkin_driver = { ...@@ -126,6 +126,7 @@ static struct usb_driver belkin_driver = {
static struct usb_serial_device_type belkin_device = { static struct usb_serial_device_type belkin_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Belkin / Peracom / GoHubs USB Serial Adapter", .name = "Belkin / Peracom / GoHubs USB Serial Adapter",
.short_name = "belkin",
.id_table = id_table_combined, .id_table = id_table_combined,
.num_interrupt_in = 1, .num_interrupt_in = 1,
.num_bulk_in = 1, .num_bulk_in = 1,
......
...@@ -121,6 +121,9 @@ int usb_serial_bus_register(struct usb_serial_device_type *device) ...@@ -121,6 +121,9 @@ int usb_serial_bus_register(struct usb_serial_device_type *device)
{ {
int retval; int retval;
if (device->short_name)
device->driver.name = (char *)device->short_name;
else
device->driver.name = (char *)device->name; device->driver.name = (char *)device->name;
device->driver.bus = &usb_serial_bus_type; device->driver.bus = &usb_serial_bus_type;
device->driver.probe = usb_serial_device_probe; device->driver.probe = usb_serial_device_probe;
......
...@@ -83,6 +83,7 @@ static struct usb_driver cyberjack_driver = { ...@@ -83,6 +83,7 @@ static struct usb_driver cyberjack_driver = {
static struct usb_serial_device_type cyberjack_device = { static struct usb_serial_device_type cyberjack_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Reiner SCT Cyberjack USB card reader", .name = "Reiner SCT Cyberjack USB card reader",
.short_name = "cyberjack",
.id_table = id_table, .id_table = id_table,
.num_interrupt_in = 1, .num_interrupt_in = 1,
.num_bulk_in = 1, .num_bulk_in = 1,
......
...@@ -43,6 +43,7 @@ static struct usb_device_id generic_device_ids[2]; /* Initially all zeroes. */ ...@@ -43,6 +43,7 @@ static struct usb_device_id generic_device_ids[2]; /* Initially all zeroes. */
struct usb_serial_device_type usb_serial_generic_device = { struct usb_serial_device_type usb_serial_generic_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Generic", .name = "Generic",
.short_name = "generic",
.id_table = generic_device_ids, .id_table = generic_device_ids,
.num_interrupt_in = NUM_DONT_CARE, .num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = NUM_DONT_CARE, .num_bulk_in = NUM_DONT_CARE,
......
...@@ -100,6 +100,7 @@ MODULE_DEVICE_TABLE (usb, id_table_combined); ...@@ -100,6 +100,7 @@ MODULE_DEVICE_TABLE (usb, id_table_combined);
static struct usb_serial_device_type edgeport_1port_device = { static struct usb_serial_device_type edgeport_1port_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Edgeport 1 port adapter", .name = "Edgeport 1 port adapter",
.short_name = "edgeport_1",
.id_table = edgeport_1port_id_table, .id_table = edgeport_1port_id_table,
.num_interrupt_in = 1, .num_interrupt_in = 1,
.num_bulk_in = 1, .num_bulk_in = 1,
...@@ -122,6 +123,7 @@ static struct usb_serial_device_type edgeport_1port_device = { ...@@ -122,6 +123,7 @@ static struct usb_serial_device_type edgeport_1port_device = {
static struct usb_serial_device_type edgeport_2port_device = { static struct usb_serial_device_type edgeport_2port_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Edgeport 2 port adapter", .name = "Edgeport 2 port adapter",
.short_name = "edgeport_2",
.id_table = edgeport_2port_id_table, .id_table = edgeport_2port_id_table,
.num_interrupt_in = 1, .num_interrupt_in = 1,
.num_bulk_in = 1, .num_bulk_in = 1,
...@@ -144,6 +146,7 @@ static struct usb_serial_device_type edgeport_2port_device = { ...@@ -144,6 +146,7 @@ static struct usb_serial_device_type edgeport_2port_device = {
static struct usb_serial_device_type edgeport_4port_device = { static struct usb_serial_device_type edgeport_4port_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Edgeport 4 port adapter", .name = "Edgeport 4 port adapter",
.short_name = "edgeport_4",
.id_table = edgeport_4port_id_table, .id_table = edgeport_4port_id_table,
.num_interrupt_in = 1, .num_interrupt_in = 1,
.num_bulk_in = 1, .num_bulk_in = 1,
...@@ -166,6 +169,7 @@ static struct usb_serial_device_type edgeport_4port_device = { ...@@ -166,6 +169,7 @@ static struct usb_serial_device_type edgeport_4port_device = {
static struct usb_serial_device_type edgeport_8port_device = { static struct usb_serial_device_type edgeport_8port_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Edgeport 8 port adapter", .name = "Edgeport 8 port adapter",
.short_name = "edgeport_8",
.id_table = edgeport_8port_id_table, .id_table = edgeport_8port_id_table,
.num_interrupt_in = 1, .num_interrupt_in = 1,
.num_bulk_in = 1, .num_bulk_in = 1,
......
...@@ -2635,6 +2635,7 @@ static void edge_shutdown (struct usb_serial *serial) ...@@ -2635,6 +2635,7 @@ static void edge_shutdown (struct usb_serial *serial)
static struct usb_serial_device_type edgeport_1port_device = { static struct usb_serial_device_type edgeport_1port_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Edgeport TI 1 port adapter", .name = "Edgeport TI 1 port adapter",
.short_name = "edgeport_ti_1",
.id_table = edgeport_1port_id_table, .id_table = edgeport_1port_id_table,
.num_interrupt_in = 1, .num_interrupt_in = 1,
.num_bulk_in = 1, .num_bulk_in = 1,
...@@ -2657,6 +2658,7 @@ static struct usb_serial_device_type edgeport_1port_device = { ...@@ -2657,6 +2658,7 @@ static struct usb_serial_device_type edgeport_1port_device = {
static struct usb_serial_device_type edgeport_2port_device = { static struct usb_serial_device_type edgeport_2port_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Edgeport TI 2 port adapter", .name = "Edgeport TI 2 port adapter",
.short_name = "edgeport_ti_2",
.id_table = edgeport_2port_id_table, .id_table = edgeport_2port_id_table,
.num_interrupt_in = 1, .num_interrupt_in = 1,
.num_bulk_in = 2, .num_bulk_in = 2,
......
...@@ -481,6 +481,7 @@ static struct usb_device_id keyspan_4port_ids[] = { ...@@ -481,6 +481,7 @@ static struct usb_device_id keyspan_4port_ids[] = {
static struct usb_serial_device_type keyspan_pre_device = { static struct usb_serial_device_type keyspan_pre_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Keyspan - (without firmware)", .name = "Keyspan - (without firmware)",
.short_name = "keyspan_no_firm",
.id_table = keyspan_pre_ids, .id_table = keyspan_pre_ids,
.num_interrupt_in = NUM_DONT_CARE, .num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = NUM_DONT_CARE, .num_bulk_in = NUM_DONT_CARE,
...@@ -492,6 +493,7 @@ static struct usb_serial_device_type keyspan_pre_device = { ...@@ -492,6 +493,7 @@ static struct usb_serial_device_type keyspan_pre_device = {
static struct usb_serial_device_type keyspan_1port_device = { static struct usb_serial_device_type keyspan_1port_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Keyspan 1 port adapter", .name = "Keyspan 1 port adapter",
.short_name = "keyspan_1",
.id_table = keyspan_1port_ids, .id_table = keyspan_1port_ids,
.num_interrupt_in = NUM_DONT_CARE, .num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = 3, .num_bulk_in = 3,
...@@ -514,6 +516,7 @@ static struct usb_serial_device_type keyspan_1port_device = { ...@@ -514,6 +516,7 @@ static struct usb_serial_device_type keyspan_1port_device = {
static struct usb_serial_device_type keyspan_2port_device = { static struct usb_serial_device_type keyspan_2port_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Keyspan 2 port adapter", .name = "Keyspan 2 port adapter",
.short_name = "keyspan_2",
.id_table = keyspan_2port_ids, .id_table = keyspan_2port_ids,
.num_interrupt_in = NUM_DONT_CARE, .num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = NUM_DONT_CARE, .num_bulk_in = NUM_DONT_CARE,
...@@ -536,6 +539,7 @@ static struct usb_serial_device_type keyspan_2port_device = { ...@@ -536,6 +539,7 @@ static struct usb_serial_device_type keyspan_2port_device = {
static struct usb_serial_device_type keyspan_4port_device = { static struct usb_serial_device_type keyspan_4port_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Keyspan 4 port adapter", .name = "Keyspan 4 port adapter",
.short_name = "keyspan_4",
.id_table = keyspan_4port_ids, .id_table = keyspan_4port_ids,
.num_interrupt_in = NUM_DONT_CARE, .num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = 5, .num_bulk_in = 5,
......
...@@ -827,6 +827,7 @@ static void keyspan_pda_shutdown (struct usb_serial *serial) ...@@ -827,6 +827,7 @@ static void keyspan_pda_shutdown (struct usb_serial *serial)
static struct usb_serial_device_type keyspan_pda_fake_device = { static struct usb_serial_device_type keyspan_pda_fake_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Keyspan PDA - (prerenumeration)", .name = "Keyspan PDA - (prerenumeration)",
.short_name = "kyspn_pda_nofirm",
.id_table = id_table_fake, .id_table = id_table_fake,
.num_interrupt_in = NUM_DONT_CARE, .num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = NUM_DONT_CARE, .num_bulk_in = NUM_DONT_CARE,
...@@ -840,6 +841,7 @@ static struct usb_serial_device_type keyspan_pda_fake_device = { ...@@ -840,6 +841,7 @@ static struct usb_serial_device_type keyspan_pda_fake_device = {
static struct usb_serial_device_type xircom_pgs_fake_device = { static struct usb_serial_device_type xircom_pgs_fake_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Xircom / Entregra PGS - (prerenumeration)", .name = "Xircom / Entregra PGS - (prerenumeration)",
.short_name = "xircom_nofirm",
.id_table = id_table_fake_xircom, .id_table = id_table_fake_xircom,
.num_interrupt_in = NUM_DONT_CARE, .num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = NUM_DONT_CARE, .num_bulk_in = NUM_DONT_CARE,
...@@ -852,6 +854,7 @@ static struct usb_serial_device_type xircom_pgs_fake_device = { ...@@ -852,6 +854,7 @@ static struct usb_serial_device_type xircom_pgs_fake_device = {
static struct usb_serial_device_type keyspan_pda_device = { static struct usb_serial_device_type keyspan_pda_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Keyspan PDA", .name = "Keyspan PDA",
.short_name = "keyspan_pda",
.id_table = id_table_std, .id_table = id_table_std,
.num_interrupt_in = 1, .num_interrupt_in = 1,
.num_bulk_in = 0, .num_bulk_in = 0,
......
...@@ -127,6 +127,7 @@ static struct usb_driver kl5kusb105d_driver = { ...@@ -127,6 +127,7 @@ static struct usb_driver kl5kusb105d_driver = {
static struct usb_serial_device_type kl5kusb105d_device = { static struct usb_serial_device_type kl5kusb105d_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "KL5KUSB105D / PalmConnect", .name = "KL5KUSB105D / PalmConnect",
.short_name = "kl5kusb105d",
.id_table = id_table, .id_table = id_table,
.num_interrupt_in = 1, .num_interrupt_in = 1,
.num_bulk_in = 1, .num_bulk_in = 1,
......
...@@ -149,6 +149,7 @@ static struct usb_driver mct_u232_driver = { ...@@ -149,6 +149,7 @@ static struct usb_driver mct_u232_driver = {
static struct usb_serial_device_type mct_u232_device = { static struct usb_serial_device_type mct_u232_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Magic Control Technology USB-RS232", .name = "Magic Control Technology USB-RS232",
.short_name = "mct_u232",
.id_table = id_table_combined, .id_table = id_table_combined,
.num_interrupt_in = 2, .num_interrupt_in = 2,
.num_bulk_in = 0, .num_bulk_in = 0,
......
...@@ -94,6 +94,7 @@ static struct usb_driver omninet_driver = { ...@@ -94,6 +94,7 @@ static struct usb_driver omninet_driver = {
static struct usb_serial_device_type zyxel_omninet_device = { static struct usb_serial_device_type zyxel_omninet_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "ZyXEL - omni.net lcd plus usb", .name = "ZyXEL - omni.net lcd plus usb",
.short_name = "omninet",
.id_table = id_table, .id_table = id_table,
.num_interrupt_in = 1, .num_interrupt_in = 1,
.num_bulk_in = 1, .num_bulk_in = 1,
......
...@@ -168,6 +168,9 @@ struct usb_serial { ...@@ -168,6 +168,9 @@ struct usb_serial {
* @owner: pointer to the module that owns this device. * @owner: pointer to the module that owns this device.
* @name: pointer to a string that describes this device. This string used * @name: pointer to a string that describes this device. This string used
* in the syslog messages when a device is inserted or removed. * in the syslog messages when a device is inserted or removed.
* @short_name: a pointer to a string that describes this device in
* KOBJ_NAME_LEN characters or less. This is used for the sysfs interface
* to describe the driver.
* @id_table: pointer to a list of usb_device_id structures that define all * @id_table: pointer to a list of usb_device_id structures that define all
* of the devices this structure can support. * of the devices this structure can support.
* @num_interrupt_in: the number of interrupt in endpoints this device will * @num_interrupt_in: the number of interrupt in endpoints this device will
...@@ -201,6 +204,7 @@ struct usb_serial { ...@@ -201,6 +204,7 @@ struct usb_serial {
struct usb_serial_device_type { struct usb_serial_device_type {
struct module *owner; struct module *owner;
char *name; char *name;
char *short_name;
const struct usb_device_id *id_table; const struct usb_device_id *id_table;
char num_interrupt_in; char num_interrupt_in;
char num_bulk_in; char num_bulk_in;
......
...@@ -236,6 +236,7 @@ static struct usb_driver visor_driver = { ...@@ -236,6 +236,7 @@ static struct usb_driver visor_driver = {
static struct usb_serial_device_type handspring_device = { static struct usb_serial_device_type handspring_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Handspring Visor / Treo / Palm 4.0 / Clié 4.x", .name = "Handspring Visor / Treo / Palm 4.0 / Clié 4.x",
.short_name = "visor",
.id_table = id_table, .id_table = id_table,
.num_interrupt_in = NUM_DONT_CARE, .num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = 2, .num_bulk_in = 2,
...@@ -262,6 +263,7 @@ static struct usb_serial_device_type handspring_device = { ...@@ -262,6 +263,7 @@ static struct usb_serial_device_type handspring_device = {
static struct usb_serial_device_type clie_3_5_device = { static struct usb_serial_device_type clie_3_5_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Sony Clié 3.5", .name = "Sony Clié 3.5",
.short_name = "clie_3.5",
.id_table = clie_id_3_5_table, .id_table = clie_id_3_5_table,
.num_interrupt_in = 0, .num_interrupt_in = 0,
.num_bulk_in = 1, .num_bulk_in = 1,
......
...@@ -156,6 +156,7 @@ static void whiteheat_write_callback (struct urb *urb, struct pt_regs *regs); ...@@ -156,6 +156,7 @@ static void whiteheat_write_callback (struct urb *urb, struct pt_regs *regs);
static struct usb_serial_device_type whiteheat_fake_device = { static struct usb_serial_device_type whiteheat_fake_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Connect Tech - WhiteHEAT - (prerenumeration)", .name = "Connect Tech - WhiteHEAT - (prerenumeration)",
.short_name = "whiteheatnofirm",
.id_table = id_table_prerenumeration, .id_table = id_table_prerenumeration,
.num_interrupt_in = NUM_DONT_CARE, .num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = NUM_DONT_CARE, .num_bulk_in = NUM_DONT_CARE,
...@@ -168,6 +169,7 @@ static struct usb_serial_device_type whiteheat_fake_device = { ...@@ -168,6 +169,7 @@ static struct usb_serial_device_type whiteheat_fake_device = {
static struct usb_serial_device_type whiteheat_device = { static struct usb_serial_device_type whiteheat_device = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "Connect Tech - WhiteHEAT", .name = "Connect Tech - WhiteHEAT",
.short_name = "whiteheat",
.id_table = id_table_std, .id_table = id_table_std,
.num_interrupt_in = NUM_DONT_CARE, .num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = NUM_DONT_CARE, .num_bulk_in = NUM_DONT_CARE,
...@@ -512,9 +514,11 @@ static int whiteheat_attach (struct usb_serial *serial) ...@@ -512,9 +514,11 @@ static int whiteheat_attach (struct usb_serial *serial)
no_rx_buf: no_rx_buf:
usb_free_urb(urb); usb_free_urb(urb);
no_rx_urb: no_rx_urb:
;
} }
kfree(info); kfree(info);
no_private: no_private:
;
} }
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -480,7 +480,7 @@ int usb_stor_control_msg(struct us_data *us, unsigned int pipe, ...@@ -480,7 +480,7 @@ int usb_stor_control_msg(struct us_data *us, unsigned int pipe,
status = usb_stor_msg_common(us); status = usb_stor_msg_common(us);
/* return the actual length of the data transferred if no error */ /* return the actual length of the data transferred if no error */
if (status >= 0) if (status == 0)
status = us->current_urb->actual_length; status = us->current_urb->actual_length;
return status; return status;
} }
...@@ -583,50 +583,52 @@ static int interpret_urb_result(struct us_data *us, unsigned int pipe, ...@@ -583,50 +583,52 @@ static int interpret_urb_result(struct us_data *us, unsigned int pipe,
US_DEBUGP("Status code %d; transferred %u/%u\n", US_DEBUGP("Status code %d; transferred %u/%u\n",
result, partial, length); result, partial, length);
switch (result) {
/* stalled */ /* no error code; did we send all the data? */
if (result == -EPIPE) { case 0:
if (partial != length) {
US_DEBUGP("-- short transfer\n");
return USB_STOR_XFER_SHORT;
}
US_DEBUGP("-- transfer complete\n");
return USB_STOR_XFER_GOOD;
/* for non-bulk (i.e., control) endpoints, a stall indicates /* stalled */
* a protocol error */ case -EPIPE:
if (!usb_pipebulk(pipe)) { /* for control endpoints, a stall indicates a protocol error */
if (usb_pipecontrol(pipe)) {
US_DEBUGP("-- stall on control pipe\n"); US_DEBUGP("-- stall on control pipe\n");
return USB_STOR_XFER_ERROR; return USB_STOR_XFER_ERROR;
} }
/* for a bulk endpoint, clear the stall */ /* for other sorts of endpoint, clear the stall */
US_DEBUGP("clearing endpoint halt for pipe 0x%x\n", pipe); US_DEBUGP("clearing endpoint halt for pipe 0x%x\n", pipe);
if (usb_stor_clear_halt(us, pipe) < 0) if (usb_stor_clear_halt(us, pipe) < 0)
return USB_STOR_XFER_ERROR; return USB_STOR_XFER_ERROR;
return USB_STOR_XFER_STALLED; return USB_STOR_XFER_STALLED;
}
/* NAK - that means we've retried this a few times already */ /* NAK - that means we've retried this a few times already */
if (result == -ETIMEDOUT) { case -ETIMEDOUT:
US_DEBUGP("-- device NAKed\n"); US_DEBUGP("-- device NAKed\n");
return USB_STOR_XFER_ERROR; return USB_STOR_XFER_ERROR;
}
/* the transfer was cancelled, presumably by an abort */ /* the transfer was cancelled, presumably by an abort */
if (result == -ENODEV) { case -ENODEV:
US_DEBUGP("-- transfer cancelled\n"); US_DEBUGP("-- transfer cancelled\n");
return USB_STOR_XFER_ERROR; return USB_STOR_XFER_ERROR;
}
/* short scatter-gather read transfer */
case -EREMOTEIO:
US_DEBUGP("-- short read transfer\n");
return USB_STOR_XFER_SHORT;
/* the catch-all error case */ /* the catch-all error case */
if (result < 0) { default:
US_DEBUGP("-- unknown error\n"); US_DEBUGP("-- unknown error\n");
return USB_STOR_XFER_ERROR; return USB_STOR_XFER_ERROR;
} }
/* no error code; did we send all the data? */
if (partial != length) {
US_DEBUGP("-- transferred only %u bytes\n", partial);
return USB_STOR_XFER_SHORT;
}
US_DEBUGP("-- transfer complete\n");
return USB_STOR_XFER_GOOD;
} }
/* /*
......
...@@ -728,9 +728,13 @@ static int storage_probe(struct usb_interface *intf, ...@@ -728,9 +728,13 @@ static int storage_probe(struct usb_interface *intf,
USB_ENDPOINT_NUMBER_MASK; USB_ENDPOINT_NUMBER_MASK;
ss->ep_out = ep_out->bEndpointAddress & ss->ep_out = ep_out->bEndpointAddress &
USB_ENDPOINT_NUMBER_MASK; USB_ENDPOINT_NUMBER_MASK;
if (ep_int) {
ss->ep_int = ep_int->bEndpointAddress & ss->ep_int = ep_int->bEndpointAddress &
USB_ENDPOINT_NUMBER_MASK; USB_ENDPOINT_NUMBER_MASK;
ss->ep_bInterval = ep_int->bInterval; ss->ep_bInterval = ep_int->bInterval;
}
else
ss->ep_int = ss->ep_bInterval = 0;
/* allocate the URB, the usb_ctrlrequest, and the IRQ URB */ /* allocate the URB, the usb_ctrlrequest, and the IRQ URB */
if (usb_stor_allocate_urbs(ss)) if (usb_stor_allocate_urbs(ss))
...@@ -771,9 +775,13 @@ static int storage_probe(struct usb_interface *intf, ...@@ -771,9 +775,13 @@ static int storage_probe(struct usb_interface *intf,
USB_ENDPOINT_NUMBER_MASK; USB_ENDPOINT_NUMBER_MASK;
ss->ep_out = ep_out->bEndpointAddress & ss->ep_out = ep_out->bEndpointAddress &
USB_ENDPOINT_NUMBER_MASK; USB_ENDPOINT_NUMBER_MASK;
if (ep_int) {
ss->ep_int = ep_int->bEndpointAddress & ss->ep_int = ep_int->bEndpointAddress &
USB_ENDPOINT_NUMBER_MASK; USB_ENDPOINT_NUMBER_MASK;
ss->ep_bInterval = ep_int->bInterval; ss->ep_bInterval = ep_int->bInterval;
}
else
ss->ep_int = ss->ep_bInterval = 0;
/* establish the connection to the new device */ /* establish the connection to the new device */
ss->ifnum = ifnum; ss->ifnum = ifnum;
......
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