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
/* Power management suspend, so power off the transmitter/receiver */
static int stir_suspend(struct usb_interface *intf, u32 state)
/* USB suspend, so power off the transmitter/receiver */
static int stir_suspend(struct usb_interface *intf, pm_message_t message)
{
struct stir_cb *stir = usb_get_intfdata(intf);

View File

@ -649,14 +649,10 @@ static void usbin_stop(struct usb_audiodev *as)
}
}
set_current_state(TASK_RUNNING);
if (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);
if (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->durb[0].urb->transfer_buffer);
kfree(u->durb[1].urb->transfer_buffer);
kfree(u->surb[0].urb->transfer_buffer);
kfree(u->surb[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;
}
@ -1009,21 +1005,17 @@ static int usbin_start(struct usb_audiodev *as)
u->phase = 0;
maxsze = (u->freqmax + 0x3fff) >> (14 - AFMT_BYTESSHIFT(u->format));
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_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_length = bufsz;
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_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_length = 3*SYNCFRAMES;
}
@ -1128,14 +1120,10 @@ static void usbout_stop(struct usb_audiodev *as)
}
}
set_current_state(TASK_RUNNING);
if (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);
if (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->durb[0].urb->transfer_buffer);
kfree(u->durb[1].urb->transfer_buffer);
kfree(u->surb[0].urb->transfer_buffer);
kfree(u->surb[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;
}
@ -1376,21 +1364,17 @@ static int usbout_start(struct usb_audiodev *as)
u->phase = 0;
maxsze = (u->freqmax + 0x3fff) >> (14 - AFMT_BYTESSHIFT(u->format));
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_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_length = bufsz;
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_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_length = 3*SYNCFRAMES;
}

View File

@ -309,7 +309,7 @@ static int bluetooth_ctrl_msg (struct usb_bluetooth *bluetooth, int request, int
}
}
if (urb->transfer_buffer_length < len) {
kfree (urb->transfer_buffer);
kfree(urb->transfer_buffer);
urb->transfer_buffer = kmalloc (len, GFP_KERNEL);
if (urb->transfer_buffer == NULL) {
err ("%s - out of memory", __FUNCTION__);
@ -535,7 +535,7 @@ static int bluetooth_write (struct tty_struct * tty, const unsigned char *buf, i
}
exit:
kfree (temp_buffer);
kfree(temp_buffer);
return retval;
}

View File

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

View File

@ -59,6 +59,7 @@
#include <linux/usbdevice_fs.h>
#include <asm/uaccess.h>
#include "usb.h"
#include "hcd.h"
#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)
{
if (file->private_data) {
kfree(file->private_data);
file->private_data = NULL;
}
kfree(file->private_data);
file->private_data = NULL;
return 0;
}

View File

@ -213,12 +213,10 @@ static struct async *alloc_async(unsigned int numisoframes)
static void free_async(struct async *as)
{
if (as->urb->transfer_buffer)
kfree(as->urb->transfer_buffer);
if (as->urb->setup_packet)
kfree(as->urb->setup_packet);
kfree(as->urb->transfer_buffer);
kfree(as->urb->setup_packet);
usb_free_urb(as->urb);
kfree(as);
kfree(as);
}
static inline void async_newpending(struct async *as)
@ -938,17 +936,13 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
return -EINVAL;
}
if (!(as = alloc_async(uurb->number_of_packets))) {
if (isopkt)
kfree(isopkt);
if (dr)
kfree(dr);
kfree(isopkt);
kfree(dr);
return -ENOMEM;
}
if (!(as->urb->transfer_buffer = kmalloc(uurb->buffer_length, GFP_KERNEL))) {
if (isopkt)
kfree(isopkt);
if (dr)
kfree(dr);
kfree(isopkt);
kfree(dr);
free_async(as);
return -ENOMEM;
}
@ -967,8 +961,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
as->urb->iso_frame_desc[u].length = isopkt[u].length;
totlen += isopkt[u].length;
}
if (isopkt)
kfree(isopkt);
kfree(isopkt);
as->ps = ps;
as->userurb = arg;
if (uurb->endpoint & USB_DIR_IN)
@ -1032,15 +1025,15 @@ static int processcompl(struct async *as, void __user * __user *arg)
if (put_user(urb->error_count, &userurb->error_count))
return -EFAULT;
if (!(usb_pipeisoc(urb->pipe)))
return 0;
for (i = 0; i < urb->number_of_packets; i++) {
if (put_user(urb->iso_frame_desc[i].actual_length,
&userurb->iso_frame_desc[i].actual_length))
return -EFAULT;
if (put_user(urb->iso_frame_desc[i].status,
&userurb->iso_frame_desc[i].status))
return -EFAULT;
if (usb_pipeisoc(urb->pipe)) {
for (i = 0; i < urb->number_of_packets; i++) {
if (put_user(urb->iso_frame_desc[i].actual_length,
&userurb->iso_frame_desc[i].actual_length))
return -EFAULT;
if (put_user(urb->iso_frame_desc[i].status,
&userurb->iso_frame_desc[i].status))
return -EFAULT;
}
}
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))
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)
@ -1146,15 +1139,15 @@ static int processcompl_compat(struct async *as, void __user * __user *arg)
if (put_user(urb->error_count, &userurb->error_count))
return -EFAULT;
if (!(usb_pipeisoc(urb->pipe)))
return 0;
for (i = 0; i < urb->number_of_packets; i++) {
if (put_user(urb->iso_frame_desc[i].actual_length,
&userurb->iso_frame_desc[i].actual_length))
return -EFAULT;
if (put_user(urb->iso_frame_desc[i].status,
&userurb->iso_frame_desc[i].status))
return -EFAULT;
if (usb_pipeisoc(urb->pipe)) {
for (i = 0; i < urb->number_of_packets; i++) {
if (put_user(urb->iso_frame_desc[i].actual_length,
&userurb->iso_frame_desc[i].actual_length))
return -EFAULT;
if (put_user(urb->iso_frame_desc[i].status,
&userurb->iso_frame_desc[i].status))
return -EFAULT;
}
}
free_async(as);
@ -1177,10 +1170,8 @@ static int proc_reapurbnonblock_compat(struct dev_state *ps, void __user *arg)
{
struct async *as;
printk("reapurbnblock\n");
if (!(as = async_getcompleted(ps)))
return -EAGAIN;
printk("reap got as %p\n", as);
return processcompl_compat(as, (void __user * __user *)arg);
}
@ -1239,7 +1230,7 @@ static int proc_ioctl (struct dev_state *ps, void __user *arg)
return -ENOMEM;
if ((_IOC_DIR(ctrl.ioctl_code) & _IOC_WRITE)) {
if (copy_from_user (buf, ctrl.data, size)) {
kfree (buf);
kfree(buf);
return -EFAULT;
}
} else {
@ -1248,8 +1239,7 @@ static int proc_ioctl (struct dev_state *ps, void __user *arg)
}
if (!connected(ps->dev)) {
if (buf)
kfree(buf);
kfree(buf);
return -ENODEV;
}
@ -1311,8 +1301,8 @@ static int proc_ioctl (struct dev_state *ps, void __user *arg)
&& size > 0
&& copy_to_user (ctrl.data, buf, size) != 0)
retval = -EFAULT;
if (buf != NULL)
kfree (buf);
kfree(buf);
return retval;
}

View File

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

View File

@ -33,7 +33,7 @@
#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)
return -ENODEV;
dev->current_state = 0;
dev->dev.power.power_state = 0;
dev->current_state = PCI_D0;
dev->dev.power.power_state = PMSG_ON;
if (!dev->irq) {
dev_err (&dev->dev,
@ -186,26 +186,14 @@ EXPORT_SYMBOL (usb_hcd_pci_remove);
#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
* @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().
*/
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;
int retval = 0;
@ -213,13 +201,23 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state)
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
* below, HCs can try global suspend and reduce DMA traffic.
* PM-sensitive HCDs may already have done this.
*/
has_pci_pm = pci_find_capability(dev, PCI_CAP_ID_PM);
if (state > 4)
state = 4;
switch (hcd->state) {
@ -228,7 +226,7 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state)
*/
case HC_STATE_RUNNING:
hcd->state = HC_STATE_QUIESCING;
retval = hcd->driver->suspend (hcd, state);
retval = hcd->driver->suspend (hcd, message);
if (retval) {
dev_dbg (hcd->self.controller,
"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 ...
*/
case HC_STATE_SUSPENDED:
if (state <= dev->current_state)
break;
/* no DMA or IRQs except in D0 */
if (!dev->current_state) {
/* no DMA or IRQs except when HC is active */
if (dev->current_state == PCI_D0) {
free_irq (hcd->irq, hcd);
pci_save_state (dev);
pci_disable_device (dev);
free_irq (hcd->irq, hcd);
}
if (!has_pci_pm) {
@ -261,25 +256,19 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state)
break;
}
/* POLICY: ignore D1/D2/D3hot differences;
* we know D3hot will always work.
/* NOTE: dev->current_state becomes nonzero only here, and
* 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);
if (retval < 0 && state < 3) {
retval = pci_set_power_state (dev, 3);
if (retval == 0)
state = 3;
}
retval = pci_set_power_state (dev, PCI_D3hot);
if (retval == 0) {
dev_dbg (hcd->self.controller, "--> PCI %s\n",
pci_state(dev->current_state));
#ifdef CONFIG_USB_SUSPEND
pci_enable_wake (dev, state, hcd->remote_wakeup);
pci_enable_wake (dev, 4, hcd->remote_wakeup);
#endif
dev_dbg (hcd->self.controller, "--> PCI D3\n");
pci_enable_wake (dev, PCI_D3hot, hcd->remote_wakeup);
pci_enable_wake (dev, PCI_D3cold, hcd->remote_wakeup);
} else if (retval < 0) {
dev_dbg (&dev->dev, "PCI %s suspend fail, %d\n",
pci_state(state), retval);
dev_dbg (&dev->dev, "PCI D3 suspend fail, %d\n",
retval);
(void) usb_hcd_pci_resume (dev);
break;
}
@ -287,13 +276,14 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state)
default:
dev_dbg (hcd->self.controller, "hcd state %d; not suspended\n",
hcd->state);
WARN_ON(1);
retval = -EINVAL;
break;
}
/* update power_state **ONLY** to make sysfs happier */
if (retval == 0)
dev->dev.power.power_state = state;
dev->dev.power.power_state = message;
return retval;
}
EXPORT_SYMBOL (usb_hcd_pci_suspend);
@ -308,7 +298,6 @@ int usb_hcd_pci_resume (struct pci_dev *dev)
{
struct usb_hcd *hcd;
int retval;
int has_pci_pm;
hcd = pci_get_drvdata(dev);
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");
return 0;
}
has_pci_pm = pci_find_capability(dev, PCI_CAP_ID_PM);
/* D3cold resume isn't usually reported this way... */
dev_dbg(hcd->self.controller, "resume from PCI %s%s\n",
pci_state(dev->current_state),
has_pci_pm ? "" : " (legacy)");
/* NOTE: chip docs cover clean "real suspend" cases (what Linux
* calls "standby", "suspend to RAM", and so on). There are also
* dirty cases when swsusp fakes a suspend in "shutdown" mode.
*/
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;
if (has_pci_pm)
pci_set_power_state (dev, 0);
dev->dev.power.power_state = 0;
hcd->saw_irq = 0;
retval = request_irq (dev->irq, usb_hcd_irq, SA_SHIRQ,
hcd->driver->description, hcd);
hcd->irq_descr, hcd);
if (retval < 0) {
dev_err (hcd->self.controller,
"can't restore IRQ after resume!\n");
usb_hc_died (hcd);
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);
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.
*/
/* 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 */
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);
#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);
#endif /* CONFIG_PM */

