Commit 8453878c authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge gregkh@kernel.bkbits.net:/home/gregkh/linux/linus-2.5

into kroah.com:/home/linux/linux/BK/gregkh-2.5
parents ace40f57 6ceec8d0
......@@ -454,20 +454,22 @@ static int rh_status_urb (struct usb_hcd *hcd, struct urb *urb)
int len = 1 + (urb->dev->maxchild / 8);
/* rh_timer protected by hcd_data_lock */
if (timer_pending (&hcd->rh_timer)
if (hcd->rh_timer.data
|| urb->status != -EINPROGRESS
|| urb->transfer_buffer_length < len) {
dev_dbg (hcd->controller, "not queuing status urb, stat %d\n", urb->status);
dev_dbg (hcd->controller,
"not queuing rh status urb, stat %d\n",
urb->status);
return -EINVAL;
}
urb->hcpriv = hcd; /* nonzero to indicate it's queued */
init_timer (&hcd->rh_timer);
hcd->rh_timer.function = rh_report_status;
hcd->rh_timer.data = (unsigned long) urb;
/* USB 2.0 spec says 256msec; this is close enough */
hcd->rh_timer.expires = jiffies + HZ/4;
add_timer (&hcd->rh_timer);
urb->hcpriv = hcd; /* nonzero to indicate it's queued */
return 0;
}
......@@ -481,39 +483,37 @@ static void rh_report_status (unsigned long ptr)
unsigned long flags;
urb = (struct urb *) ptr;
spin_lock_irqsave (&urb->lock, flags);
if (!urb->dev) {
spin_unlock_irqrestore (&urb->lock, flags);
local_irq_save (flags);
spin_lock (&urb->lock);
/* do nothing if the hc is gone or the urb's been unlinked */
if (!urb->dev
|| urb->status != -EINPROGRESS
|| (hcd = urb->dev->bus->hcpriv) == 0
|| !HCD_IS_RUNNING (hcd->state)) {
spin_unlock (&urb->lock);
local_irq_restore (flags);
return;
}
hcd = urb->dev->bus->hcpriv;
if (urb->status == -EINPROGRESS) {
if (HCD_IS_RUNNING (hcd->state)) {
length = hcd->driver->hub_status_data (hcd,
urb->transfer_buffer);
spin_unlock_irqrestore (&urb->lock, flags);
length = hcd->driver->hub_status_data (hcd, urb->transfer_buffer);
/* complete the status urb, or retrigger the timer */
spin_lock (&hcd_data_lock);
hcd->rh_timer.data = 0;
if (length > 0) {
urb->actual_length = length;
urb->status = 0;
urb->hcpriv = 0;
urb->complete (urb, NULL);
return;
}
} else
spin_unlock_irqrestore (&urb->lock, flags);
/* retrigger timer until completion: success or unlink */
spin_lock_irqsave (&hcd_data_lock, flags);
rh_status_urb (hcd, urb);
spin_unlock_irqrestore (&hcd_data_lock, flags);
} else {
/* this urb's been unlinked */
urb->hcpriv = 0;
spin_unlock_irqrestore (&urb->lock, flags);
spin_unlock (&hcd_data_lock);
spin_unlock (&urb->lock);
/* local irqs are always blocked in completions */
if (length > 0)
usb_hcd_giveback_urb (hcd, urb, NULL);
}
local_irq_restore (flags);
}
/*-------------------------------------------------------------------------*/
......@@ -542,11 +542,13 @@ void usb_rh_status_dequeue (struct usb_hcd *hcd, struct urb *urb)
unsigned long flags;
spin_lock_irqsave (&hcd_data_lock, flags);
del_timer_sync (&hcd->rh_timer);
hcd->rh_timer.data = 0;
spin_unlock_irqrestore (&hcd_data_lock, flags);
/* we rely on RH callback code not unlinking its URB! */
/* note: always a synchronous unlink */
del_timer_sync (&hcd->rh_timer);
urb->hcpriv = 0;
usb_hcd_giveback_urb (hcd, urb, NULL);
}
......
......@@ -42,7 +42,7 @@ static LIST_HEAD(hub_event_list); /* List of hubs needing servicing */
static LIST_HEAD(hub_list); /* List of all hubs (for cleanup) */
static DECLARE_WAIT_QUEUE_HEAD(khubd_wait);
static int khubd_pid = 0; /* PID of khubd */
static pid_t khubd_pid = 0; /* PID of khubd */
static DECLARE_COMPLETION(khubd_exited);
#ifdef DEBUG
......@@ -1126,7 +1126,7 @@ static struct usb_driver hub_driver = {
*/
int usb_hub_init(void)
{
int pid;
pid_t pid;
if (usb_register(&hub_driver) < 0) {
err("Unable to register USB hub driver");
......
......@@ -2642,7 +2642,7 @@ static int net2280_probe (struct pci_dev *pdev, const struct pci_device_id *id)
/*-------------------------------------------------------------------------*/
static const struct pci_device_id __devinitdata pci_ids [] = { {
static struct pci_device_id __devinitdata pci_ids [] = { {
.class = ((PCI_CLASS_SERIAL_USB << 8) | 0xfe),
.class_mask = ~0,
.vendor = 0x17cc,
......
......@@ -1349,6 +1349,13 @@ static struct usbtest_info fw_info = {
.alt = 0,
};
static struct usbtest_info um_info = {
.name = "user mode test driver",
.ep_in = 7,
.ep_out = 3,
.alt = -1,
};
#ifdef IBOT2
/* this is a nice source of high speed bulk data;
* uses an FX2, with firmware provided in the device
......@@ -1414,6 +1421,11 @@ static struct usb_device_id id_table [] = {
.driver_info = (unsigned long) &fw_info,
},
/* so does a user-mode variant */
{ USB_DEVICE (0x0525, 0xa4a4),
.driver_info = (unsigned long) &um_info,
},
#ifdef KEYSPAN_19Qi
/* Keyspan 19qi uses an21xx (original EZ-USB) */
// this does not coexist with the real Keyspan 19qi driver!
......
......@@ -134,7 +134,8 @@ freecom_readdata (Scsi_Cmnd *srb, struct us_data *us,
/* Now transfer all of our blocks. */
US_DEBUGP("Start of read\n");
result = usb_stor_bulk_transfer_srb(us, ipipe, srb, count);
result = usb_stor_bulk_transfer_sg(us, ipipe, srb->request_buffer,
count, srb->use_sg, &srb->resid);
US_DEBUGP("freecom_readdata done!\n");
if (result > USB_STOR_XFER_SHORT)
......@@ -168,7 +169,8 @@ freecom_writedata (Scsi_Cmnd *srb, struct us_data *us,
/* Now transfer all of our blocks. */
US_DEBUGP("Start of write\n");
result = usb_stor_bulk_transfer_srb(us, opipe, srb, count);
result = usb_stor_bulk_transfer_sg(us, opipe, srb->request_buffer,
count, srb->use_sg, &srb->resid);
US_DEBUGP("freecom_writedata done!\n");
if (result > USB_STOR_XFER_SHORT)
......
......@@ -1562,8 +1562,10 @@ int sddr09_transport(Scsi_Cmnd *srb, struct us_data *us)
"sending" : "receiving",
srb->request_bufflen);
result = usb_stor_bulk_transfer_srb(us, pipe, srb,
srb->request_bufflen);
result = usb_stor_bulk_transfer_sg(us, pipe,
srb->request_buffer,
srb->request_bufflen,
srb->use_sg, &srb->resid);
return (result == USB_STOR_XFER_GOOD ?
USB_STOR_TRANSPORT_GOOD : USB_STOR_TRANSPORT_ERROR);
......
......@@ -511,9 +511,8 @@ void usb_stor_invoke_transport(Scsi_Cmnd *srb, struct us_data *us)
* short-circuit all other processing
*/
if (atomic_read(&us->sm_state) == US_STATE_ABORTING) {
US_DEBUGP("-- transport indicates command was aborted\n");
srb->result = DID_ABORT << 16;
return;
US_DEBUGP("-- command was aborted\n");
goto Handle_Abort;
}
/* if there is a transport error, reset and don't auto-sense */
......@@ -634,8 +633,7 @@ void usb_stor_invoke_transport(Scsi_Cmnd *srb, struct us_data *us)
if (atomic_read(&us->sm_state) == US_STATE_ABORTING) {
US_DEBUGP("-- auto-sense aborted\n");
srb->result = DID_ABORT << 16;
return;
goto Handle_Abort;
}
if (temp_result != USB_STOR_TRANSPORT_GOOD) {
US_DEBUGP("-- auto-sense failure\n");
......@@ -688,6 +686,15 @@ void usb_stor_invoke_transport(Scsi_Cmnd *srb, struct us_data *us)
(result == USB_STOR_TRANSPORT_GOOD) &&
((srb->sense_buffer[2] & 0xf) == 0x0))
srb->sense_buffer[0] = 0x0;
return;
/* abort processing: the bulk-only transport requires a reset
* following an abort */
Handle_Abort:
srb->result = DID_ABORT << 16;
if (us->protocol == US_PR_BULK) {
us->transport_reset(us);
}
}
/* Abort the currently running scsi command or device reset.
......@@ -772,8 +779,9 @@ int usb_stor_CBI_transport(Scsi_Cmnd *srb, struct us_data *us)
if (transfer_length) {
unsigned int pipe = srb->sc_data_direction == SCSI_DATA_READ ?
us->recv_bulk_pipe : us->send_bulk_pipe;
result = usb_stor_bulk_transfer_srb(us, pipe, srb,
transfer_length);
result = usb_stor_bulk_transfer_sg(us, pipe,
srb->request_buffer, transfer_length,
srb->use_sg, &srb->resid);
US_DEBUGP("CBI data stage result is 0x%x\n", result);
if (result == USB_STOR_XFER_ERROR)
return USB_STOR_TRANSPORT_ERROR;
......@@ -862,8 +870,9 @@ int usb_stor_CB_transport(Scsi_Cmnd *srb, struct us_data *us)
if (transfer_length) {
unsigned int pipe = srb->sc_data_direction == SCSI_DATA_READ ?
us->recv_bulk_pipe : us->send_bulk_pipe;
result = usb_stor_bulk_transfer_srb(us, pipe, srb,
transfer_length);
result = usb_stor_bulk_transfer_sg(us, pipe,
srb->request_buffer, transfer_length,
srb->use_sg, &srb->resid);
US_DEBUGP("CB data stage result is 0x%x\n", result);
if (result == USB_STOR_XFER_ERROR)
return USB_STOR_TRANSPORT_ERROR;
......@@ -944,8 +953,9 @@ int usb_stor_Bulk_transport(Scsi_Cmnd *srb, struct us_data *us)
if (transfer_length) {
unsigned int pipe = srb->sc_data_direction == SCSI_DATA_READ ?
us->recv_bulk_pipe : us->send_bulk_pipe;
result = usb_stor_bulk_transfer_srb(us, pipe, srb,
transfer_length);
result = usb_stor_bulk_transfer_sg(us, pipe,
srb->request_buffer, transfer_length,
srb->use_sg, &srb->resid);
US_DEBUGP("Bulk data transfer result 0x%x\n", result);
if (result == USB_STOR_XFER_ERROR)
return USB_STOR_TRANSPORT_ERROR;
......
......@@ -178,10 +178,4 @@ extern int usb_stor_bulk_transfer_sglist(struct us_data *us, unsigned int pipe,
extern int usb_stor_bulk_transfer_sg(struct us_data *us, unsigned int pipe,
void *buf, unsigned int length, int use_sg, int *residual);
static __inline__ int usb_stor_bulk_transfer_srb(struct us_data *us,
unsigned int pipe, Scsi_Cmnd *srb, unsigned int length) {
return usb_stor_bulk_transfer_sg(us, pipe, srb->request_buffer,
length, srb->use_sg, &srb->resid);
}
#endif
......@@ -126,8 +126,8 @@ static int skel_ioctl (struct inode *inode, struct file *file, unsigned int cmd
static int skel_open (struct inode *inode, struct file *file);
static int skel_release (struct inode *inode, struct file *file);
static int skel_probe (struct usb_interface *intf, const struct usb_device_id *id);
static void skel_disconnect (struct usb_interface *intf);
static int skel_probe (struct usb_interface *interface, const struct usb_device_id *id);
static void skel_disconnect (struct usb_interface *interface);
static void skel_write_bulk_callback (struct urb *urb, struct pt_regs *regs);
......@@ -163,7 +163,7 @@ static struct file_operations skel_fops = {
* usb class driver info in order to get a minor number from the usb core,
* and to have the device registered with devfs and the driver core
*/
static struct usb_class_driver skell_class = {
static struct usb_class_driver skel_class = {
.name = "usb/skel%d",
.fops = &skel_fops,
.mode = S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH,
......@@ -515,7 +515,7 @@ static int skel_probe(struct usb_interface *interface, const struct usb_device_i
return -ENODEV;
}
retval = usb_register_dev (intf, &skel_class);
retval = usb_register_dev (interface, &skel_class);
if (retval) {
/* something prevented us from registering this driver */
err ("Not able to get a minor for this device.");
......@@ -533,7 +533,7 @@ static int skel_probe(struct usb_interface *interface, const struct usb_device_i
init_MUTEX (&dev->sem);
dev->udev = udev;
dev->interface = interface;
dev->minor = intf->minor;
dev->minor = interface->minor;
/* set up the endpoint information */
/* check out the endpoints */
......@@ -610,7 +610,7 @@ static int skel_probe(struct usb_interface *interface, const struct usb_device_i
dev = NULL;
exit_minor:
usb_deregister_dev (intf, &skel_class);
usb_deregister_dev (interface, &skel_class);
exit:
if (dev) {
......@@ -654,7 +654,7 @@ static void skel_disconnect(struct usb_interface *interface)
minor = dev->minor;
/* give back our minor */
usb_deregister_dev (intf, &skel_class);
usb_deregister_dev (interface, &skel_class);
/* terminate an ongoing write */
if (atomic_read (&dev->write_busy)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment