Merge with Greg's USB tree at kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6.git/

Yah, it does work to merge. Knock wood.
This commit is contained in:
Linus Torvalds 2005-04-19 07:28:57 -07:00
commit a9e4820c4c
62 changed files with 467 additions and 423 deletions

View File

@ -1128,8 +1128,8 @@ static void stir_disconnect(struct usb_interface *intf)
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
/* Power management suspend, so power off the transmitter/receiver */ /* USB suspend, so power off the transmitter/receiver */
static int stir_suspend(struct usb_interface *intf, u32 state) static int stir_suspend(struct usb_interface *intf, pm_message_t message)
{ {
struct stir_cb *stir = usb_get_intfdata(intf); struct stir_cb *stir = usb_get_intfdata(intf);

View File

@ -649,13 +649,9 @@ static void usbin_stop(struct usb_audiodev *as)
} }
} }
set_current_state(TASK_RUNNING); set_current_state(TASK_RUNNING);
if (u->durb[0].urb->transfer_buffer)
kfree(u->durb[0].urb->transfer_buffer); kfree(u->durb[0].urb->transfer_buffer);
if (u->durb[1].urb->transfer_buffer)
kfree(u->durb[1].urb->transfer_buffer); kfree(u->durb[1].urb->transfer_buffer);
if (u->surb[0].urb->transfer_buffer)
kfree(u->surb[0].urb->transfer_buffer); kfree(u->surb[0].urb->transfer_buffer);
if (u->surb[1].urb->transfer_buffer)
kfree(u->surb[1].urb->transfer_buffer); kfree(u->surb[1].urb->transfer_buffer);
u->durb[0].urb->transfer_buffer = u->durb[1].urb->transfer_buffer = u->durb[0].urb->transfer_buffer = u->durb[1].urb->transfer_buffer =
u->surb[0].urb->transfer_buffer = u->surb[1].urb->transfer_buffer = NULL; u->surb[0].urb->transfer_buffer = u->surb[1].urb->transfer_buffer = NULL;
@ -1009,20 +1005,16 @@ static int usbin_start(struct usb_audiodev *as)
u->phase = 0; u->phase = 0;
maxsze = (u->freqmax + 0x3fff) >> (14 - AFMT_BYTESSHIFT(u->format)); maxsze = (u->freqmax + 0x3fff) >> (14 - AFMT_BYTESSHIFT(u->format));
bufsz = DESCFRAMES * maxsze; bufsz = DESCFRAMES * maxsze;
if (u->durb[0].urb->transfer_buffer)
kfree(u->durb[0].urb->transfer_buffer); kfree(u->durb[0].urb->transfer_buffer);
u->durb[0].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL); u->durb[0].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL);
u->durb[0].urb->transfer_buffer_length = bufsz; u->durb[0].urb->transfer_buffer_length = bufsz;
if (u->durb[1].urb->transfer_buffer)
kfree(u->durb[1].urb->transfer_buffer); kfree(u->durb[1].urb->transfer_buffer);
u->durb[1].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL); u->durb[1].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL);
u->durb[1].urb->transfer_buffer_length = bufsz; u->durb[1].urb->transfer_buffer_length = bufsz;
if (u->syncpipe) { if (u->syncpipe) {
if (u->surb[0].urb->transfer_buffer)
kfree(u->surb[0].urb->transfer_buffer); kfree(u->surb[0].urb->transfer_buffer);
u->surb[0].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL); u->surb[0].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL);
u->surb[0].urb->transfer_buffer_length = 3*SYNCFRAMES; u->surb[0].urb->transfer_buffer_length = 3*SYNCFRAMES;
if (u->surb[1].urb->transfer_buffer)
kfree(u->surb[1].urb->transfer_buffer); kfree(u->surb[1].urb->transfer_buffer);
u->surb[1].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL); u->surb[1].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL);
u->surb[1].urb->transfer_buffer_length = 3*SYNCFRAMES; u->surb[1].urb->transfer_buffer_length = 3*SYNCFRAMES;
@ -1128,13 +1120,9 @@ static void usbout_stop(struct usb_audiodev *as)
} }
} }
set_current_state(TASK_RUNNING); set_current_state(TASK_RUNNING);
if (u->durb[0].urb->transfer_buffer)
kfree(u->durb[0].urb->transfer_buffer); kfree(u->durb[0].urb->transfer_buffer);
if (u->durb[1].urb->transfer_buffer)
kfree(u->durb[1].urb->transfer_buffer); kfree(u->durb[1].urb->transfer_buffer);
if (u->surb[0].urb->transfer_buffer)
kfree(u->surb[0].urb->transfer_buffer); kfree(u->surb[0].urb->transfer_buffer);
if (u->surb[1].urb->transfer_buffer)
kfree(u->surb[1].urb->transfer_buffer); kfree(u->surb[1].urb->transfer_buffer);
u->durb[0].urb->transfer_buffer = u->durb[1].urb->transfer_buffer = u->durb[0].urb->transfer_buffer = u->durb[1].urb->transfer_buffer =
u->surb[0].urb->transfer_buffer = u->surb[1].urb->transfer_buffer = NULL; u->surb[0].urb->transfer_buffer = u->surb[1].urb->transfer_buffer = NULL;
@ -1376,20 +1364,16 @@ static int usbout_start(struct usb_audiodev *as)
u->phase = 0; u->phase = 0;
maxsze = (u->freqmax + 0x3fff) >> (14 - AFMT_BYTESSHIFT(u->format)); maxsze = (u->freqmax + 0x3fff) >> (14 - AFMT_BYTESSHIFT(u->format));
bufsz = DESCFRAMES * maxsze; bufsz = DESCFRAMES * maxsze;
if (u->durb[0].urb->transfer_buffer)
kfree(u->durb[0].urb->transfer_buffer); kfree(u->durb[0].urb->transfer_buffer);
u->durb[0].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL); u->durb[0].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL);
u->durb[0].urb->transfer_buffer_length = bufsz; u->durb[0].urb->transfer_buffer_length = bufsz;
if (u->durb[1].urb->transfer_buffer)
kfree(u->durb[1].urb->transfer_buffer); kfree(u->durb[1].urb->transfer_buffer);
u->durb[1].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL); u->durb[1].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL);
u->durb[1].urb->transfer_buffer_length = bufsz; u->durb[1].urb->transfer_buffer_length = bufsz;
if (u->syncpipe) { if (u->syncpipe) {
if (u->surb[0].urb->transfer_buffer)
kfree(u->surb[0].urb->transfer_buffer); kfree(u->surb[0].urb->transfer_buffer);
u->surb[0].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL); u->surb[0].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL);
u->surb[0].urb->transfer_buffer_length = 3*SYNCFRAMES; u->surb[0].urb->transfer_buffer_length = 3*SYNCFRAMES;
if (u->surb[1].urb->transfer_buffer)
kfree(u->surb[1].urb->transfer_buffer); kfree(u->surb[1].urb->transfer_buffer);
u->surb[1].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL); u->surb[1].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL);
u->surb[1].urb->transfer_buffer_length = 3*SYNCFRAMES; u->surb[1].urb->transfer_buffer_length = 3*SYNCFRAMES;

View File

@ -10,7 +10,8 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/device.h> #include <linux/device.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include "usb.h"
#include "hcd.h"
#define USB_MAXALTSETTING 128 /* Hard limit */ #define USB_MAXALTSETTING 128 /* Hard limit */
#define USB_MAXENDPOINTS 30 /* Hard limit */ #define USB_MAXENDPOINTS 30 /* Hard limit */

View File

@ -59,6 +59,7 @@
#include <linux/usbdevice_fs.h> #include <linux/usbdevice_fs.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include "usb.h"
#include "hcd.h" #include "hcd.h"
#define MAX_TOPO_LEVEL 6 #define MAX_TOPO_LEVEL 6
@ -636,11 +637,8 @@ static int usb_device_open(struct inode *inode, struct file *file)
static int usb_device_release(struct inode *inode, struct file *file) static int usb_device_release(struct inode *inode, struct file *file)
{ {
if (file->private_data) {
kfree(file->private_data); kfree(file->private_data);
file->private_data = NULL; file->private_data = NULL;
}
return 0; return 0;
} }

View File

@ -213,9 +213,7 @@ static struct async *alloc_async(unsigned int numisoframes)
static void free_async(struct async *as) static void free_async(struct async *as)
{ {
if (as->urb->transfer_buffer)
kfree(as->urb->transfer_buffer); kfree(as->urb->transfer_buffer);
if (as->urb->setup_packet)
kfree(as->urb->setup_packet); kfree(as->urb->setup_packet);
usb_free_urb(as->urb); usb_free_urb(as->urb);
kfree(as); kfree(as);
@ -938,16 +936,12 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
return -EINVAL; return -EINVAL;
} }
if (!(as = alloc_async(uurb->number_of_packets))) { if (!(as = alloc_async(uurb->number_of_packets))) {
if (isopkt)
kfree(isopkt); kfree(isopkt);
if (dr)
kfree(dr); kfree(dr);
return -ENOMEM; return -ENOMEM;
} }
if (!(as->urb->transfer_buffer = kmalloc(uurb->buffer_length, GFP_KERNEL))) { if (!(as->urb->transfer_buffer = kmalloc(uurb->buffer_length, GFP_KERNEL))) {
if (isopkt)
kfree(isopkt); kfree(isopkt);
if (dr)
kfree(dr); kfree(dr);
free_async(as); free_async(as);
return -ENOMEM; return -ENOMEM;
@ -967,7 +961,6 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
as->urb->iso_frame_desc[u].length = isopkt[u].length; as->urb->iso_frame_desc[u].length = isopkt[u].length;
totlen += isopkt[u].length; totlen += isopkt[u].length;
} }
if (isopkt)
kfree(isopkt); kfree(isopkt);
as->ps = ps; as->ps = ps;
as->userurb = arg; as->userurb = arg;
@ -1032,8 +1025,7 @@ static int processcompl(struct async *as, void __user * __user *arg)
if (put_user(urb->error_count, &userurb->error_count)) if (put_user(urb->error_count, &userurb->error_count))
return -EFAULT; return -EFAULT;
if (!(usb_pipeisoc(urb->pipe))) if (usb_pipeisoc(urb->pipe)) {
return 0;
for (i = 0; i < urb->number_of_packets; i++) { for (i = 0; i < urb->number_of_packets; i++) {
if (put_user(urb->iso_frame_desc[i].actual_length, if (put_user(urb->iso_frame_desc[i].actual_length,
&userurb->iso_frame_desc[i].actual_length)) &userurb->iso_frame_desc[i].actual_length))
@ -1042,6 +1034,7 @@ static int processcompl(struct async *as, void __user * __user *arg)
&userurb->iso_frame_desc[i].status)) &userurb->iso_frame_desc[i].status))
return -EFAULT; return -EFAULT;
} }
}
free_async(as); free_async(as);
@ -1126,7 +1119,7 @@ static int proc_submiturb_compat(struct dev_state *ps, void __user *arg)
if (get_urb32(&uurb,(struct usbdevfs_urb32 *)arg)) if (get_urb32(&uurb,(struct usbdevfs_urb32 *)arg))
return -EFAULT; return -EFAULT;
return proc_do_submiturb(ps, &uurb, ((struct usbdevfs_urb __user *)arg)->iso_frame_desc, arg); return proc_do_submiturb(ps, &uurb, ((struct usbdevfs_urb32 __user *)arg)->iso_frame_desc, arg);
} }
static int processcompl_compat(struct async *as, void __user * __user *arg) static int processcompl_compat(struct async *as, void __user * __user *arg)
@ -1146,8 +1139,7 @@ static int processcompl_compat(struct async *as, void __user * __user *arg)
if (put_user(urb->error_count, &userurb->error_count)) if (put_user(urb->error_count, &userurb->error_count))
return -EFAULT; return -EFAULT;
if (!(usb_pipeisoc(urb->pipe))) if (usb_pipeisoc(urb->pipe)) {
return 0;
for (i = 0; i < urb->number_of_packets; i++) { for (i = 0; i < urb->number_of_packets; i++) {
if (put_user(urb->iso_frame_desc[i].actual_length, if (put_user(urb->iso_frame_desc[i].actual_length,
&userurb->iso_frame_desc[i].actual_length)) &userurb->iso_frame_desc[i].actual_length))
@ -1156,6 +1148,7 @@ static int processcompl_compat(struct async *as, void __user * __user *arg)
&userurb->iso_frame_desc[i].status)) &userurb->iso_frame_desc[i].status))
return -EFAULT; return -EFAULT;
} }
}
free_async(as); free_async(as);
if (put_user((u32)(u64)addr, (u32 __user *)arg)) if (put_user((u32)(u64)addr, (u32 __user *)arg))
@ -1177,10 +1170,8 @@ static int proc_reapurbnonblock_compat(struct dev_state *ps, void __user *arg)
{ {
struct async *as; struct async *as;
printk("reapurbnblock\n");
if (!(as = async_getcompleted(ps))) if (!(as = async_getcompleted(ps)))
return -EAGAIN; return -EAGAIN;
printk("reap got as %p\n", as);
return processcompl_compat(as, (void __user * __user *)arg); return processcompl_compat(as, (void __user * __user *)arg);
} }
@ -1248,7 +1239,6 @@ static int proc_ioctl (struct dev_state *ps, void __user *arg)
} }
if (!connected(ps->dev)) { if (!connected(ps->dev)) {
if (buf)
kfree(buf); kfree(buf);
return -ENODEV; return -ENODEV;
} }
@ -1311,7 +1301,7 @@ static int proc_ioctl (struct dev_state *ps, void __user *arg)
&& size > 0 && size > 0
&& copy_to_user (ctrl.data, buf, size) != 0) && copy_to_user (ctrl.data, buf, size) != 0)
retval = -EFAULT; retval = -EFAULT;
if (buf != NULL)
kfree(buf); kfree(buf);
return retval; return retval;
} }

View File

@ -28,6 +28,8 @@
#endif #endif
#include <linux/usb.h> #include <linux/usb.h>
#include "usb.h"
#define MAX_USB_MINORS 256 #define MAX_USB_MINORS 256
static struct file_operations *usb_minors[MAX_USB_MINORS]; static struct file_operations *usb_minors[MAX_USB_MINORS];
static DEFINE_SPINLOCK(minor_lock); static DEFINE_SPINLOCK(minor_lock);

View File

@ -33,7 +33,7 @@
#include "hcd.h" #include "hcd.h"
/* PCI-based HCs are normal, but custom bus glue should be ok */ /* PCI-based HCs are common, but plenty of non-PCI HCs are used too */
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
@ -67,8 +67,8 @@ int usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id)
if (pci_enable_device (dev) < 0) if (pci_enable_device (dev) < 0)
return -ENODEV; return -ENODEV;
dev->current_state = 0; dev->current_state = PCI_D0;
dev->dev.power.power_state = 0; dev->dev.power.power_state = PMSG_ON;
if (!dev->irq) { if (!dev->irq) {
dev_err (&dev->dev, dev_err (&dev->dev,
@ -186,26 +186,14 @@ EXPORT_SYMBOL (usb_hcd_pci_remove);
#ifdef CONFIG_PM #ifdef CONFIG_PM
static char __attribute_used__ *pci_state(u32 state)
{
switch (state) {
case 0: return "D0";
case 1: return "D1";
case 2: return "D2";
case 3: return "D3hot";
case 4: return "D3cold";
}
return NULL;
}
/** /**
* usb_hcd_pci_suspend - power management suspend of a PCI-based HCD * usb_hcd_pci_suspend - power management suspend of a PCI-based HCD
* @dev: USB Host Controller being suspended * @dev: USB Host Controller being suspended
* @state: state that the controller is going into * @message: semantics in flux
* *
* Store this function in the HCD's struct pci_driver as suspend(). * Store this function in the HCD's struct pci_driver as suspend().
*/ */
int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state) int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message)
{ {
struct usb_hcd *hcd; struct usb_hcd *hcd;
int retval = 0; int retval = 0;
@ -213,13 +201,23 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state)
hcd = pci_get_drvdata(dev); hcd = pci_get_drvdata(dev);
/* FIXME until the generic PM interfaces change a lot more, this
* can't use PCI D1 and D2 states. For example, the confusion
* between messages and states will need to vanish, and messages
* will need to provide a target system state again.
*
* It'll be important to learn characteristics of the target state,
* especially on embedded hardware where the HCD will often be in
* charge of an external VBUS power supply and one or more clocks.
* Some target system states will leave them active; others won't.
* (With PCI, that's often handled by platform BIOS code.)
*/
/* even when the PCI layer rejects some of the PCI calls /* even when the PCI layer rejects some of the PCI calls
* below, HCs can try global suspend and reduce DMA traffic. * below, HCs can try global suspend and reduce DMA traffic.
* PM-sensitive HCDs may already have done this. * PM-sensitive HCDs may already have done this.
*/ */
has_pci_pm = pci_find_capability(dev, PCI_CAP_ID_PM); has_pci_pm = pci_find_capability(dev, PCI_CAP_ID_PM);
if (state > 4)
state = 4;
switch (hcd->state) { switch (hcd->state) {
@ -228,7 +226,7 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state)
*/ */
case HC_STATE_RUNNING: case HC_STATE_RUNNING:
hcd->state = HC_STATE_QUIESCING; hcd->state = HC_STATE_QUIESCING;
retval = hcd->driver->suspend (hcd, state); retval = hcd->driver->suspend (hcd, message);
if (retval) { if (retval) {
dev_dbg (hcd->self.controller, dev_dbg (hcd->self.controller,
"suspend fail, retval %d\n", "suspend fail, retval %d\n",
@ -246,14 +244,11 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state)
* have been called, otherwise root hub timers still run ... * have been called, otherwise root hub timers still run ...
*/ */
case HC_STATE_SUSPENDED: case HC_STATE_SUSPENDED:
if (state <= dev->current_state) /* no DMA or IRQs except when HC is active */
break; if (dev->current_state == PCI_D0) {
free_irq (hcd->irq, hcd);
/* no DMA or IRQs except in D0 */
if (!dev->current_state) {
pci_save_state (dev); pci_save_state (dev);
pci_disable_device (dev); pci_disable_device (dev);
free_irq (hcd->irq, hcd);
} }
if (!has_pci_pm) { if (!has_pci_pm) {
@ -261,25 +256,19 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state)
break; break;
} }
/* POLICY: ignore D1/D2/D3hot differences; /* NOTE: dev->current_state becomes nonzero only here, and
* we know D3hot will always work. * only for devices that support PCI PM. Also, exiting
* PCI_D3 (but not PCI_D1 or PCI_D2) is allowed to reset
* some device state (e.g. as part of clock reinit).
*/ */
retval = pci_set_power_state (dev, state); retval = pci_set_power_state (dev, PCI_D3hot);
if (retval < 0 && state < 3) {
retval = pci_set_power_state (dev, 3);
if (retval == 0)
state = 3;
}
if (retval == 0) { if (retval == 0) {
dev_dbg (hcd->self.controller, "--> PCI %s\n", dev_dbg (hcd->self.controller, "--> PCI D3\n");
pci_state(dev->current_state)); pci_enable_wake (dev, PCI_D3hot, hcd->remote_wakeup);
#ifdef CONFIG_USB_SUSPEND pci_enable_wake (dev, PCI_D3cold, hcd->remote_wakeup);
pci_enable_wake (dev, state, hcd->remote_wakeup);
pci_enable_wake (dev, 4, hcd->remote_wakeup);
#endif
} else if (retval < 0) { } else if (retval < 0) {
dev_dbg (&dev->dev, "PCI %s suspend fail, %d\n", dev_dbg (&dev->dev, "PCI D3 suspend fail, %d\n",
pci_state(state), retval); retval);
(void) usb_hcd_pci_resume (dev); (void) usb_hcd_pci_resume (dev);
break; break;
} }
@ -287,13 +276,14 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state)
default: default:
dev_dbg (hcd->self.controller, "hcd state %d; not suspended\n", dev_dbg (hcd->self.controller, "hcd state %d; not suspended\n",
hcd->state); hcd->state);
WARN_ON(1);
retval = -EINVAL; retval = -EINVAL;
break; break;
} }
/* update power_state **ONLY** to make sysfs happier */ /* update power_state **ONLY** to make sysfs happier */
if (retval == 0) if (retval == 0)
dev->dev.power.power_state = state; dev->dev.power.power_state = message;
return retval; return retval;
} }
EXPORT_SYMBOL (usb_hcd_pci_suspend); EXPORT_SYMBOL (usb_hcd_pci_suspend);
@ -308,7 +298,6 @@ int usb_hcd_pci_resume (struct pci_dev *dev)
{ {
struct usb_hcd *hcd; struct usb_hcd *hcd;
int retval; int retval;
int has_pci_pm;
hcd = pci_get_drvdata(dev); hcd = pci_get_drvdata(dev);
if (hcd->state != HC_STATE_SUSPENDED) { if (hcd->state != HC_STATE_SUSPENDED) {
@ -316,31 +305,73 @@ int usb_hcd_pci_resume (struct pci_dev *dev)
"can't resume, not suspended!\n"); "can't resume, not suspended!\n");
return 0; return 0;
} }
has_pci_pm = pci_find_capability(dev, PCI_CAP_ID_PM);
/* D3cold resume isn't usually reported this way... */ /* NOTE: chip docs cover clean "real suspend" cases (what Linux
dev_dbg(hcd->self.controller, "resume from PCI %s%s\n", * calls "standby", "suspend to RAM", and so on). There are also
pci_state(dev->current_state), * dirty cases when swsusp fakes a suspend in "shutdown" mode.
has_pci_pm ? "" : " (legacy)"); */
if (dev->current_state != PCI_D0) {
#ifdef DEBUG
int pci_pm;
u16 pmcr;
pci_pm = pci_find_capability(dev, PCI_CAP_ID_PM);
pci_read_config_word(dev, pci_pm + PCI_PM_CTRL, &pmcr);
pmcr &= PCI_PM_CTRL_STATE_MASK;
if (pmcr) {
/* Clean case: power to USB and to HC registers was
* maintained; remote wakeup is easy.
*/
dev_dbg(hcd->self.controller, "resume from PCI D%d\n",
pmcr);
} else {
/* Clean: HC lost Vcc power, D0 uninitialized
* + Vaux may have preserved port and transceiver
* state ... for remote wakeup from D3cold
* + or not; HCD must reinit + re-enumerate
*
* Dirty: D0 semi-initialized cases with swsusp
* + after BIOS init
* + after Linux init (HCD statically linked)
*/
dev_dbg(hcd->self.controller,
"PCI D0, from previous PCI D%d\n",
dev->current_state);
}
#endif
pci_enable_wake (dev, dev->current_state, 0);
pci_enable_wake (dev, PCI_D3cold, 0);
} else {
/* Same basic cases: clean (powered/not), dirty */
dev_dbg(hcd->self.controller, "PCI legacy resume\n");
}
/* NOTE: the PCI API itself is asymmetric here. We don't need to
* pci_set_power_state(PCI_D0) since that's part of re-enabling;
* but that won't re-enable bus mastering. Yet pci_disable_device()
* explicitly disables bus mastering...
*/
retval = pci_enable_device (dev);
if (retval < 0) {
dev_err (hcd->self.controller,
"can't re-enable after resume, %d!\n", retval);
return retval;
}
pci_set_master (dev);
pci_restore_state (dev);
dev->dev.power.power_state = PMSG_ON;
hcd->state = HC_STATE_RESUMING; hcd->state = HC_STATE_RESUMING;
hcd->saw_irq = 0;
if (has_pci_pm)
pci_set_power_state (dev, 0);
dev->dev.power.power_state = 0;
retval = request_irq (dev->irq, usb_hcd_irq, SA_SHIRQ, retval = request_irq (dev->irq, usb_hcd_irq, SA_SHIRQ,
hcd->driver->description, hcd); hcd->irq_descr, hcd);
if (retval < 0) { if (retval < 0) {
dev_err (hcd->self.controller, dev_err (hcd->self.controller,
"can't restore IRQ after resume!\n"); "can't restore IRQ after resume!\n");
usb_hc_died (hcd);
return retval; return retval;
} }
hcd->saw_irq = 0;
pci_restore_state (dev);
#ifdef CONFIG_USB_SUSPEND
pci_enable_wake (dev, dev->current_state, 0);
pci_enable_wake (dev, 4, 0);
#endif
retval = hcd->driver->resume (hcd); retval = hcd->driver->resume (hcd);
if (!HC_IS_RUNNING (hcd->state)) { if (!HC_IS_RUNNING (hcd->state)) {

View File

@ -177,7 +177,7 @@ struct hc_driver {
* a whole, not just the root hub; they're for bus glue. * a whole, not just the root hub; they're for bus glue.
*/ */
/* called after all devices were suspended */ /* called after all devices were suspended */
int (*suspend) (struct usb_hcd *hcd, u32 state); int (*suspend) (struct usb_hcd *hcd, pm_message_t message);
/* called before any devices get resumed */ /* called before any devices get resumed */
int (*resume) (struct usb_hcd *hcd); int (*resume) (struct usb_hcd *hcd);
@ -226,7 +226,7 @@ extern int usb_hcd_pci_probe (struct pci_dev *dev,
extern void usb_hcd_pci_remove (struct pci_dev *dev); extern void usb_hcd_pci_remove (struct pci_dev *dev);
#ifdef CONFIG_PM #ifdef CONFIG_PM
extern int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state); extern int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t state);
extern int usb_hcd_pci_resume (struct pci_dev *dev); extern int usb_hcd_pci_resume (struct pci_dev *dev);
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */

View File

@ -728,15 +728,11 @@ static void hub_disconnect(struct usb_interface *intf)
list_del_init(&hub->event_list); list_del_init(&hub->event_list);
spin_unlock_irq(&hub_event_lock); spin_unlock_irq(&hub_event_lock);
if (hub->descriptor) {
kfree(hub->descriptor); kfree(hub->descriptor);
hub->descriptor = NULL; hub->descriptor = NULL;
}
if (hub->status) {
kfree(hub->status); kfree(hub->status);
hub->status = NULL; hub->status = NULL;
}
if (hub->buffer) { if (hub->buffer) {
usb_buffer_free(hdev, sizeof(*hub->buffer), hub->buffer, usb_buffer_free(hdev, sizeof(*hub->buffer), hub->buffer,
@ -1456,7 +1452,7 @@ static void hub_port_logical_disconnect(struct usb_hub *hub, int port1)
/* FIXME let caller ask to power down the port: /* FIXME let caller ask to power down the port:
* - some devices won't enumerate without a VBUS power cycle * - some devices won't enumerate without a VBUS power cycle
* - SRP saves power that way * - SRP saves power that way
* - usb_suspend_device(dev,PM_SUSPEND_DISK) * - usb_suspend_device(dev, PMSG_SUSPEND)
* That's easy if this hub can switch power per-port, and * That's easy if this hub can switch power per-port, and
* khubd reactivates the port later (timer, SRP, etc). * khubd reactivates the port later (timer, SRP, etc).
* Powerdown must be optional, because of reset/DFU. * Powerdown must be optional, because of reset/DFU.
@ -1531,7 +1527,7 @@ static int hub_port_suspend(struct usb_hub *hub, int port1,
/* /*
* Devices on USB hub ports have only one "suspend" state, corresponding * Devices on USB hub ports have only one "suspend" state, corresponding
* to ACPI D2 (PM_SUSPEND_MEM), "may cause the device to lose some context". * to ACPI D2, "may cause the device to lose some context".
* State transitions include: * State transitions include:
* *
* - suspend, resume ... when the VBUS power link stays live * - suspend, resume ... when the VBUS power link stays live
@ -1731,7 +1727,7 @@ static int finish_port_resume(struct usb_device *udev)
struct usb_driver *driver; struct usb_driver *driver;
intf = udev->actconfig->interface[i]; intf = udev->actconfig->interface[i];
if (intf->dev.power.power_state == PM_SUSPEND_ON) if (intf->dev.power.power_state == PMSG_SUSPEND)
continue; continue;
if (!intf->dev.driver) { if (!intf->dev.driver) {
/* FIXME maybe force to alt 0 */ /* FIXME maybe force to alt 0 */
@ -1745,7 +1741,7 @@ static int finish_port_resume(struct usb_device *udev)
/* can we do better than just logging errors? */ /* can we do better than just logging errors? */
status = driver->resume(intf); status = driver->resume(intf);
if (intf->dev.power.power_state != PM_SUSPEND_ON if (intf->dev.power.power_state != PMSG_ON
|| status) || status)
dev_dbg(&intf->dev, dev_dbg(&intf->dev,
"resume fail, state %d code %d\n", "resume fail, state %d code %d\n",

View File

@ -41,6 +41,7 @@
#include <linux/parser.h> #include <linux/parser.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include "usb.h" #include "usb.h"
#include "hcd.h"
static struct super_operations usbfs_ops; static struct super_operations usbfs_ops;
static struct file_operations default_file_operations; static struct file_operations default_file_operations;

View File

@ -1133,29 +1133,10 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
/* prevent submissions using previous endpoint settings */ /* prevent submissions using previous endpoint settings */
usb_disable_interface(dev, iface); usb_disable_interface(dev, iface);
/* 9.1.1.5 says:
*
* Configuring a device or changing an alternate setting
* causes all of the status and configuration values
* associated with endpoints in the affected interfaces to
* be set to their default values. This includes setting
* the data toggle of any endpoint using data toggles to
* the value DATA0.
*
* Some devices take this too literally and don't reset the data
* toggles if the new altsetting is the same as the old one (the
* command isn't "changing" an alternate setting). We will manually
* reset the toggles when the new and old altsettings are the same.
* Most devices won't need this, but fortunately it doesn't happen
* often.
*/
if (iface->cur_altsetting == alt)
manual = 1;
iface->cur_altsetting = alt; iface->cur_altsetting = alt;
/* If the interface only has one altsetting and the device didn't /* If the interface only has one altsetting and the device didn't
* accept the request (or whenever the old altsetting is the same * accept the request, we attempt to carry out the equivalent action
* as the new one), we attempt to carry out the equivalent action
* by manually clearing the HALT feature for each endpoint in the * by manually clearing the HALT feature for each endpoint in the
* new altsetting. * new altsetting.
*/ */
@ -1202,7 +1183,9 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
* *
* Because this affects multiple interfaces, avoid using this with composite * Because this affects multiple interfaces, avoid using this with composite
* (multi-interface) devices. Instead, the driver for each interface may * (multi-interface) devices. Instead, the driver for each interface may
* use usb_set_interface() on the interfaces it claims. Resetting the whole * use usb_set_interface() on the interfaces it claims. Be careful though;
* some devices don't support the SET_INTERFACE request, and others won't
* reset all the interface state (notably data toggles). Resetting the whole
* configuration would affect other drivers' interfaces. * configuration would affect other drivers' interfaces.
* *
* The caller must own the device lock. * The caller must own the device lock.

View File

@ -420,12 +420,16 @@ int usb_submit_urb(struct urb *urb, int mem_flags)
* *
* Host Controller Drivers (HCDs) place all the URBs for a particular * Host Controller Drivers (HCDs) place all the URBs for a particular
* endpoint in a queue. Normally the queue advances as the controller * endpoint in a queue. Normally the queue advances as the controller
* hardware processes each request. But when an URB terminates with any * hardware processes each request. But when an URB terminates with an
* fault (such as an error, or being unlinked) its queue stops, at least * error its queue stops, at least until that URB's completion routine
* until that URB's completion routine returns. It is guaranteed that * returns. It is guaranteed that the queue will not restart until all
* the queue will not restart until all its unlinked URBs have been fully * its unlinked URBs have been fully retired, with their completion
* retired, with their completion routines run, even if that's not until * routines run, even if that's not until some time after the original
* some time after the original completion handler returns. * completion handler returns. Normally the same behavior and guarantees
* apply when an URB terminates because it was unlinked; however if an
* URB is unlinked before the hardware has started to execute it, then
* its queue is not guaranteed to stop until all the preceding URBs have
* completed.
* *
* This means that USB device drivers can safely build deep queues for * This means that USB device drivers can safely build deep queues for
* large or complex transfers, and clean them up reliably after any sort * large or complex transfers, and clean them up reliably after any sort

View File

@ -50,13 +50,6 @@
#include "hcd.h" #include "hcd.h"
#include "usb.h" #include "usb.h"
extern int usb_hub_init(void);
extern void usb_hub_cleanup(void);
extern int usb_major_init(void);
extern void usb_major_cleanup(void);
extern int usb_host_init(void);
extern void usb_host_cleanup(void);
const char *usbcore_name = "usbcore"; const char *usbcore_name = "usbcore";
@ -1382,13 +1375,13 @@ void usb_buffer_unmap_sg (struct usb_device *dev, unsigned pipe,
usb_pipein (pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE); usb_pipein (pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE);
} }
static int usb_generic_suspend(struct device *dev, u32 state) static int usb_generic_suspend(struct device *dev, pm_message_t message)
{ {
struct usb_interface *intf; struct usb_interface *intf;
struct usb_driver *driver; struct usb_driver *driver;
if (dev->driver == &usb_generic_driver) if (dev->driver == &usb_generic_driver)
return usb_suspend_device (to_usb_device(dev), state); return usb_suspend_device (to_usb_device(dev), message);
if ((dev->driver == NULL) || if ((dev->driver == NULL) ||
(dev->driver_data == &usb_generic_driver_data)) (dev->driver_data == &usb_generic_driver_data))
@ -1402,7 +1395,7 @@ static int usb_generic_suspend(struct device *dev, u32 state)
return 0; return 0;
if (driver->suspend) if (driver->suspend)
return driver->suspend(intf, state); return driver->suspend(intf, message);
return 0; return 0;
} }

View File

@ -21,6 +21,13 @@ extern void usb_unlock_all_devices(void);
extern void usb_kick_khubd(struct usb_device *dev); extern void usb_kick_khubd(struct usb_device *dev);
extern void usb_resume_root_hub(struct usb_device *dev); extern void usb_resume_root_hub(struct usb_device *dev);
extern int usb_hub_init(void);
extern void usb_hub_cleanup(void);
extern int usb_major_init(void);
extern void usb_major_cleanup(void);
extern int usb_host_init(void);
extern void usb_host_cleanup(void);
/* for labeling diagnostics */ /* for labeling diagnostics */
extern const char *usbcore_name; extern const char *usbcore_name;
@ -30,6 +37,7 @@ extern struct file_operations usbfs_devices_fops;
extern struct file_operations usbfs_device_file_operations; extern struct file_operations usbfs_device_file_operations;
extern void usbfs_conn_disc_event(void); extern void usbfs_conn_disc_event(void);
struct dev_state { struct dev_state {
struct list_head list; /* state list */ struct list_head list; /* state list */
struct usb_device *dev; struct usb_device *dev;

View File

@ -100,6 +100,8 @@ static const char driver_desc [] = DRIVER_DESC;
/* CDC and RNDIS support the same host-chosen outgoing packet filters. */ /* CDC and RNDIS support the same host-chosen outgoing packet filters. */
#define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \ #define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \
|USB_CDC_PACKET_TYPE_ALL_MULTICAST \
|USB_CDC_PACKET_TYPE_PROMISCUOUS \
|USB_CDC_PACKET_TYPE_DIRECTED) |USB_CDC_PACKET_TYPE_DIRECTED)
@ -322,12 +324,18 @@ module_param (qmult, uint, S_IRUGO|S_IWUSR);
/* also defer IRQs on highspeed TX */ /* also defer IRQs on highspeed TX */
#define TX_DELAY qmult #define TX_DELAY qmult
#define BITRATE(g) (((g)->speed == USB_SPEED_HIGH) ? HS_BPS : FS_BPS) static inline int BITRATE(struct usb_gadget *g)
{
return (g->speed == USB_SPEED_HIGH) ? HS_BPS : FS_BPS;
}
#else /* full speed (low speed doesn't do bulk) */ #else /* full speed (low speed doesn't do bulk) */
#define qlen(gadget) DEFAULT_QLEN #define qlen(gadget) DEFAULT_QLEN
#define BITRATE(g) FS_BPS static inline int BITRATE(struct usb_gadget *g)
{
return FS_BPS;
}
#endif #endif
@ -1167,7 +1175,7 @@ eth_set_config (struct eth_dev *dev, unsigned number, int gfp_flags)
eth_reset_config (dev); eth_reset_config (dev);
/* default: pass all packets, no multicast filtering */ /* default: pass all packets, no multicast filtering */
dev->cdc_filter = 0x000f; dev->cdc_filter = DEFAULT_FILTER;
switch (number) { switch (number) {
case DEV_CONFIG_VALUE: case DEV_CONFIG_VALUE:
@ -1343,9 +1351,9 @@ eth_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
struct eth_dev *dev = get_gadget_data (gadget); struct eth_dev *dev = get_gadget_data (gadget);
struct usb_request *req = dev->req; struct usb_request *req = dev->req;
int value = -EOPNOTSUPP; int value = -EOPNOTSUPP;
u16 wIndex = ctrl->wIndex; u16 wIndex = (__force u16) ctrl->wIndex;
u16 wValue = ctrl->wValue; u16 wValue = (__force u16) ctrl->wValue;
u16 wLength = ctrl->wLength; u16 wLength = (__force u16) ctrl->wLength;
/* descriptors just go into the pre-allocated ep0 buffer, /* descriptors just go into the pre-allocated ep0 buffer,
* while config change events may enable network traffic. * while config change events may enable network traffic.
@ -1693,7 +1701,7 @@ rx_submit (struct eth_dev *dev, struct usb_request *req, int gfp_flags)
/* Some platforms perform better when IP packets are aligned, /* Some platforms perform better when IP packets are aligned,
* but on at least one, checksumming fails otherwise. Note: * but on at least one, checksumming fails otherwise. Note:
* this doesn't account for variable-sized RNDIS headers. * RNDIS headers involve variable numbers of LE32 values.
*/ */
skb_reserve(skb, NET_IP_ALIGN); skb_reserve(skb, NET_IP_ALIGN);
@ -1730,9 +1738,11 @@ static void rx_complete (struct usb_ep *ep, struct usb_request *req)
#ifdef CONFIG_USB_ETH_RNDIS #ifdef CONFIG_USB_ETH_RNDIS
/* we know MaxPacketsPerTransfer == 1 here */ /* we know MaxPacketsPerTransfer == 1 here */
if (dev->rndis) if (dev->rndis)
rndis_rm_hdr (req->buf, &(skb->len)); status = rndis_rm_hdr (skb);
#endif #endif
if (ETH_HLEN > skb->len || skb->len > ETH_FRAME_LEN) { if (status < 0
|| ETH_HLEN > skb->len
|| skb->len > ETH_FRAME_LEN) {
dev->stats.rx_errors++; dev->stats.rx_errors++;
dev->stats.rx_length_errors++; dev->stats.rx_length_errors++;
DEBUG (dev, "rx length %d\n", skb->len); DEBUG (dev, "rx length %d\n", skb->len);
@ -2047,38 +2057,20 @@ rndis_control_ack_complete (struct usb_ep *ep, struct usb_request *req)
DEBUG ((struct eth_dev *) ep->driver_data, DEBUG ((struct eth_dev *) ep->driver_data,
"rndis control ack complete --> %d, %d/%d\n", "rndis control ack complete --> %d, %d/%d\n",
req->status, req->actual, req->length); req->status, req->actual, req->length);
usb_ep_free_buffer(ep, req->buf, req->dma, 8);
usb_ep_free_request(ep, req);
} }
static int rndis_control_ack (struct net_device *net) static int rndis_control_ack (struct net_device *net)
{ {
struct eth_dev *dev = netdev_priv(net); struct eth_dev *dev = netdev_priv(net);
u32 length; u32 length;
struct usb_request *resp; struct usb_request *resp = dev->stat_req;
/* in case RNDIS calls this after disconnect */ /* in case RNDIS calls this after disconnect */
if (!dev->status_ep) { if (!dev->status) {
DEBUG (dev, "status ENODEV\n"); DEBUG (dev, "status ENODEV\n");
return -ENODEV; return -ENODEV;
} }
/* Allocate memory for notification ie. ACK */
resp = usb_ep_alloc_request (dev->status_ep, GFP_ATOMIC);
if (!resp) {
DEBUG (dev, "status ENOMEM\n");
return -ENOMEM;
}
resp->buf = usb_ep_alloc_buffer (dev->status_ep, 8,
&resp->dma, GFP_ATOMIC);
if (!resp->buf) {
DEBUG (dev, "status buf ENOMEM\n");
usb_ep_free_request (dev->status_ep, resp);
return -ENOMEM;
}
/* Send RNDIS RESPONSE_AVAILABLE notification; /* Send RNDIS RESPONSE_AVAILABLE notification;
* USB_CDC_NOTIFY_RESPONSE_AVAILABLE should work too * USB_CDC_NOTIFY_RESPONSE_AVAILABLE should work too
*/ */
@ -2113,7 +2105,7 @@ static void eth_start (struct eth_dev *dev, int gfp_flags)
if (dev->rndis) { if (dev->rndis) {
rndis_set_param_medium (dev->rndis_config, rndis_set_param_medium (dev->rndis_config,
NDIS_MEDIUM_802_3, NDIS_MEDIUM_802_3,
BITRATE(dev->gadget)); BITRATE(dev->gadget)/100);
rndis_send_media_state (dev, 1); rndis_send_media_state (dev, 1);
} }
#endif #endif

View File

@ -2809,17 +2809,15 @@ static int __exit omap_udc_remove(struct device *dev)
return 0; return 0;
} }
/* suspend/resume/wakeup from sysfs (echo > power/state) */ static int omap_udc_suspend(struct device *dev, pm_message_t state, u32 level)
static int omap_udc_suspend(struct device *dev, u32 state, u32 level)
{ {
if (level != 0) if (level != 0)
return 0; return 0;
DBG("suspend, state %d\n", state); DBG("suspend, state %d\n", state);
omap_pullup(&udc->gadget, 0); omap_pullup(&udc->gadget, 0);
udc->gadget.dev.power.power_state = 3; udc->gadget.dev.power.power_state = PMSG_SUSPEND;
udc->gadget.dev.parent->power.power_state = 3; udc->gadget.dev.parent->power.power_state = PMSG_SUSPEND;
return 0; return 0;
} }
@ -2829,8 +2827,8 @@ static int omap_udc_resume(struct device *dev, u32 level)
return 0; return 0;
DBG("resume + wakeup/SRP\n"); DBG("resume + wakeup/SRP\n");
udc->gadget.dev.parent->power.power_state = 0; udc->gadget.dev.parent->power.power_state = PMSG_ON;
udc->gadget.dev.power.power_state = 0; udc->gadget.dev.power.power_state = PMSG_ON;
omap_pullup(&udc->gadget, 1); omap_pullup(&udc->gadget, 1);
/* maybe the host would enumerate us if we nudged it */ /* maybe the host would enumerate us if we nudged it */

View File

@ -37,6 +37,7 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/unaligned.h>
#undef RNDIS_PM #undef RNDIS_PM
@ -165,7 +166,7 @@ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r)
/* mandatory */ /* mandatory */
case OID_GEN_LINK_SPEED: case OID_GEN_LINK_SPEED:
DEBUG("%s: OID_GEN_LINK_SPEED\n", __FUNCTION__); // DEBUG("%s: OID_GEN_LINK_SPEED\n", __FUNCTION__);
length = 4; length = 4;
if (rndis_per_dev_params [configNr].media_state if (rndis_per_dev_params [configNr].media_state
== NDIS_MEDIA_STATE_DISCONNECTED) == NDIS_MEDIA_STATE_DISCONNECTED)
@ -729,7 +730,7 @@ static int gen_ndis_set_resp (u8 configNr, u32 OID, u8 *buf, u32 buf_len,
retval = 0; retval = 0;
/* FIXME use these NDIS_PACKET_TYPE_* bitflags to /* FIXME use these NDIS_PACKET_TYPE_* bitflags to
* filter packets in hard_start_xmit() * set the cdc_filter; it's not RNDIS-specific
* NDIS_PACKET_TYPE_x == USB_CDC_PACKET_TYPE_x for x in: * NDIS_PACKET_TYPE_x == USB_CDC_PACKET_TYPE_x for x in:
* PROMISCUOUS, DIRECTED, * PROMISCUOUS, DIRECTED,
* MULTICAST, ALL_MULTICAST, BROADCAST * MULTICAST, ALL_MULTICAST, BROADCAST
@ -1194,10 +1195,10 @@ void rndis_add_hdr (struct sk_buff *skb)
return; return;
header = (void *) skb_push (skb, sizeof *header); header = (void *) skb_push (skb, sizeof *header);
memset (header, 0, sizeof *header); memset (header, 0, sizeof *header);
header->MessageType = __constant_cpu_to_le32 (1); header->MessageType = __constant_cpu_to_le32(REMOTE_NDIS_PACKET_MSG);
header->MessageLength = cpu_to_le32(skb->len); header->MessageLength = cpu_to_le32(skb->len);
header->DataOffset = __constant_cpu_to_le32 (36); header->DataOffset = __constant_cpu_to_le32 (36);
header->OOBDataOffset = cpu_to_le32(skb->len - 44); header->DataLength = cpu_to_le32(skb->len - sizeof *header);
} }
void rndis_free_response (int configNr, u8 *buf) void rndis_free_response (int configNr, u8 *buf)
@ -1253,25 +1254,22 @@ static rndis_resp_t *rndis_add_response (int configNr, u32 length)
return r; return r;
} }
int rndis_rm_hdr (u8 *buf, u32 *length) int rndis_rm_hdr(struct sk_buff *skb)
{ {
u32 i, messageLen, dataOffset; /* tmp points to a struct rndis_packet_msg_type */
__le32 *tmp; __le32 *tmp = (void *) skb->data;
tmp = (__le32 *) buf; /* MessageType, MessageLength */
if (__constant_cpu_to_le32(REMOTE_NDIS_PACKET_MSG)
!= get_unaligned(tmp++))
return -EINVAL;
tmp++;
if (!buf || !length) return -1; /* DataOffset, DataLength */
if (le32_to_cpup(tmp++) != 1) return -1; if (!skb_pull(skb, le32_to_cpu(get_unaligned(tmp++))
+ 8 /* offset of DataOffset */))
messageLen = le32_to_cpup(tmp++); return -EOVERFLOW;
dataOffset = le32_to_cpup(tmp++) + 8; skb_trim(skb, le32_to_cpu(get_unaligned(tmp++)));
if (messageLen < dataOffset || messageLen > *length) return -1;
for (i = dataOffset; i < messageLen; i++)
buf [i - dataOffset] = buf [i];
*length = messageLen - dataOffset;
return 0; return 0;
} }

View File

@ -38,6 +38,7 @@
*/ */
/* Message Set for Connectionless (802.3) Devices */ /* Message Set for Connectionless (802.3) Devices */
#define REMOTE_NDIS_PACKET_MSG 0x00000001U
#define REMOTE_NDIS_INITIALIZE_MSG 0x00000002U /* Initialize device */ #define REMOTE_NDIS_INITIALIZE_MSG 0x00000002U /* Initialize device */
#define REMOTE_NDIS_HALT_MSG 0x00000003U #define REMOTE_NDIS_HALT_MSG 0x00000003U
#define REMOTE_NDIS_QUERY_MSG 0x00000004U #define REMOTE_NDIS_QUERY_MSG 0x00000004U
@ -333,7 +334,7 @@ int rndis_set_param_vendor (u8 configNr, u32 vendorID,
const char *vendorDescr); const char *vendorDescr);
int rndis_set_param_medium (u8 configNr, u32 medium, u32 speed); int rndis_set_param_medium (u8 configNr, u32 medium, u32 speed);
void rndis_add_hdr (struct sk_buff *skb); void rndis_add_hdr (struct sk_buff *skb);
int rndis_rm_hdr (u8 *buf, u32 *length); int rndis_rm_hdr (struct sk_buff *skb);
u8 *rndis_get_next_response (int configNr, u32 *length); u8 *rndis_get_next_response (int configNr, u32 *length);
void rndis_free_response (int configNr, u8 *buf); void rndis_free_response (int configNr, u8 *buf);

View File

@ -2312,8 +2312,7 @@ static struct gs_buf *gs_buf_alloc(unsigned int size, int kmalloc_flags)
*/ */
void gs_buf_free(struct gs_buf *gb) void gs_buf_free(struct gs_buf *gb)
{ {
if (gb != NULL) { if (gb) {
if (gb->buf_buf != NULL)
kfree(gb->buf_buf); kfree(gb->buf_buf);
kfree(gb); kfree(gb);
} }

View File

@ -394,7 +394,7 @@ static void qh_lines (
mark = ' '; mark = ' ';
if (hw_curr == td->qtd_dma) if (hw_curr == td->qtd_dma)
mark = '*'; mark = '*';
else if (qh->hw_qtd_next == td->qtd_dma) else if (qh->hw_qtd_next == cpu_to_le32(td->qtd_dma))
mark = '+'; mark = '+';
else if (QTD_LENGTH (scratch)) { else if (QTD_LENGTH (scratch)) {
if (td->hw_alt_next == ehci->async->hw_alt_next) if (td->hw_alt_next == ehci->async->hw_alt_next)

View File

@ -721,7 +721,7 @@ static int ehci_get_frame (struct usb_hcd *hcd)
* the right sort of wakeup. * the right sort of wakeup.
*/ */
static int ehci_suspend (struct usb_hcd *hcd, u32 state) static int ehci_suspend (struct usb_hcd *hcd, pm_message_t message)
{ {
struct ehci_hcd *ehci = hcd_to_ehci (hcd); struct ehci_hcd *ehci = hcd_to_ehci (hcd);
@ -729,7 +729,7 @@ static int ehci_suspend (struct usb_hcd *hcd, u32 state)
msleep (100); msleep (100);
#ifdef CONFIG_USB_SUSPEND #ifdef CONFIG_USB_SUSPEND
(void) usb_suspend_device (hcd->self.root_hub, state); (void) usb_suspend_device (hcd->self.root_hub, message);
#else #else
usb_lock_device (hcd->self.root_hub); usb_lock_device (hcd->self.root_hub);
(void) ehci_hub_suspend (hcd); (void) ehci_hub_suspend (hcd);

View File

@ -156,7 +156,6 @@ static void ehci_mem_cleanup (struct ehci_hcd *ehci)
ehci->periodic = NULL; ehci->periodic = NULL;
/* shadow periodic table */ /* shadow periodic table */
if (ehci->pshadow)
kfree(ehci->pshadow); kfree(ehci->pshadow);
ehci->pshadow = NULL; ehci->pshadow = NULL;
} }

View File

@ -310,9 +310,9 @@ static int qh_link_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh)
for (i = qh->start; i < ehci->periodic_size; i += period) { for (i = qh->start; i < ehci->periodic_size; i += period) {
union ehci_shadow *prev = &ehci->pshadow [i]; union ehci_shadow *prev = &ehci->pshadow [i];
u32 *hw_p = &ehci->periodic [i]; __le32 *hw_p = &ehci->periodic [i];
union ehci_shadow here = *prev; union ehci_shadow here = *prev;
u32 type = 0; __le32 type = 0;
/* skip the iso nodes at list head */ /* skip the iso nodes at list head */
while (here.ptr) { while (here.ptr) {

View File

@ -364,7 +364,7 @@ union ehci_shadow {
struct ehci_itd *itd; /* Q_TYPE_ITD */ struct ehci_itd *itd; /* Q_TYPE_ITD */
struct ehci_sitd *sitd; /* Q_TYPE_SITD */ struct ehci_sitd *sitd; /* Q_TYPE_SITD */
struct ehci_fstn *fstn; /* Q_TYPE_FSTN */ struct ehci_fstn *fstn; /* Q_TYPE_FSTN */
u32 *hw_next; /* (all types) */ __le32 *hw_next; /* (all types) */
void *ptr; void *ptr;
}; };

View File

@ -458,9 +458,11 @@ static int ohci_hcd_omap_drv_remove(struct device *dev)
/* states match PCI usage, always suspending the root hub except that /* states match PCI usage, always suspending the root hub except that
* 4 ~= D3cold (ACPI D3) with clock off (resume sees reset). * 4 ~= D3cold (ACPI D3) with clock off (resume sees reset).
*
* FIXME: above comment is not right, and code is wrong, too :-(.
*/ */
static int ohci_omap_suspend(struct device *dev, u32 state, u32 level) static int ohci_omap_suspend(struct device *dev, pm_message_t state, u32 level)
{ {
struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev)); struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev));
int status = -EINVAL; int status = -EINVAL;

View File

@ -54,7 +54,7 @@ ohci_pci_start (struct usb_hcd *hcd)
if (pdev->vendor == PCI_VENDOR_ID_AMD if (pdev->vendor == PCI_VENDOR_ID_AMD
&& pdev->device == 0x740c) { && pdev->device == 0x740c) {
ohci->flags = OHCI_QUIRK_AMD756; ohci->flags = OHCI_QUIRK_AMD756;
ohci_info (ohci, "AMD756 erratum 4 workaround\n"); ohci_dbg (ohci, "AMD756 erratum 4 workaround\n");
// also somewhat erratum 10 (suspend/resume issues) // also somewhat erratum 10 (suspend/resume issues)
} }
@ -68,7 +68,7 @@ ohci_pci_start (struct usb_hcd *hcd)
*/ */
else if (pdev->vendor == PCI_VENDOR_ID_OPTI else if (pdev->vendor == PCI_VENDOR_ID_OPTI
&& pdev->device == 0xc861) { && pdev->device == 0xc861) {
ohci_info (ohci, ohci_dbg (ohci,
"WARNING: OPTi workarounds unavailable\n"); "WARNING: OPTi workarounds unavailable\n");
} }
@ -84,9 +84,20 @@ ohci_pci_start (struct usb_hcd *hcd)
if (b && b->device == PCI_DEVICE_ID_NS_87560_LIO if (b && b->device == PCI_DEVICE_ID_NS_87560_LIO
&& b->vendor == PCI_VENDOR_ID_NS) { && b->vendor == PCI_VENDOR_ID_NS) {
ohci->flags |= OHCI_QUIRK_SUPERIO; ohci->flags |= OHCI_QUIRK_SUPERIO;
ohci_info (ohci, "Using NSC SuperIO setup\n"); ohci_dbg (ohci, "Using NSC SuperIO setup\n");
} }
} }
/* Check for Compaq's ZFMicro chipset, which needs short
* delays before control or bulk queues get re-activated
* in finish_unlinks()
*/
else if (pdev->vendor == PCI_VENDOR_ID_COMPAQ
&& pdev->device == 0xa0f8) {
ohci->flags |= OHCI_QUIRK_ZFMICRO;
ohci_dbg (ohci,
"enabled Compaq ZFMicro chipset quirk\n");
}
} }
/* NOTE: there may have already been a first reset, to /* NOTE: there may have already been a first reset, to
@ -102,7 +113,7 @@ ohci_pci_start (struct usb_hcd *hcd)
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int ohci_pci_suspend (struct usb_hcd *hcd, u32 state) static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message)
{ {
struct ohci_hcd *ohci = hcd_to_ohci (hcd); struct ohci_hcd *ohci = hcd_to_ohci (hcd);
@ -111,7 +122,7 @@ static int ohci_pci_suspend (struct usb_hcd *hcd, u32 state)
msleep (100); msleep (100);
#ifdef CONFIG_USB_SUSPEND #ifdef CONFIG_USB_SUSPEND
(void) usb_suspend_device (hcd->self.root_hub, state); (void) usb_suspend_device (hcd->self.root_hub, message);
#else #else
usb_lock_device (hcd->self.root_hub); usb_lock_device (hcd->self.root_hub);
(void) ohci_hub_suspend (hcd); (void) ohci_hub_suspend (hcd);

View File

@ -337,7 +337,7 @@ static int ohci_hcd_pxa27x_drv_remove(struct device *dev)
return 0; return 0;
} }
static int ohci_hcd_pxa27x_drv_suspend(struct device *dev, u32 state, u32 level) static int ohci_hcd_pxa27x_drv_suspend(struct device *dev, pm_message_t state, u32 level)
{ {
// struct platform_device *pdev = to_platform_device(dev); // struct platform_device *pdev = to_platform_device(dev);
// struct usb_hcd *hcd = dev_get_drvdata(dev); // struct usb_hcd *hcd = dev_get_drvdata(dev);
@ -346,7 +346,7 @@ static int ohci_hcd_pxa27x_drv_suspend(struct device *dev, u32 state, u32 level)
return 0; return 0;
} }
static int ohci_hcd_pxa27x_drv_resume(struct device *dev, u32 state) static int ohci_hcd_pxa27x_drv_resume(struct device *dev, u32 level)
{ {
// struct platform_device *pdev = to_platform_device(dev); // struct platform_device *pdev = to_platform_device(dev);
// struct usb_hcd *hcd = dev_get_drvdata(dev); // struct usb_hcd *hcd = dev_get_drvdata(dev);

View File

@ -1021,6 +1021,8 @@ rescan_this:
if (ohci->ed_controltail) { if (ohci->ed_controltail) {
command |= OHCI_CLF; command |= OHCI_CLF;
if (ohci->flags & OHCI_QUIRK_ZFMICRO)
mdelay(1);
if (!(ohci->hc_control & OHCI_CTRL_CLE)) { if (!(ohci->hc_control & OHCI_CTRL_CLE)) {
control |= OHCI_CTRL_CLE; control |= OHCI_CTRL_CLE;
ohci_writel (ohci, 0, ohci_writel (ohci, 0,
@ -1029,6 +1031,8 @@ rescan_this:
} }
if (ohci->ed_bulktail) { if (ohci->ed_bulktail) {
command |= OHCI_BLF; command |= OHCI_BLF;
if (ohci->flags & OHCI_QUIRK_ZFMICRO)
mdelay(1);
if (!(ohci->hc_control & OHCI_CTRL_BLE)) { if (!(ohci->hc_control & OHCI_CTRL_BLE)) {
control |= OHCI_CTRL_BLE; control |= OHCI_CTRL_BLE;
ohci_writel (ohci, 0, ohci_writel (ohci, 0,
@ -1039,13 +1043,18 @@ rescan_this:
/* CLE/BLE to enable, CLF/BLF to (maybe) kickstart */ /* CLE/BLE to enable, CLF/BLF to (maybe) kickstart */
if (control) { if (control) {
ohci->hc_control |= control; ohci->hc_control |= control;
if (ohci->flags & OHCI_QUIRK_ZFMICRO)
mdelay(1);
ohci_writel (ohci, ohci->hc_control, ohci_writel (ohci, ohci->hc_control,
&ohci->regs->control); &ohci->regs->control);
} }
if (command) if (command) {
if (ohci->flags & OHCI_QUIRK_ZFMICRO)
mdelay(1);
ohci_writel (ohci, command, &ohci->regs->cmdstatus); ohci_writel (ohci, command, &ohci->regs->cmdstatus);
} }
} }
}

View File

@ -396,6 +396,7 @@ struct ohci_hcd {
#define OHCI_QUIRK_SUPERIO 0x02 /* natsemi */ #define OHCI_QUIRK_SUPERIO 0x02 /* natsemi */
#define OHCI_QUIRK_INITRESET 0x04 /* SiS, OPTi, ... */ #define OHCI_QUIRK_INITRESET 0x04 /* SiS, OPTi, ... */
#define OHCI_BIG_ENDIAN 0x08 /* big endian HC */ #define OHCI_BIG_ENDIAN 0x08 /* big endian HC */
#define OHCI_QUIRK_ZFMICRO 0x10 /* Compaq ZFMicro chipset*/
// there are also chip quirks/bugs in init logic // there are also chip quirks/bugs in init logic
}; };

View File

@ -716,7 +716,7 @@ static void uhci_stop(struct usb_hcd *hcd)
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int uhci_suspend(struct usb_hcd *hcd, u32 state) static int uhci_suspend(struct usb_hcd *hcd, pm_message_t message)
{ {
struct uhci_hcd *uhci = hcd_to_uhci(hcd); struct uhci_hcd *uhci = hcd_to_uhci(hcd);
@ -890,7 +890,6 @@ up_failed:
debugfs_remove(uhci_debugfs_root); debugfs_remove(uhci_debugfs_root);
debug_failed: debug_failed:
if (errbuf)
kfree(errbuf); kfree(errbuf);
errbuf_failed: errbuf_failed:
@ -906,8 +905,6 @@ static void __exit uhci_hcd_cleanup(void)
warn("not all urb_priv's were freed!"); warn("not all urb_priv's were freed!");
debugfs_remove(uhci_debugfs_root); debugfs_remove(uhci_debugfs_root);
if (errbuf)
kfree(errbuf); kfree(errbuf);
} }

View File

@ -2138,6 +2138,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
aiptek->inputdev.id.vendor = le16_to_cpu(usbdev->descriptor.idVendor); aiptek->inputdev.id.vendor = le16_to_cpu(usbdev->descriptor.idVendor);
aiptek->inputdev.id.product = le16_to_cpu(usbdev->descriptor.idProduct); aiptek->inputdev.id.product = le16_to_cpu(usbdev->descriptor.idProduct);
aiptek->inputdev.id.version = le16_to_cpu(usbdev->descriptor.bcdDevice); aiptek->inputdev.id.version = le16_to_cpu(usbdev->descriptor.bcdDevice);
aiptek->inputdev.dev = &intf->dev;
aiptek->usbdev = usbdev; aiptek->usbdev = usbdev;
aiptek->ifnum = intf->altsetting[0].desc.bInterfaceNumber; aiptek->ifnum = intf->altsetting[0].desc.bInterfaceNumber;

View File

@ -558,7 +558,6 @@ static void hid_free_device(struct hid_device *device)
} }
} }
if (device->rdesc)
kfree(device->rdesc); kfree(device->rdesc);
kfree(device); kfree(device);
} }
@ -1790,12 +1789,12 @@ static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id)
return 0; return 0;
} }
static int hid_suspend(struct usb_interface *intf, u32 state) static int hid_suspend(struct usb_interface *intf, pm_message_t message)
{ {
struct hid_device *hid = usb_get_intfdata (intf); struct hid_device *hid = usb_get_intfdata (intf);
usb_kill_urb(hid->urbin); usb_kill_urb(hid->urbin);
intf->dev.power.power_state = state; intf->dev.power.power_state = PMSG_SUSPEND;
dev_dbg(&intf->dev, "suspend\n"); dev_dbg(&intf->dev, "suspend\n");
return 0; return 0;
} }
@ -1805,7 +1804,7 @@ static int hid_resume(struct usb_interface *intf)
struct hid_device *hid = usb_get_intfdata (intf); struct hid_device *hid = usb_get_intfdata (intf);
int status; int status;
intf->dev.power.power_state = PM_SUSPEND_ON; intf->dev.power.power_state = PMSG_ON;
if (hid->open) if (hid->open)
status = usb_submit_urb(hid->urbin, GFP_NOIO); status = usb_submit_urb(hid->urbin, GFP_NOIO);
else else

View File

@ -138,7 +138,6 @@ static int dabusb_free_queue (struct list_head *q)
#ifdef DEBUG #ifdef DEBUG
dump_urb(b->purb); dump_urb(b->purb);
#endif #endif
if (b->purb->transfer_buffer)
kfree(b->purb->transfer_buffer); kfree(b->purb->transfer_buffer);
usb_free_urb(b->purb); usb_free_urb(b->purb);
tmp = p->next; tmp = p->next;

View File

@ -3915,11 +3915,9 @@ ov51x_do_dealloc(struct usb_ov511 *ov)
ov->tempfbuf = NULL; ov->tempfbuf = NULL;
for (i = 0; i < OV511_NUMSBUF; i++) { for (i = 0; i < OV511_NUMSBUF; i++) {
if (ov->sbuf[i].data) {
kfree(ov->sbuf[i].data); kfree(ov->sbuf[i].data);
ov->sbuf[i].data = NULL; ov->sbuf[i].data = NULL;
} }
}
for (i = 0; i < OV511_NUMFRAMES; i++) { for (i = 0; i < OV511_NUMFRAMES; i++) {
ov->frame[i].data = NULL; ov->frame[i].data = NULL;
@ -5954,10 +5952,8 @@ error:
up(&ov->cbuf_lock); up(&ov->cbuf_lock);
} }
if (ov) {
kfree(ov); kfree(ov);
ov = NULL; ov = NULL;
}
error_out: error_out:
err("Camera initialization failed"); err("Camera initialization failed");