View File

@ -381,7 +381,7 @@ static void hub_tt_kevent (void *arg)
dev_err (&hdev->dev,
"clear tt %d (%04x) error %d\n",
clear->tt, clear->devinfo, status);
kfree (clear);
kfree(clear);
}
spin_unlock_irqrestore (&hub->tt.lock, flags);
}
@ -728,15 +728,11 @@ static void hub_disconnect(struct usb_interface *intf)
list_del_init(&hub->event_list);
spin_unlock_irq(&hub_event_lock);
if (hub->descriptor) {
kfree(hub->descriptor);
hub->descriptor = NULL;
}
kfree(hub->descriptor);
hub->descriptor = NULL;
if (hub->status) {
kfree(hub->status);
hub->status = NULL;
}
kfree(hub->status);
hub->status = NULL;
if (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:
* - some devices won't enumerate without a VBUS power cycle
* - 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
* khubd reactivates the port later (timer, SRP, etc).
* 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
* 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:
*
* - 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;
intf = udev->actconfig->interface[i];
if (intf->dev.power.power_state == PM_SUSPEND_ON)
if (intf->dev.power.power_state == PMSG_SUSPEND)
continue;
if (!intf->dev.driver) {
/* 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? */
status = driver->resume(intf);
if (intf->dev.power.power_state != PM_SUSPEND_ON
if (intf->dev.power.power_state != PMSG_ON
|| status)
dev_dbg(&intf->dev,
"resume fail, state %d code %d\n",
@ -2354,7 +2350,7 @@ check_highspeed (struct usb_hub *hub, struct usb_device *udev, int port1)
schedule_work (&hub->leds);
}
}
kfree (qual);
kfree(qual);
}
static unsigned

View File

@ -41,6 +41,7 @@
#include <linux/parser.h>
#include <asm/byteorder.h>
#include "usb.h"
#include "hcd.h"
static struct super_operations usbfs_ops;
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 */
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;
/* If the interface only has one altsetting and the device didn't
* accept the request (or whenever the old altsetting is the same
* as the new one), we attempt to carry out the equivalent action
* accept the request, we attempt to carry out the equivalent action
* by manually clearing the HALT feature for each endpoint in the
* 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
* (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.
*
* 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
* endpoint in a queue. Normally the queue advances as the controller
* hardware processes each request. But when an URB terminates with any
* fault (such as an error, or being unlinked) its queue stops, at least
* until that URB's completion routine returns. It is guaranteed that
* the queue will not restart until all its unlinked URBs have been fully
* retired, with their completion routines run, even if that's not until
* some time after the original completion handler returns.
* hardware processes each request. But when an URB terminates with an
* error its queue stops, at least until that URB's completion routine
* returns. It is guaranteed that the queue will not restart until all
* its unlinked URBs have been fully retired, with their completion
* routines run, even if that's not until some time after the original
* 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
* large or complex transfers, and clean them up reliably after any sort

View File

@ -50,13 +50,6 @@
#include "hcd.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";
@ -1382,13 +1375,13 @@ void usb_buffer_unmap_sg (struct usb_device *dev, unsigned pipe,
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_driver *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) ||
(dev->driver_data == &usb_generic_driver_data))
@ -1402,7 +1395,7 @@ static int usb_generic_suspend(struct device *dev, u32 state)
return 0;
if (driver->suspend)
return driver->suspend(intf, state);
return driver->suspend(intf, message);
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_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 */
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 void usbfs_conn_disc_event(void);
struct dev_state {
struct list_head list; /* state list */
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. */
#define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \
|USB_CDC_PACKET_TYPE_ALL_MULTICAST \
|USB_CDC_PACKET_TYPE_PROMISCUOUS \
|USB_CDC_PACKET_TYPE_DIRECTED)
@ -322,12 +324,18 @@ module_param (qmult, uint, S_IRUGO|S_IWUSR);
/* also defer IRQs on highspeed TX */
#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) */
#define qlen(gadget) DEFAULT_QLEN
#define BITRATE(g) FS_BPS
static inline int BITRATE(struct usb_gadget *g)
{
return FS_BPS;
}
#endif
@ -1167,7 +1175,7 @@ eth_set_config (struct eth_dev *dev, unsigned number, int gfp_flags)
eth_reset_config (dev);
/* default: pass all packets, no multicast filtering */
dev->cdc_filter = 0x000f;
dev->cdc_filter = DEFAULT_FILTER;
switch (number) {
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 usb_request *req = dev->req;
int value = -EOPNOTSUPP;
u16 wIndex = ctrl->wIndex;
u16 wValue = ctrl->wValue;
u16 wLength = ctrl->wLength;
u16 wIndex = (__force u16) ctrl->wIndex;
u16 wValue = (__force u16) ctrl->wValue;
u16 wLength = (__force u16) ctrl->wLength;
/* descriptors just go into the pre-allocated ep0 buffer,
* 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,
* 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);
@ -1730,9 +1738,11 @@ static void rx_complete (struct usb_ep *ep, struct usb_request *req)
#ifdef CONFIG_USB_ETH_RNDIS
/* we know MaxPacketsPerTransfer == 1 here */
if (dev->rndis)
rndis_rm_hdr (req->buf, &(skb->len));
status = rndis_rm_hdr (skb);
#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_length_errors++;
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,
"rndis control ack complete --> %d, %d/%d\n",
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)
{
struct eth_dev *dev = netdev_priv(net);
u32 length;
struct usb_request *resp;
struct usb_request *resp = dev->stat_req;
/* in case RNDIS calls this after disconnect */
if (!dev->status_ep) {
if (!dev->status) {
DEBUG (dev, "status ENODEV\n");
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;
* 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) {
rndis_set_param_medium (dev->rndis_config,
NDIS_MEDIUM_802_3,
BITRATE(dev->gadget));
BITRATE(dev->gadget)/100);
rndis_send_media_state (dev, 1);
}
#endif
@ -2307,8 +2299,8 @@ eth_bind (struct usb_gadget *gadget)
device_desc.bcdDevice = __constant_cpu_to_le16 (0x0210);
} else if (gadget_is_pxa27x(gadget)) {
device_desc.bcdDevice = __constant_cpu_to_le16 (0x0211);
} else if (gadget_is_s3c2410(gadget)) {
device_desc.bcdDevice = __constant_cpu_to_le16 (0x0212);
} else if (gadget_is_s3c2410(gadget)) {
device_desc.bcdDevice = __constant_cpu_to_le16 (0x0212);
} else if (gadget_is_at91(gadget)) {
device_desc.bcdDevice = __constant_cpu_to_le16 (0x0213);
} else {

View File

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

View File

@ -37,6 +37,7 @@
#include <asm/io.h>
#include <asm/byteorder.h>
#include <asm/system.h>
#include <asm/unaligned.h>
#undef RNDIS_PM
@ -165,7 +166,7 @@ static int gen_ndis_query_resp (int configNr, u32 OID, rndis_resp_t *r)
/* mandatory */
case OID_GEN_LINK_SPEED:
DEBUG("%s: OID_GEN_LINK_SPEED\n", __FUNCTION__);
// DEBUG("%s: OID_GEN_LINK_SPEED\n", __FUNCTION__);
length = 4;
if (rndis_per_dev_params [configNr].media_state
== 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;
/* 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:
* PROMISCUOUS, DIRECTED,
* MULTICAST, ALL_MULTICAST, BROADCAST
@ -1194,10 +1195,10 @@ void rndis_add_hdr (struct sk_buff *skb)
return;
header = (void *) skb_push (skb, 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->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)
@ -1253,26 +1254,23 @@ static rndis_resp_t *rndis_add_response (int configNr, u32 length)
return r;
}
int rndis_rm_hdr (u8 *buf, u32 *length)
int rndis_rm_hdr(struct sk_buff *skb)
{
u32 i, messageLen, dataOffset;
__le32 *tmp;
tmp = (__le32 *) buf;
/* tmp points to a struct rndis_packet_msg_type */
__le32 *tmp = (void *) skb->data;
if (!buf || !length) return -1;
if (le32_to_cpup(tmp++) != 1) return -1;
messageLen = le32_to_cpup(tmp++);
dataOffset = le32_to_cpup(tmp++) + 8;
/* MessageType, MessageLength */
if (__constant_cpu_to_le32(REMOTE_NDIS_PACKET_MSG)
!= get_unaligned(tmp++))
return -EINVAL;
tmp++;
/* DataOffset, DataLength */
if (!skb_pull(skb, le32_to_cpu(get_unaligned(tmp++))
+ 8 /* offset of DataOffset */))
return -EOVERFLOW;
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;
}

View File

@ -38,6 +38,7 @@
*/
/* Message Set for Connectionless (802.3) Devices */
#define REMOTE_NDIS_PACKET_MSG 0x00000001U
#define REMOTE_NDIS_INITIALIZE_MSG 0x00000002U /* Initialize device */
#define REMOTE_NDIS_HALT_MSG 0x00000003U
#define REMOTE_NDIS_QUERY_MSG 0x00000004U
@ -333,7 +334,7 @@ int rndis_set_param_vendor (u8 configNr, u32 vendorID,
const char *vendorDescr);
int rndis_set_param_medium (u8 configNr, u32 medium, u32 speed);
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);
void rndis_free_response (int configNr, u8 *buf);

View File

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

View File

@ -394,7 +394,7 @@ static void qh_lines (
mark = ' ';
if (hw_curr == td->qtd_dma)
mark = '*';
else if (qh->hw_qtd_next == td->qtd_dma)
else if (qh->hw_qtd_next == cpu_to_le32(td->qtd_dma))
mark = '+';
else if (QTD_LENGTH (scratch)) {
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.
*/
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);
@ -729,7 +729,7 @@ static int ehci_suspend (struct usb_hcd *hcd, u32 state)
msleep (100);
#ifdef CONFIG_USB_SUSPEND
(void) usb_suspend_device (hcd->self.root_hub, state);
(void) usb_suspend_device (hcd->self.root_hub, message);
#else
usb_lock_device (hcd->self.root_hub);
(void) ehci_hub_suspend (hcd);

View File

@ -156,8 +156,7 @@ static void ehci_mem_cleanup (struct ehci_hcd *ehci)
ehci->periodic = NULL;
/* shadow periodic table */
if (ehci->pshadow)
kfree (ehci->pshadow);
kfree(ehci->pshadow);
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) {
union ehci_shadow *prev = &ehci->pshadow [i];
u32 *hw_p = &ehci->periodic [i];
__le32 *hw_p = &ehci->periodic [i];
union ehci_shadow here = *prev;
u32 type = 0;
__le32 type = 0;
/* skip the iso nodes at list head */
while (here.ptr) {

View File

@ -364,7 +364,7 @@ union ehci_shadow {
struct ehci_itd *itd; /* Q_TYPE_ITD */
struct ehci_sitd *sitd; /* Q_TYPE_SITD */
struct ehci_fstn *fstn; /* Q_TYPE_FSTN */
u32 *hw_next; /* (all types) */
__le32 *hw_next; /* (all types) */
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
* 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));
int status = -EINVAL;

View File

@ -54,7 +54,7 @@ ohci_pci_start (struct usb_hcd *hcd)
if (pdev->vendor == PCI_VENDOR_ID_AMD
&& pdev->device == 0x740c) {
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)
}
@ -68,7 +68,7 @@ ohci_pci_start (struct usb_hcd *hcd)
*/
else if (pdev->vendor == PCI_VENDOR_ID_OPTI
&& pdev->device == 0xc861) {
ohci_info (ohci,
ohci_dbg (ohci,
"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
&& b->vendor == PCI_VENDOR_ID_NS) {
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
@ -102,7 +113,7 @@ ohci_pci_start (struct usb_hcd *hcd)
#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);
@ -111,7 +122,7 @@ static int ohci_pci_suspend (struct usb_hcd *hcd, u32 state)
msleep (100);
#ifdef CONFIG_USB_SUSPEND
(void) usb_suspend_device (hcd->self.root_hub, state);
(void) usb_suspend_device (hcd->self.root_hub, message);
#else
usb_lock_device (hcd->self.root_hub);
(void) ohci_hub_suspend (hcd);

View File

@ -337,7 +337,7 @@ static int ohci_hcd_pxa27x_drv_remove(struct device *dev)
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 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;
}
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 usb_hcd *hcd = dev_get_drvdata(dev);

View File

@ -1021,6 +1021,8 @@ rescan_this:
if (ohci->ed_controltail) {
command |= OHCI_CLF;
if (ohci->flags & OHCI_QUIRK_ZFMICRO)
mdelay(1);
if (!(ohci->hc_control & OHCI_CTRL_CLE)) {
control |= OHCI_CTRL_CLE;
ohci_writel (ohci, 0,
@ -1029,6 +1031,8 @@ rescan_this:
}
if (ohci->ed_bulktail) {
command |= OHCI_BLF;
if (ohci->flags & OHCI_QUIRK_ZFMICRO)
mdelay(1);
if (!(ohci->hc_control & OHCI_CTRL_BLE)) {
control |= OHCI_CTRL_BLE;
ohci_writel (ohci, 0,
@ -1039,12 +1043,17 @@ rescan_this:
/* CLE/BLE to enable, CLF/BLF to (maybe) kickstart */
if (control) {
ohci->hc_control |= control;
if (ohci->flags & OHCI_QUIRK_ZFMICRO)
mdelay(1);
ohci_writel (ohci, ohci->hc_control,
&ohci->regs->control);
}
if (command)
if (command) {
if (ohci->flags & OHCI_QUIRK_ZFMICRO)
mdelay(1);
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_INITRESET 0x04 /* SiS, OPTi, ... */
#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
};

View File

@ -716,7 +716,7 @@ static void uhci_stop(struct usb_hcd *hcd)
}
#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);
@ -890,8 +890,7 @@ up_failed:
debugfs_remove(uhci_debugfs_root);
debug_failed:
if (errbuf)
kfree(errbuf);
kfree(errbuf);
errbuf_failed:
@ -906,9 +905,7 @@ static void __exit uhci_hcd_cleanup(void)
warn("not all urb_priv's were freed!");
debugfs_remove(uhci_debugfs_root);
if (errbuf)
kfree(errbuf);
kfree(errbuf);
}
module_init(uhci_hcd_init);

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.product = le16_to_cpu(usbdev->descriptor.idProduct);
aiptek->inputdev.id.version = le16_to_cpu(usbdev->descriptor.bcdDevice);
aiptek->inputdev.dev = &intf->dev;
aiptek->usbdev = usbdev;
aiptek->ifnum = intf->altsetting[0].desc.bInterfaceNumber;

View File

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

View File

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

View File

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

View File

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

View File

@ -1169,10 +1169,8 @@ static int usbvideo_v4l_open(struct inode *inode, struct file *file)
}
RingQueue_Free(&uvd->dp);
for (i=0; i < USBVIDEO_NUMSBUF; i++) {
if (uvd->sbuf[i].data != NULL) {
kfree (uvd->sbuf[i].data);
uvd->sbuf[i].data = NULL;
}
kfree(uvd->sbuf[i].data);
uvd->sbuf[i].data = NULL;
}
}
}

View File

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

View File

@ -705,16 +705,12 @@ static int auerchain_control_msg (pauerchain_t acp, struct usb_device *dev, unsi
/* free a single auerbuf */
static void auerbuf_free (pauerbuf_t bp)
{
if (bp->bufp) {
kfree (bp->bufp);
}
if (bp->dr) {
kfree (bp->dr);
}
kfree(bp->bufp);
kfree(bp->dr);
if (bp->urbp) {
usb_free_urb (bp->urbp);
usb_free_urb(bp->urbp);
}
kfree (bp);
kfree(bp);
}
/* free the buffers from an auerbuf list */
@ -1093,14 +1089,12 @@ exit:
*/
static void auerswald_int_free (pauerswald_t cp)
{
if (cp->inturbp) {
usb_free_urb (cp->inturbp);
cp->inturbp = NULL;
}
if (cp->intbufp) {
kfree (cp->intbufp);
cp->intbufp = NULL;
}
if (cp->inturbp) {
usb_free_urb(cp->inturbp);
cp->inturbp = NULL;
}
kfree(cp->intbufp);
cp->intbufp = NULL;
}
/* This function is called to activate the interrupt

View File

@ -3104,6 +3104,7 @@ static void sisusb_disconnect(struct usb_interface *intf)
static struct usb_device_id sisusb_table [] = {
{ USB_DEVICE(0x0711, 0x0900) },
{ USB_DEVICE(0x182d, 0x021c) },
{ }
};
@ -3114,7 +3115,7 @@ static struct usb_driver sisusb_driver = {
.name = "sisusb",
.probe = sisusb_probe,
.disconnect = sisusb_disconnect,
.id_table = sisusb_table
.id_table = sisusb_table,
};
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);
}
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);
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;
}
@ -1376,7 +1383,20 @@ static int pegasus_resume (struct usb_interface *intf)
{
struct pegasus *pegasus = usb_get_intfdata(intf);
intf->dev.power.power_state = PMSG_ON;
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;
}

View File

@ -426,7 +426,7 @@ static void skb_return (struct usbnet *dev, struct sk_buff *skb)
dev->stats.rx_bytes += skb->len;
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);
memset (skb->cb, 0, sizeof (struct skb_data));
status = netif_rx (skb);
@ -3732,11 +3732,17 @@ out:
#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);
/* accelerate emptying of the rx and queues, to avoid
* having everything error out.
*/
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;
}
@ -3744,7 +3750,9 @@ static int usbnet_resume (struct usb_interface *intf)
{
struct usbnet *dev = usb_get_intfdata(intf);
intf->dev.power.power_state = PMSG_ON;
netif_device_attach (dev->net);
tasklet_schedule (&dev->bh);
return 0;
}
@ -4009,10 +4017,23 @@ static const struct usb_device_id products [] = {
.idProduct = 0x9050, /* C-860 */
ZAURUS_MASTER_INTERFACE,
.driver_info = ZAURUS_PXA_INFO,
},
#ifdef CONFIG_USB_ZAURUS
/* at least some (reports vary) C-860 units have very different
* lies about their standards support.
/* at least some (reports vary) PXA units have very different
* 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
| USB_DEVICE_ID_MATCH_DEVICE,
@ -4023,8 +4044,8 @@ static const struct usb_device_id products [] = {
.bInterfaceSubClass = USB_CDC_SUBCLASS_MDLM,
.bInterfaceProtocol = USB_CDC_PROTO_NONE,
.driver_info = (unsigned long) &zaurus_pxa_mdlm_info,
#endif
},
#endif
/* Olympus has some models with a Zaurus-compatible option.
* R-1000 uses a FreeScale i.MXL cpu (ARMv4T)

View File

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

View File

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

View File

@ -1340,9 +1340,8 @@ static struct cypress_buf *cypress_buf_alloc(unsigned int size)
static void cypress_buf_free(struct cypress_buf *cb)
{
if (cb != NULL) {
if (cb->buf_buf != NULL)
kfree(cb->buf_buf);
if (cb) {
kfree(cb->buf_buf);
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
* interruptible_sleep_on_timeout are "atomic" with respect to
* 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(
@ -576,13 +579,12 @@ static inline long cond_wait_interruptible_timeout_irqrestore(
{
DEFINE_WAIT(wait);
prepare_to_wait(q, &wait, TASK_UNINTERRUPTIBLE);
prepare_to_wait(q, &wait, TASK_INTERRUPTIBLE);
spin_unlock_irqrestore(lock, flags);
timeout = schedule_timeout(timeout);
finish_wait(q, &wait);
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 );
/* 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);
finish_wait(&priv->dp_flush_wait, &wait);
@ -1995,7 +1997,7 @@ opcode, line, status, val );
} else if( opcode == DIGI_CMD_IFLUSH_FIFO ) {
wake_up( &priv->dp_flush_wait );
wake_up_interruptible( &priv->dp_flush_wait );
}

View File

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

View File

@ -1347,9 +1347,7 @@ static int ftdi_common_startup (struct usb_serial *serial)
priv->flags = ASYNC_LOW_LATENCY;
/* 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);
if (!port->bulk_in_buffer) {
kfree (priv);
@ -1365,10 +1363,8 @@ static int ftdi_common_startup (struct usb_serial *serial)
usb_free_urb (port->write_urb);
port->write_urb = NULL;
}
if (port->bulk_out_buffer) {
kfree (port->bulk_out_buffer);
port->bulk_out_buffer = NULL;
}
kfree(port->bulk_out_buffer);
port->bulk_out_buffer = NULL;
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 */
if (urb->transfer_buffer != NULL) {
kfree(urb->transfer_buffer);
}
kfree(urb->transfer_buffer);
/* Free the command 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 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);
}
usb_free_urb (edge_port->write_urb);
kfree(edge_port->write_urb->transfer_buffer);
usb_free_urb(edge_port->write_urb);
edge_port->write_urb = NULL;
}
if (edge_port->txfifo.fifo) {
kfree(edge_port->txfifo.fifo);
edge_port->txfifo.fifo = NULL;
}
kfree(edge_port->txfifo.fifo);
edge_port->txfifo.fifo = NULL;
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
urb = edge_port->write_urb;
/* if this urb had a transfer buffer already (old transfer) free it */
if (urb->transfer_buffer != NULL) {
kfree(urb->transfer_buffer);
urb->transfer_buffer = NULL;
}
/* make sure transfer buffer is freed */
kfree(urb->transfer_buffer);
urb->transfer_buffer = NULL;
/* build the data header for the buffer and port that we are about to send out */
count = fifo->count;

View File

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

View File

@ -341,8 +341,7 @@ static void klsi_105_shutdown (struct usb_serial *serial)
* finished. Otherwise this call
* oopses. */
/* 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]);
}
}

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_port *wport;
struct omninet_data *od;
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(port->read_urb);
od = usb_get_serial_port_data(port);
if (od)
kfree(od);
kfree(usb_get_serial_port_data(port));
}

View File

@ -94,6 +94,7 @@ static struct usb_device_id id_table [] = {
{ USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_ID) },
{ USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_ID) },
{ USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X65) },
{ USB_DEVICE(SYNTECH_VENDOR_ID, SYNTECH_PRODUCT_ID) },
{ } /* Terminating entry */
};
@ -677,6 +678,9 @@ static int pl2303_tiocmset (struct usb_serial_port *port, struct file *file,
unsigned long flags;
u8 control;
if (!usb_get_intfdata(port->serial->interface))
return -ENODEV;
spin_lock_irqsave (&priv->lock, flags);
if (set & TIOCM_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);
if (!usb_get_intfdata(port->serial->interface))
return -ENODEV;
spin_lock_irqsave (&priv->lock, flags);
mcr = priv->line_control;
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)
{
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 long flags;
unsigned int actual_length = urb->actual_length;
int status;
u8 uart_state;
dbg("%s (%d)", __FUNCTION__, port->number);
@ -838,19 +870,9 @@ static void pl2303_read_int_callback (struct urb *urb, struct pt_regs *regs)
goto exit;
}
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:
status = usb_submit_urb (urb, GFP_ATOMIC);
if (status)
@ -1022,9 +1044,8 @@ static struct pl2303_buf *pl2303_buf_alloc(unsigned int size)
static void pl2303_buf_free(struct pl2303_buf *pb)
{
if (pb != NULL) {
if (pb->buf_buf != NULL)
kfree(pb->buf_buf);
if (pb) {
kfree(pb->buf_buf);
kfree(pb);
}
}

View File

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

View File

@ -517,8 +517,7 @@ static void ti_shutdown(struct usb_serial *serial)
}
}
if (tdev)
kfree(tdev);
kfree(tdev);
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 },
{ USB_DEVICE(PALM_VENDOR_ID, PALM_TUNGSTEN_T_ID),
.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),
.driver_info = (kernel_ulong_t)&palm_os_4_probe },
{ 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 },
{ USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SPH_I500_ID),
.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),
.driver_info = (kernel_ulong_t)&palm_os_4_probe },
{ 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_M130_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_ZIRE31_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(SAMSUNG_VENDOR_ID, SAMSUNG_SCH_I330_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(ACEECA_VENDOR_ID, ACEECA_MEZ1000_ID) },
{ USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_7135_ID) },