View File

@ -868,13 +868,14 @@ static void usb_se401_remove_disconnected (struct usb_se401 *se401)
se401->dev = NULL; se401->dev = NULL;
for (i=0; i<SE401_NUMSBUF; i++) if (se401->urb[i]) { for (i=0; i<SE401_NUMSBUF; i++)
if (se401->urb[i]) {
usb_kill_urb(se401->urb[i]); usb_kill_urb(se401->urb[i]);
usb_free_urb(se401->urb[i]); usb_free_urb(se401->urb[i]);
se401->urb[i] = NULL; se401->urb[i] = NULL;
kfree(se401->sbuf[i].data); kfree(se401->sbuf[i].data);
} }
for (i=0; i<SE401_NUMSCRATCH; i++) if (se401->scratch[i].data) { for (i=0; i<SE401_NUMSCRATCH; i++) {
kfree(se401->scratch[i].data); kfree(se401->scratch[i].data);
} }
if (se401->inturb) { if (se401->inturb) {

View File

@ -1169,13 +1169,11 @@ static int usbvideo_v4l_open(struct inode *inode, struct file *file)
} }
RingQueue_Free(&uvd->dp); RingQueue_Free(&uvd->dp);
for (i=0; i < USBVIDEO_NUMSBUF; i++) { for (i=0; i < USBVIDEO_NUMSBUF; i++) {
if (uvd->sbuf[i].data != NULL) {
kfree(uvd->sbuf[i].data); kfree(uvd->sbuf[i].data);
uvd->sbuf[i].data = NULL; uvd->sbuf[i].data = NULL;
} }
} }
} }
}
/* If so far no errors then we shall start the camera */ /* If so far no errors then we shall start the camera */
if (errCode == 0) { if (errCode == 0) {

View File

@ -3624,9 +3624,7 @@ w9968cf_usb_probe(struct usb_interface* intf, const struct usb_device_id* id)
return 0; return 0;
fail: /* Free unused memory */ fail: /* Free unused memory */
if (cam->control_buffer)
kfree(cam->control_buffer); kfree(cam->control_buffer);
if (cam->data_buffer)
kfree(cam->data_buffer); kfree(cam->data_buffer);
if (cam->v4ldev) if (cam->v4ldev)
video_device_release(cam->v4ldev); video_device_release(cam->v4ldev);

View File

@ -705,12 +705,8 @@ static int auerchain_control_msg (pauerchain_t acp, struct usb_device *dev, unsi
/* free a single auerbuf */ /* free a single auerbuf */
static void auerbuf_free (pauerbuf_t bp) static void auerbuf_free (pauerbuf_t bp)
{ {
if (bp->bufp) {
kfree(bp->bufp); kfree(bp->bufp);
}
if (bp->dr) {
kfree(bp->dr); kfree(bp->dr);
}
if (bp->urbp) { if (bp->urbp) {
usb_free_urb(bp->urbp); usb_free_urb(bp->urbp);
} }
@ -1097,11 +1093,9 @@ static void auerswald_int_free (pauerswald_t cp)
usb_free_urb(cp->inturbp); usb_free_urb(cp->inturbp);
cp->inturbp = NULL; cp->inturbp = NULL;
} }
if (cp->intbufp) {
kfree(cp->intbufp); kfree(cp->intbufp);
cp->intbufp = NULL; cp->intbufp = NULL;
} }
}
/* This function is called to activate the interrupt /* This function is called to activate the interrupt
endpoint. This function returns 0 if successful or an error code. endpoint. This function returns 0 if successful or an error code.

View File

@ -3104,6 +3104,7 @@ static void sisusb_disconnect(struct usb_interface *intf)
static struct usb_device_id sisusb_table [] = { static struct usb_device_id sisusb_table [] = {
{ USB_DEVICE(0x0711, 0x0900) }, { USB_DEVICE(0x0711, 0x0900) },
{ USB_DEVICE(0x182d, 0x021c) },
{ } { }
}; };
@ -3114,7 +3115,7 @@ static struct usb_driver sisusb_driver = {
.name = "sisusb", .name = "sisusb",
.probe = sisusb_probe, .probe = sisusb_probe,
.disconnect = sisusb_disconnect, .disconnect = sisusb_disconnect,
.id_table = sisusb_table .id_table = sisusb_table,
}; };
static int __init usb_sisusb_init(void) static int __init usb_sisusb_init(void)

View File

@ -1364,11 +1364,18 @@ static void pegasus_disconnect(struct usb_interface *intf)
free_netdev(pegasus->net); free_netdev(pegasus->net);
} }
static int pegasus_suspend (struct usb_interface *intf, pm_message_t state) static int pegasus_suspend (struct usb_interface *intf, pm_message_t message)
{ {
struct pegasus *pegasus = usb_get_intfdata(intf); struct pegasus *pegasus = usb_get_intfdata(intf);
netif_device_detach (pegasus->net); netif_device_detach (pegasus->net);
if (netif_running(pegasus->net)) {
cancel_delayed_work(&pegasus->carrier_check);
usb_kill_urb(pegasus->rx_urb);
usb_kill_urb(pegasus->intr_urb);
}
intf->dev.power.power_state = PMSG_SUSPEND;
return 0; return 0;
} }
@ -1376,7 +1383,20 @@ static int pegasus_resume (struct usb_interface *intf)
{ {
struct pegasus *pegasus = usb_get_intfdata(intf); struct pegasus *pegasus = usb_get_intfdata(intf);
intf->dev.power.power_state = PMSG_ON;
netif_device_attach (pegasus->net); netif_device_attach (pegasus->net);
if (netif_running(pegasus->net)) {
pegasus->rx_urb->status = 0;
pegasus->rx_urb->actual_length = 0;
read_bulk_callback(pegasus->rx_urb, 0);
pegasus->intr_urb->status = 0;
pegasus->intr_urb->actual_length = 0;
intr_callback(pegasus->intr_urb, 0);
queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check,
CARRIER_CHECK_DELAY);
}
return 0; return 0;
} }

View File

@ -426,7 +426,7 @@ static void skb_return (struct usbnet *dev, struct sk_buff *skb)
dev->stats.rx_bytes += skb->len; dev->stats.rx_bytes += skb->len;
if (netif_msg_rx_status (dev)) if (netif_msg_rx_status (dev))
devdbg (dev, "< rx, len %d, type 0x%x", devdbg (dev, "< rx, len %zd, type 0x%x",
skb->len + sizeof (struct ethhdr), skb->protocol); skb->len + sizeof (struct ethhdr), skb->protocol);
memset (skb->cb, 0, sizeof (struct skb_data)); memset (skb->cb, 0, sizeof (struct skb_data));
status = netif_rx (skb); status = netif_rx (skb);
@ -3732,11 +3732,17 @@ out:
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int usbnet_suspend (struct usb_interface *intf, u32 state) static int usbnet_suspend (struct usb_interface *intf, pm_message_t message)
{ {
struct usbnet *dev = usb_get_intfdata(intf); struct usbnet *dev = usb_get_intfdata(intf);
/* accelerate emptying of the rx and queues, to avoid
* having everything error out.
*/
netif_device_detach (dev->net); netif_device_detach (dev->net);
(void) unlink_urbs (dev, &dev->rxq);
(void) unlink_urbs (dev, &dev->txq);
intf->dev.power.power_state = PMSG_SUSPEND;
return 0; return 0;
} }
@ -3744,7 +3750,9 @@ static int usbnet_resume (struct usb_interface *intf)
{ {
struct usbnet *dev = usb_get_intfdata(intf); struct usbnet *dev = usb_get_intfdata(intf);
intf->dev.power.power_state = PMSG_ON;
netif_device_attach (dev->net); netif_device_attach (dev->net);
tasklet_schedule (&dev->bh);
return 0; return 0;
} }
@ -4009,10 +4017,23 @@ static const struct usb_device_id products [] = {
.idProduct = 0x9050, /* C-860 */ .idProduct = 0x9050, /* C-860 */
ZAURUS_MASTER_INTERFACE, ZAURUS_MASTER_INTERFACE,
.driver_info = ZAURUS_PXA_INFO, .driver_info = ZAURUS_PXA_INFO,
},
#ifdef CONFIG_USB_ZAURUS #ifdef CONFIG_USB_ZAURUS
/* at least some (reports vary) C-860 units have very different /* at least some (reports vary) PXA units have very different
* lies about their standards support. * lies about their standards support: they claim to be cell
* phones giving direct radio access (which they aren't).
*/ */
{
.match_flags = USB_DEVICE_ID_MATCH_INT_INFO
| USB_DEVICE_ID_MATCH_DEVICE,
.idVendor = 0x04DD,
/* Sharp ROM v1.32 */
.idProduct = 0x8006, /* SL-5600 */
.bInterfaceClass = USB_CLASS_COMM,
.bInterfaceSubClass = USB_CDC_SUBCLASS_MDLM,
.bInterfaceProtocol = USB_CDC_PROTO_NONE,
.driver_info = (unsigned long) &zaurus_pxa_mdlm_info,
}, { }, {
.match_flags = USB_DEVICE_ID_MATCH_INT_INFO .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
| USB_DEVICE_ID_MATCH_DEVICE, | USB_DEVICE_ID_MATCH_DEVICE,
@ -4023,8 +4044,8 @@ static const struct usb_device_id products [] = {
.bInterfaceSubClass = USB_CDC_SUBCLASS_MDLM, .bInterfaceSubClass = USB_CDC_SUBCLASS_MDLM,
.bInterfaceProtocol = USB_CDC_PROTO_NONE, .bInterfaceProtocol = USB_CDC_PROTO_NONE,
.driver_info = (unsigned long) &zaurus_pxa_mdlm_info, .driver_info = (unsigned long) &zaurus_pxa_mdlm_info,
#endif
}, },
#endif
/* Olympus has some models with a Zaurus-compatible option. /* Olympus has some models with a Zaurus-compatible option.
* R-1000 uses a FreeScale i.MXL cpu (ARMv4T) * R-1000 uses a FreeScale i.MXL cpu (ARMv4T)

View File

@ -106,7 +106,6 @@ int zd1201_fw_upload(struct usb_device *dev, int apfw)
err = 0; err = 0;
exit: exit:
if (buf)
kfree(buf); kfree(buf);
release_firmware(fw_entry); release_firmware(fw_entry);
return err; return err;

View File

@ -202,7 +202,6 @@ static void belkin_sa_shutdown (struct usb_serial *serial)
for (i=0; i < serial->num_ports; ++i) { for (i=0; i < serial->num_ports; ++i) {
/* My special items, the standard routines free my urbs */ /* My special items, the standard routines free my urbs */
priv = usb_get_serial_port_data(serial->port[i]); priv = usb_get_serial_port_data(serial->port[i]);
if (priv)
kfree(priv); kfree(priv);
} }
} }