View File

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

View File

@ -119,10 +119,8 @@ static int sddr55_status(struct us_data *us)
/* expect to get short transfer if no card fitted */
if (result == USB_STOR_XFER_SHORT || result == USB_STOR_XFER_STALLED) {
/* had a short transfer, no card inserted, free map memory */
if (info->lba_to_pba)
kfree(info->lba_to_pba);
if (info->pba_to_lba)
kfree(info->pba_to_lba);
kfree(info->lba_to_pba);
kfree(info->pba_to_lba);
info->lba_to_pba = NULL;
info->pba_to_lba = NULL;
@ -649,18 +647,14 @@ static int sddr55_read_map(struct us_data *us) {
return -1;
}
if (info->lba_to_pba)
kfree(info->lba_to_pba);
if (info->pba_to_lba)
kfree(info->pba_to_lba);
kfree(info->lba_to_pba);
kfree(info->pba_to_lba);
info->lba_to_pba = 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)
kfree(info->lba_to_pba);
if (info->pba_to_lba != NULL)
kfree(info->pba_to_lba);
kfree(info->lba_to_pba);
kfree(info->pba_to_lba);
info->lba_to_pba = NULL;
info->pba_to_lba = NULL;
kfree(buffer);
@ -728,10 +722,8 @@ static void sddr55_card_info_destructor(void *extra) {
if (!extra)
return;
if (info->lba_to_pba)
kfree(info->lba_to_pba);
if (info->pba_to_lba)
kfree(info->pba_to_lba);
kfree(info->lba_to_pba);
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
* more than that, probably because of clock rate inaccuracies. */
if (unlikely(us->flags & US_FL_GO_SLOW))
udelay(110);
udelay(125);
if (transfer_length) {
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 ),
#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
* 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.

View File

@ -558,7 +558,7 @@ struct usb_driver {
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);
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);
/* 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);

View File

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