View File

@ -1340,8 +1340,7 @@ static struct cypress_buf *cypress_buf_alloc(unsigned int size)
static void cypress_buf_free(struct cypress_buf *cb) static void cypress_buf_free(struct cypress_buf *cb)
{ {
if (cb != NULL) { if (cb) {
if (cb->buf_buf != NULL)
kfree(cb->buf_buf); kfree(cb->buf_buf);
kfree(cb); kfree(cb);
} }

View File

@ -568,6 +568,9 @@ static struct usb_serial_device_type digi_acceleport_4_device = {
* and the sleep. In other words, spin_unlock_irqrestore and * and the sleep. In other words, spin_unlock_irqrestore and
* interruptible_sleep_on_timeout are "atomic" with respect to * interruptible_sleep_on_timeout are "atomic" with respect to
* wake ups. This is used to implement condition variables. * wake ups. This is used to implement condition variables.
*
* interruptible_sleep_on_timeout is deprecated and has been replaced
* with the equivalent code.
*/ */
static inline long cond_wait_interruptible_timeout_irqrestore( static inline long cond_wait_interruptible_timeout_irqrestore(
@ -576,13 +579,12 @@ static inline long cond_wait_interruptible_timeout_irqrestore(
{ {
DEFINE_WAIT(wait); DEFINE_WAIT(wait);
prepare_to_wait(q, &wait, TASK_UNINTERRUPTIBLE); prepare_to_wait(q, &wait, TASK_INTERRUPTIBLE);
spin_unlock_irqrestore(lock, flags); spin_unlock_irqrestore(lock, flags);
timeout = schedule_timeout(timeout); timeout = schedule_timeout(timeout);
finish_wait(q, &wait); finish_wait(q, &wait);
return timeout; return timeout;
} }
@ -1596,7 +1598,7 @@ dbg( "digi_close: TOP: port=%d, open_count=%d", priv->dp_port_num, port->open_co
dbg( "digi_close: write oob failed, ret=%d", ret ); dbg( "digi_close: write oob failed, ret=%d", ret );
/* wait for final commands on oob port to complete */ /* wait for final commands on oob port to complete */
prepare_to_wait(&priv->dp_flush_wait, &wait, TASK_UNINTERRUPTIBLE); prepare_to_wait(&priv->dp_flush_wait, &wait, TASK_INTERRUPTIBLE);
schedule_timeout(DIGI_CLOSE_TIMEOUT); schedule_timeout(DIGI_CLOSE_TIMEOUT);
finish_wait(&priv->dp_flush_wait, &wait); finish_wait(&priv->dp_flush_wait, &wait);
@ -1995,7 +1997,7 @@ opcode, line, status, val );
} else if( opcode == DIGI_CMD_IFLUSH_FIFO ) { } else if( opcode == DIGI_CMD_IFLUSH_FIFO ) {
wake_up( &priv->dp_flush_wait ); wake_up_interruptible( &priv->dp_flush_wait );
} }

View File

@ -550,7 +550,6 @@ failed_usb_register:
failed_usb_serial_register: failed_usb_serial_register:
for (i = 0; i < NUM_URBS; ++i) { for (i = 0; i < NUM_URBS; ++i) {
if (write_urb_pool[i]) { if (write_urb_pool[i]) {
if (write_urb_pool[i]->transfer_buffer)
kfree(write_urb_pool[i]->transfer_buffer); kfree(write_urb_pool[i]->transfer_buffer);
usb_free_urb(write_urb_pool[i]); usb_free_urb(write_urb_pool[i]);
} }
@ -575,7 +574,6 @@ static void __exit empeg_exit (void)
* the host controllers get fixed to set urb->dev = NULL after * the host controllers get fixed to set urb->dev = NULL after
* the urb is finished. Otherwise this call oopses. */ * the urb is finished. Otherwise this call oopses. */
/* usb_kill_urb(write_urb_pool[i]); */ /* usb_kill_urb(write_urb_pool[i]); */
if (write_urb_pool[i]->transfer_buffer)
kfree(write_urb_pool[i]->transfer_buffer); kfree(write_urb_pool[i]->transfer_buffer);
usb_free_urb (write_urb_pool[i]); usb_free_urb (write_urb_pool[i]);
} }

View File

@ -1347,9 +1347,7 @@ static int ftdi_common_startup (struct usb_serial *serial)
priv->flags = ASYNC_LOW_LATENCY; priv->flags = ASYNC_LOW_LATENCY;
/* Increase the size of read buffers */ /* Increase the size of read buffers */
if (port->bulk_in_buffer) {
kfree(port->bulk_in_buffer); kfree(port->bulk_in_buffer);
}
port->bulk_in_buffer = kmalloc (BUFSZ, GFP_KERNEL); port->bulk_in_buffer = kmalloc (BUFSZ, GFP_KERNEL);
if (!port->bulk_in_buffer) { if (!port->bulk_in_buffer) {
kfree (priv); kfree (priv);
@ -1365,10 +1363,8 @@ static int ftdi_common_startup (struct usb_serial *serial)
usb_free_urb (port->write_urb); usb_free_urb (port->write_urb);
port->write_urb = NULL; port->write_urb = NULL;
} }
if (port->bulk_out_buffer) {
kfree(port->bulk_out_buffer); kfree(port->bulk_out_buffer);
port->bulk_out_buffer = NULL; port->bulk_out_buffer = NULL;
}
usb_set_serial_port_data(serial->port[0], priv); usb_set_serial_port_data(serial->port[0], priv);

View File

@ -951,9 +951,7 @@ static void edge_bulk_out_cmd_callback (struct urb *urb, struct pt_regs *regs)
/* clean up the transfer buffer */ /* clean up the transfer buffer */
if (urb->transfer_buffer != NULL) {
kfree(urb->transfer_buffer); kfree(urb->transfer_buffer);
}
/* Free the command urb */ /* Free the command urb */
usb_free_urb (urb); usb_free_urb (urb);
@ -1266,16 +1264,12 @@ static void edge_close (struct usb_serial_port *port, struct file * filp)
if (edge_port->write_urb) { if (edge_port->write_urb) {
/* if this urb had a transfer buffer already (old transfer) free it */ /* if this urb had a transfer buffer already (old transfer) free it */
if (edge_port->write_urb->transfer_buffer != NULL) {
kfree(edge_port->write_urb->transfer_buffer); kfree(edge_port->write_urb->transfer_buffer);
}
usb_free_urb(edge_port->write_urb); usb_free_urb(edge_port->write_urb);
edge_port->write_urb = NULL; edge_port->write_urb = NULL;
} }
if (edge_port->txfifo.fifo) {
kfree(edge_port->txfifo.fifo); kfree(edge_port->txfifo.fifo);
edge_port->txfifo.fifo = NULL; edge_port->txfifo.fifo = NULL;
}
dbg("%s exited", __FUNCTION__); dbg("%s exited", __FUNCTION__);
} }
@ -1419,11 +1413,9 @@ static void send_more_port_data(struct edgeport_serial *edge_serial, struct edge
// get a pointer to the write_urb // get a pointer to the write_urb
urb = edge_port->write_urb; urb = edge_port->write_urb;
/* if this urb had a transfer buffer already (old transfer) free it */ /* make sure transfer buffer is freed */
if (urb->transfer_buffer != NULL) {
kfree(urb->transfer_buffer); kfree(urb->transfer_buffer);
urb->transfer_buffer = NULL; urb->transfer_buffer = NULL;
}
/* build the data header for the buffer and port that we are about to send out */ /* build the data header for the buffer and port that we are about to send out */
count = fifo->count; count = fifo->count;

View File

@ -2845,8 +2845,7 @@ static struct edge_buf *edge_buf_alloc(unsigned int size)
void edge_buf_free(struct edge_buf *eb) void edge_buf_free(struct edge_buf *eb)
{ {
if (eb != NULL) { if (eb) {
if (eb->buf_buf != NULL)
kfree(eb->buf_buf); kfree(eb->buf_buf);
kfree(eb); kfree(eb);
} }

View File

@ -341,7 +341,6 @@ static void klsi_105_shutdown (struct usb_serial *serial)
* finished. Otherwise this call * finished. Otherwise this call
* oopses. */ * oopses. */
/* usb_kill_urb(write_urbs[j]); */ /* usb_kill_urb(write_urbs[j]); */
if (write_urbs[j]->transfer_buffer)
kfree(write_urbs[j]->transfer_buffer); kfree(write_urbs[j]->transfer_buffer);
usb_free_urb (write_urbs[j]); usb_free_urb (write_urbs[j]);
} }

View File

@ -178,7 +178,6 @@ static void omninet_close (struct usb_serial_port *port, struct file * filp)
{ {
struct usb_serial *serial = port->serial; struct usb_serial *serial = port->serial;
struct usb_serial_port *wport; struct usb_serial_port *wport;
struct omninet_data *od;
dbg("%s - port %d", __FUNCTION__, port->number); dbg("%s - port %d", __FUNCTION__, port->number);
@ -186,9 +185,7 @@ static void omninet_close (struct usb_serial_port *port, struct file * filp)
usb_kill_urb(wport->write_urb); usb_kill_urb(wport->write_urb);
usb_kill_urb(port->read_urb); usb_kill_urb(port->read_urb);
od = usb_get_serial_port_data(port); kfree(usb_get_serial_port_data(port));
if (od)
kfree(od);
} }

View File

@ -94,6 +94,7 @@ static struct usb_device_id id_table [] = {
{ USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_ID) }, { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_ID) },
{ USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_ID) }, { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_ID) },
{ USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X65) }, { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X65) },
{ USB_DEVICE(SYNTECH_VENDOR_ID, SYNTECH_PRODUCT_ID) },
{ } /* Terminating entry */ { } /* Terminating entry */
}; };
@ -677,6 +678,9 @@ static int pl2303_tiocmset (struct usb_serial_port *port, struct file *file,
unsigned long flags; unsigned long flags;
u8 control; u8 control;
if (!usb_get_intfdata(port->serial->interface))
return -ENODEV;
spin_lock_irqsave (&priv->lock, flags); spin_lock_irqsave (&priv->lock, flags);
if (set & TIOCM_RTS) if (set & TIOCM_RTS)
priv->line_control |= CONTROL_RTS; priv->line_control |= CONTROL_RTS;
@ -702,6 +706,9 @@ static int pl2303_tiocmget (struct usb_serial_port *port, struct file *file)
dbg("%s (%d)", __FUNCTION__, port->number); dbg("%s (%d)", __FUNCTION__, port->number);
if (!usb_get_intfdata(port->serial->interface))
return -ENODEV;
spin_lock_irqsave (&priv->lock, flags); spin_lock_irqsave (&priv->lock, flags);
mcr = priv->line_control; mcr = priv->line_control;
status = priv->line_status; status = priv->line_status;
@ -811,15 +818,40 @@ static void pl2303_shutdown (struct usb_serial *serial)
} }
} }
static void pl2303_update_line_status(struct usb_serial_port *port,
unsigned char *data,
unsigned int actual_length)
{
struct pl2303_private *priv = usb_get_serial_port_data(port);
unsigned long flags;
u8 status_idx = UART_STATE;
u8 length = UART_STATE;
if ((le16_to_cpu(port->serial->dev->descriptor.idVendor) == SIEMENS_VENDOR_ID) &&
(le16_to_cpu(port->serial->dev->descriptor.idProduct) == SIEMENS_PRODUCT_ID_X65)) {
length = 1;
status_idx = 0;
}
if (actual_length < length)
goto exit;
/* Save off the uart status for others to look at */
spin_lock_irqsave(&priv->lock, flags);
priv->line_status = data[status_idx];
spin_unlock_irqrestore(&priv->lock, flags);
exit:
return;
}
static void pl2303_read_int_callback (struct urb *urb, struct pt_regs *regs) static void pl2303_read_int_callback (struct urb *urb, struct pt_regs *regs)
{ {
struct usb_serial_port *port = (struct usb_serial_port *) urb->context; struct usb_serial_port *port = (struct usb_serial_port *) urb->context;
struct pl2303_private *priv = usb_get_serial_port_data(port);
unsigned char *data = urb->transfer_buffer; unsigned char *data = urb->transfer_buffer;
unsigned long flags; unsigned int actual_length = urb->actual_length;
int status; int status;
u8 uart_state;
dbg("%s (%d)", __FUNCTION__, port->number); dbg("%s (%d)", __FUNCTION__, port->number);
@ -838,18 +870,8 @@ static void pl2303_read_int_callback (struct urb *urb, struct pt_regs *regs)
goto exit; goto exit;
} }
usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, urb->transfer_buffer); usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, urb->transfer_buffer);
pl2303_update_line_status(port, data, actual_length);
if (urb->actual_length < UART_STATE)
goto exit;
/* Save off the uart status for others to look at */
uart_state = data[UART_STATE];
spin_lock_irqsave(&priv->lock, flags);
uart_state |= (priv->line_status & UART_STATE_TRANSIENT_MASK);
priv->line_status = uart_state;
spin_unlock_irqrestore(&priv->lock, flags);
exit: exit:
status = usb_submit_urb (urb, GFP_ATOMIC); status = usb_submit_urb (urb, GFP_ATOMIC);
@ -1022,8 +1044,7 @@ static struct pl2303_buf *pl2303_buf_alloc(unsigned int size)
static void pl2303_buf_free(struct pl2303_buf *pb) static void pl2303_buf_free(struct pl2303_buf *pb)
{ {
if (pb != NULL) { if (pb) {
if (pb->buf_buf != NULL)
kfree(pb->buf_buf); kfree(pb->buf_buf);
kfree(pb); kfree(pb);
} }

View File

@ -55,3 +55,6 @@
#define SIEMENS_VENDOR_ID 0x11f5 #define SIEMENS_VENDOR_ID 0x11f5
#define SIEMENS_PRODUCT_ID_X65 0x0003 #define SIEMENS_PRODUCT_ID_X65 0x0003
#define SYNTECH_VENDOR_ID 0x0745
#define SYNTECH_PRODUCT_ID 0x0001

View File

@ -517,7 +517,6 @@ static void ti_shutdown(struct usb_serial *serial)
} }
} }
if (tdev)
kfree(tdev); kfree(tdev);
usb_set_serial_data(serial, NULL); usb_set_serial_data(serial, NULL);
} }

View File

@ -215,6 +215,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_TUNGSTEN_T_ID), { USB_DEVICE(PALM_VENDOR_ID, PALM_TUNGSTEN_T_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_TREO_650),
.driver_info = (kernel_ulong_t)&palm_os_4_probe },
{ USB_DEVICE(PALM_VENDOR_ID, PALM_TUNGSTEN_Z_ID), { USB_DEVICE(PALM_VENDOR_ID, PALM_TUNGSTEN_Z_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_ZIRE31_ID), { USB_DEVICE(PALM_VENDOR_ID, PALM_ZIRE31_ID),
@ -237,6 +239,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(SAMSUNG_VENDOR_ID, SAMSUNG_SPH_I500_ID), { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SPH_I500_ID),
.driver_info = (kernel_ulong_t)&palm_os_4_probe }, .driver_info = (kernel_ulong_t)&palm_os_4_probe },
{ USB_DEVICE(TAPWAVE_VENDOR_ID, TAPWAVE_ZODIAC_ID),
.driver_info = (kernel_ulong_t)&palm_os_4_probe },
{ USB_DEVICE(GARMIN_VENDOR_ID, GARMIN_IQUE_3600_ID), { USB_DEVICE(GARMIN_VENDOR_ID, GARMIN_IQUE_3600_ID),
.driver_info = (kernel_ulong_t)&palm_os_4_probe }, .driver_info = (kernel_ulong_t)&palm_os_4_probe },
{ USB_DEVICE(ACEECA_VENDOR_ID, ACEECA_MEZ1000_ID), { USB_DEVICE(ACEECA_VENDOR_ID, ACEECA_MEZ1000_ID),
@ -273,6 +277,7 @@ static struct usb_device_id id_table_combined [] = {
{ 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) },
{ USB_DEVICE(PALM_VENDOR_ID, PALM_TREO_650) },
{ USB_DEVICE(PALM_VENDOR_ID, PALM_TUNGSTEN_Z_ID) }, { USB_DEVICE(PALM_VENDOR_ID, PALM_TUNGSTEN_Z_ID) },
{ USB_DEVICE(PALM_VENDOR_ID, PALM_ZIRE31_ID) }, { USB_DEVICE(PALM_VENDOR_ID, PALM_ZIRE31_ID) },
{ USB_DEVICE(PALM_VENDOR_ID, PALM_ZIRE_ID) }, { USB_DEVICE(PALM_VENDOR_ID, PALM_ZIRE_ID) },
@ -286,6 +291,7 @@ static struct usb_device_id id_table_combined [] = {
{ USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_TJ25_ID) }, { USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_TJ25_ID) },
{ USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SCH_I330_ID) }, { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SCH_I330_ID) },
{ USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SPH_I500_ID) }, { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SPH_I500_ID) },
{ USB_DEVICE(TAPWAVE_VENDOR_ID, TAPWAVE_ZODIAC_ID) },
{ USB_DEVICE(GARMIN_VENDOR_ID, GARMIN_IQUE_3600_ID) }, { USB_DEVICE(GARMIN_VENDOR_ID, GARMIN_IQUE_3600_ID) },
{ USB_DEVICE(ACEECA_VENDOR_ID, ACEECA_MEZ1000_ID) }, { USB_DEVICE(ACEECA_VENDOR_ID, ACEECA_MEZ1000_ID) },
{ USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_7135_ID) }, { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_7135_ID) },

View File

@ -30,6 +30,7 @@
#define PALM_M125_ID 0x0040 #define PALM_M125_ID 0x0040
#define PALM_M130_ID 0x0050 #define PALM_M130_ID 0x0050
#define PALM_TUNGSTEN_T_ID 0x0060 #define PALM_TUNGSTEN_T_ID 0x0060
#define PALM_TREO_650 0x0061
#define PALM_TUNGSTEN_Z_ID 0x0031 #define PALM_TUNGSTEN_Z_ID 0x0031
#define PALM_ZIRE31_ID 0x0061 #define PALM_ZIRE31_ID 0x0061
#define PALM_ZIRE_ID 0x0070 #define PALM_ZIRE_ID 0x0070
@ -49,6 +50,9 @@
#define SAMSUNG_SCH_I330_ID 0x8001 #define SAMSUNG_SCH_I330_ID 0x8001
#define SAMSUNG_SPH_I500_ID 0x6601 #define SAMSUNG_SPH_I500_ID 0x6601
#define TAPWAVE_VENDOR_ID 0x12EF
#define TAPWAVE_ZODIAC_ID 0x0100
#define GARMIN_VENDOR_ID 0x091E #define GARMIN_VENDOR_ID 0x091E
#define GARMIN_IQUE_3600_ID 0x0004 #define GARMIN_IQUE_3600_ID 0x0004

View File

@ -119,9 +119,7 @@ static int sddr55_status(struct us_data *us)
/* expect to get short transfer if no card fitted */ /* expect to get short transfer if no card fitted */
if (result == USB_STOR_XFER_SHORT || result == USB_STOR_XFER_STALLED) { if (result == USB_STOR_XFER_SHORT || result == USB_STOR_XFER_STALLED) {
/* had a short transfer, no card inserted, free map memory */ /* had a short transfer, no card inserted, free map memory */
if (info->lba_to_pba)
kfree(info->lba_to_pba); kfree(info->lba_to_pba);
if (info->pba_to_lba)
kfree(info->pba_to_lba); kfree(info->pba_to_lba);
info->lba_to_pba = NULL; info->lba_to_pba = NULL;
info->pba_to_lba = NULL; info->pba_to_lba = NULL;
@ -649,17 +647,13 @@ static int sddr55_read_map(struct us_data *us) {
return -1; return -1;
} }
if (info->lba_to_pba)
kfree(info->lba_to_pba); kfree(info->lba_to_pba);
if (info->pba_to_lba)
kfree(info->pba_to_lba); kfree(info->pba_to_lba);
info->lba_to_pba = kmalloc(numblocks*sizeof(int), GFP_NOIO); info->lba_to_pba = kmalloc(numblocks*sizeof(int), GFP_NOIO);
info->pba_to_lba = kmalloc(numblocks*sizeof(int), GFP_NOIO); info->pba_to_lba = kmalloc(numblocks*sizeof(int), GFP_NOIO);
if (info->lba_to_pba == NULL || info->pba_to_lba == NULL) { if (info->lba_to_pba == NULL || info->pba_to_lba == NULL) {
if (info->lba_to_pba != NULL)
kfree(info->lba_to_pba); kfree(info->lba_to_pba);
if (info->pba_to_lba != NULL)
kfree(info->pba_to_lba); kfree(info->pba_to_lba);
info->lba_to_pba = NULL; info->lba_to_pba = NULL;
info->pba_to_lba = NULL; info->pba_to_lba = NULL;
@ -728,9 +722,7 @@ static void sddr55_card_info_destructor(void *extra) {
if (!extra) if (!extra)
return; return;
if (info->lba_to_pba)
kfree(info->lba_to_pba); kfree(info->lba_to_pba);
if (info->pba_to_lba)
kfree(info->pba_to_lba); kfree(info->pba_to_lba);
} }

View File

@ -996,7 +996,7 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us)
* command phase and the data phase. Some devices need a little * command phase and the data phase. Some devices need a little
* more than that, probably because of clock rate inaccuracies. */ * more than that, probably because of clock rate inaccuracies. */
if (unlikely(us->flags & US_FL_GO_SLOW)) if (unlikely(us->flags & US_FL_GO_SLOW))
udelay(110); udelay(125);
if (transfer_length) { if (transfer_length) {
unsigned int pipe = srb->sc_data_direction == DMA_FROM_DEVICE ? unsigned int pipe = srb->sc_data_direction == DMA_FROM_DEVICE ?

View File

@ -763,6 +763,19 @@ UNUSUAL_DEV( 0x07c4, 0xa109, 0x0000, 0xffff,
US_FL_SINGLE_LUN ), US_FL_SINGLE_LUN ),
#endif #endif
#ifdef CONFIG_USB_STORAGE_DATAFAB
/* Reported by Felix Moeller <felix@derklecks.de>
* in Germany this is sold by Hama with the productnumber 46952
* as "DualSlot CompactFlash(TM) & MStick Drive USB"
*/
UNUSUAL_DEV( 0x07c4, 0xa10b, 0x0000, 0xffff,
"DataFab Systems Inc.",
"USB CF+MS",
US_SC_SCSI, US_PR_DATAFAB, NULL,
0 ),
#endif
/* Datafab KECF-USB / Sagatek DCS-CF / Simpletech Flashlink UCF-100 /* Datafab KECF-USB / Sagatek DCS-CF / Simpletech Flashlink UCF-100
* Only revision 1.13 tested (same for all of the above devices, * Only revision 1.13 tested (same for all of the above devices,
* based on the Datafab DF-UG-07 chip). Needed for US_FL_FIX_INQUIRY. * based on the Datafab DF-UG-07 chip). Needed for US_FL_FIX_INQUIRY.

View File

@ -558,7 +558,7 @@ struct usb_driver {
int (*ioctl) (struct usb_interface *intf, unsigned int code, void *buf); int (*ioctl) (struct usb_interface *intf, unsigned int code, void *buf);
int (*suspend) (struct usb_interface *intf, u32 state); int (*suspend) (struct usb_interface *intf, pm_message_t message);
int (*resume) (struct usb_interface *intf); int (*resume) (struct usb_interface *intf);
const struct usb_device_id *id_table; const struct usb_device_id *id_table;
@ -977,7 +977,7 @@ extern int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe,
int timeout); int timeout);
/* selective suspend/resume */ /* selective suspend/resume */
extern int usb_suspend_device(struct usb_device *dev, u32 state); extern int usb_suspend_device(struct usb_device *dev, pm_message_t message);
extern int usb_resume_device(struct usb_device *dev); extern int usb_resume_device(struct usb_device *dev);

View File

@ -114,7 +114,7 @@ struct usb_cdc_mdlm_detail_desc {
/* type is associated with mdlm_desc.bGUID */ /* type is associated with mdlm_desc.bGUID */
__u8 bGuidDescriptorType; __u8 bGuidDescriptorType;
__u8 bDetailData[]; __u8 bDetailData[0];
} __attribute__ ((packed)); } __attribute__ ((packed));
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/