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) ...@@ -454,20 +454,22 @@ static int rh_status_urb (struct usb_hcd *hcd, struct urb *urb)
int len = 1 + (urb->dev->maxchild / 8); int len = 1 + (urb->dev->maxchild / 8);
/* rh_timer protected by hcd_data_lock */ /* rh_timer protected by hcd_data_lock */
if (timer_pending (&hcd->rh_timer) if (hcd->rh_timer.data
|| urb->status != -EINPROGRESS || urb->status != -EINPROGRESS
|| urb->transfer_buffer_length < len) { || 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; return -EINVAL;
} }
urb->hcpriv = hcd; /* nonzero to indicate it's queued */
init_timer (&hcd->rh_timer); init_timer (&hcd->rh_timer);
hcd->rh_timer.function = rh_report_status; hcd->rh_timer.function = rh_report_status;
hcd->rh_timer.data = (unsigned long) urb; hcd->rh_timer.data = (unsigned long) urb;
/* USB 2.0 spec says 256msec; this is close enough */ /* USB 2.0 spec says 256msec; this is close enough */
hcd->rh_timer.expires = jiffies + HZ/4; hcd->rh_timer.expires = jiffies + HZ/4;
add_timer (&hcd->rh_timer); add_timer (&hcd->rh_timer);
urb->hcpriv = hcd; /* nonzero to indicate it's queued */
return 0; return 0;
} }
...@@ -481,39 +483,37 @@ static void rh_report_status (unsigned long ptr) ...@@ -481,39 +483,37 @@ static void rh_report_status (unsigned long ptr)
unsigned long flags; unsigned long flags;
urb = (struct urb *) ptr; urb = (struct urb *) ptr;
spin_lock_irqsave (&urb->lock, flags); local_irq_save (flags);
if (!urb->dev) { spin_lock (&urb->lock);
spin_unlock_irqrestore (&urb->lock, flags);
/* 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; return;
} }
hcd = urb->dev->bus->hcpriv; length = hcd->driver->hub_status_data (hcd, urb->transfer_buffer);
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);
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 */ /* complete the status urb, or retrigger the timer */
spin_lock_irqsave (&hcd_data_lock, flags); spin_lock (&hcd_data_lock);
rh_status_urb (hcd, urb); hcd->rh_timer.data = 0;
spin_unlock_irqrestore (&hcd_data_lock, flags); if (length > 0) {
} else { urb->actual_length = length;
/* this urb's been unlinked */ urb->status = 0;
urb->hcpriv = 0; urb->hcpriv = 0;
spin_unlock_irqrestore (&urb->lock, flags); } else
rh_status_urb (hcd, urb);
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); 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) ...@@ -542,11 +542,13 @@ void usb_rh_status_dequeue (struct usb_hcd *hcd, struct urb *urb)
unsigned long flags; unsigned long flags;
spin_lock_irqsave (&hcd_data_lock, flags); spin_lock_irqsave (&hcd_data_lock, flags);
del_timer_sync (&hcd->rh_timer);
hcd->rh_timer.data = 0; hcd->rh_timer.data = 0;
spin_unlock_irqrestore (&hcd_data_lock, flags); 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); usb_hcd_giveback_urb (hcd, urb, NULL);
} }
......
...@@ -42,7 +42,7 @@ static LIST_HEAD(hub_event_list); /* List of hubs needing servicing */ ...@@ -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 LIST_HEAD(hub_list); /* List of all hubs (for cleanup) */
static DECLARE_WAIT_QUEUE_HEAD(khubd_wait); 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); static DECLARE_COMPLETION(khubd_exited);
#ifdef DEBUG #ifdef DEBUG
...@@ -1126,7 +1126,7 @@ static struct usb_driver hub_driver = { ...@@ -1126,7 +1126,7 @@ static struct usb_driver hub_driver = {
*/ */
int usb_hub_init(void) int usb_hub_init(void)
{ {
int pid; pid_t pid;
if (usb_register(&hub_driver) < 0) { if (usb_register(&hub_driver) < 0) {
err("Unable to register USB hub driver"); 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) ...@@ -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 = ((PCI_CLASS_SERIAL_USB << 8) | 0xfe),
.class_mask = ~0, .class_mask = ~0,
.vendor = 0x17cc, .vendor = 0x17cc,
......
...@@ -1349,6 +1349,13 @@ static struct usbtest_info fw_info = { ...@@ -1349,6 +1349,13 @@ static struct usbtest_info fw_info = {
.alt = 0, .alt = 0,
}; };
static struct usbtest_info um_info = {
.name = "user mode test driver",
.ep_in = 7,
.ep_out = 3,
.alt = -1,
};
#ifdef IBOT2 #ifdef IBOT2
/* this is a nice source of high speed bulk data; /* this is a nice source of high speed bulk data;
* uses an FX2, with firmware provided in the device * uses an FX2, with firmware provided in the device
...@@ -1414,6 +1421,11 @@ static struct usb_device_id id_table [] = { ...@@ -1414,6 +1421,11 @@ static struct usb_device_id id_table [] = {
.driver_info = (unsigned long) &fw_info, .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 #ifdef KEYSPAN_19Qi
/* Keyspan 19qi uses an21xx (original EZ-USB) */ /* Keyspan 19qi uses an21xx (original EZ-USB) */
// this does not coexist with the real Keyspan 19qi driver! // this does not coexist with the real Keyspan 19qi driver!
......
...@@ -134,7 +134,8 @@ freecom_readdata (Scsi_Cmnd *srb, struct us_data *us, ...@@ -134,7 +134,8 @@ freecom_readdata (Scsi_Cmnd *srb, struct us_data *us,
/* Now transfer all of our blocks. */ /* Now transfer all of our blocks. */
US_DEBUGP("Start of read\n"); 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"); US_DEBUGP("freecom_readdata done!\n");
if (result > USB_STOR_XFER_SHORT) if (result > USB_STOR_XFER_SHORT)
...@@ -168,7 +169,8 @@ freecom_writedata (Scsi_Cmnd *srb, struct us_data *us, ...@@ -168,7 +169,8 @@ freecom_writedata (Scsi_Cmnd *srb, struct us_data *us,
/* Now transfer all of our blocks. */ /* Now transfer all of our blocks. */
US_DEBUGP("Start of write\n"); 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"); US_DEBUGP("freecom_writedata done!\n");
if (result > USB_STOR_XFER_SHORT) if (result > USB_STOR_XFER_SHORT)
......
...@@ -1562,8 +1562,10 @@ int sddr09_transport(Scsi_Cmnd *srb, struct us_data *us) ...@@ -1562,8 +1562,10 @@ int sddr09_transport(Scsi_Cmnd *srb, struct us_data *us)
"sending" : "receiving", "sending" : "receiving",
srb->request_bufflen); srb->request_bufflen);
result = usb_stor_bulk_transfer_srb(us, pipe, srb, result = usb_stor_bulk_transfer_sg(us, pipe,
srb->request_bufflen); srb->request_buffer,
srb->request_bufflen,
srb->use_sg, &srb->resid);
return (result == USB_STOR_XFER_GOOD ? return (result == USB_STOR_XFER_GOOD ?
USB_STOR_TRANSPORT_GOOD : USB_STOR_TRANSPORT_ERROR); USB_STOR_TRANSPORT_GOOD : USB_STOR_TRANSPORT_ERROR);
......
...@@ -511,9 +511,8 @@ void usb_stor_invoke_transport(Scsi_Cmnd *srb, struct us_data *us) ...@@ -511,9 +511,8 @@ void usb_stor_invoke_transport(Scsi_Cmnd *srb, struct us_data *us)
* short-circuit all other processing * short-circuit all other processing
*/ */
if (atomic_read(&us->sm_state) == US_STATE_ABORTING) { if (atomic_read(&us->sm_state) == US_STATE_ABORTING) {
US_DEBUGP("-- transport indicates command was aborted\n"); US_DEBUGP("-- command was aborted\n");
srb->result = DID_ABORT << 16; goto Handle_Abort;
return;
} }
/* if there is a transport error, reset and don't auto-sense */ /* 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) ...@@ -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) { if (atomic_read(&us->sm_state) == US_STATE_ABORTING) {
US_DEBUGP("-- auto-sense aborted\n"); US_DEBUGP("-- auto-sense aborted\n");
srb->result = DID_ABORT << 16; goto Handle_Abort;
return;
} }
if (temp_result != USB_STOR_TRANSPORT_GOOD) { if (temp_result != USB_STOR_TRANSPORT_GOOD) {
US_DEBUGP("-- auto-sense failure\n"); US_DEBUGP("-- auto-sense failure\n");
...@@ -688,6 +686,15 @@ void usb_stor_invoke_transport(Scsi_Cmnd *srb, struct us_data *us) ...@@ -688,6 +686,15 @@ void usb_stor_invoke_transport(Scsi_Cmnd *srb, struct us_data *us)
(result == USB_STOR_TRANSPORT_GOOD) && (result == USB_STOR_TRANSPORT_GOOD) &&
((srb->sense_buffer[2] & 0xf) == 0x0)) ((srb->sense_buffer[2] & 0xf) == 0x0))
srb->sense_buffer[0] = 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. /* 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) ...@@ -772,8 +779,9 @@ int usb_stor_CBI_transport(Scsi_Cmnd *srb, struct us_data *us)
if (transfer_length) { if (transfer_length) {
unsigned int pipe = srb->sc_data_direction == SCSI_DATA_READ ? unsigned int pipe = srb->sc_data_direction == SCSI_DATA_READ ?
us->recv_bulk_pipe : us->send_bulk_pipe; us->recv_bulk_pipe : us->send_bulk_pipe;
result = usb_stor_bulk_transfer_srb(us, pipe, srb, result = usb_stor_bulk_transfer_sg(us, pipe,
transfer_length); srb->request_buffer, transfer_length,
srb->use_sg, &srb->resid);
US_DEBUGP("CBI data stage result is 0x%x\n", result); US_DEBUGP("CBI data stage result is 0x%x\n", result);
if (result == USB_STOR_XFER_ERROR) if (result == USB_STOR_XFER_ERROR)
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
...@@ -862,8 +870,9 @@ int usb_stor_CB_transport(Scsi_Cmnd *srb, struct us_data *us) ...@@ -862,8 +870,9 @@ int usb_stor_CB_transport(Scsi_Cmnd *srb, struct us_data *us)
if (transfer_length) { if (transfer_length) {
unsigned int pipe = srb->sc_data_direction == SCSI_DATA_READ ? unsigned int pipe = srb->sc_data_direction == SCSI_DATA_READ ?
us->recv_bulk_pipe : us->send_bulk_pipe; us->recv_bulk_pipe : us->send_bulk_pipe;
result = usb_stor_bulk_transfer_srb(us, pipe, srb, result = usb_stor_bulk_transfer_sg(us, pipe,
transfer_length); srb->request_buffer, transfer_length,
srb->use_sg, &srb->resid);
US_DEBUGP("CB data stage result is 0x%x\n", result); US_DEBUGP("CB data stage result is 0x%x\n", result);
if (result == USB_STOR_XFER_ERROR) if (result == USB_STOR_XFER_ERROR)
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
...@@ -944,8 +953,9 @@ int usb_stor_Bulk_transport(Scsi_Cmnd *srb, struct us_data *us) ...@@ -944,8 +953,9 @@ int usb_stor_Bulk_transport(Scsi_Cmnd *srb, struct us_data *us)
if (transfer_length) { if (transfer_length) {
unsigned int pipe = srb->sc_data_direction == SCSI_DATA_READ ? unsigned int pipe = srb->sc_data_direction == SCSI_DATA_READ ?
us->recv_bulk_pipe : us->send_bulk_pipe; us->recv_bulk_pipe : us->send_bulk_pipe;
result = usb_stor_bulk_transfer_srb(us, pipe, srb, result = usb_stor_bulk_transfer_sg(us, pipe,
transfer_length); srb->request_buffer, transfer_length,
srb->use_sg, &srb->resid);
US_DEBUGP("Bulk data transfer result 0x%x\n", result); US_DEBUGP("Bulk data transfer result 0x%x\n", result);
if (result == USB_STOR_XFER_ERROR) if (result == USB_STOR_XFER_ERROR)
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
......
...@@ -178,10 +178,4 @@ extern int usb_stor_bulk_transfer_sglist(struct us_data *us, unsigned int pipe, ...@@ -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, extern int usb_stor_bulk_transfer_sg(struct us_data *us, unsigned int pipe,
void *buf, unsigned int length, int use_sg, int *residual); 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 #endif
...@@ -126,8 +126,8 @@ static int skel_ioctl (struct inode *inode, struct file *file, unsigned int cmd ...@@ -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_open (struct inode *inode, struct file *file);
static int skel_release (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 int skel_probe (struct usb_interface *interface, const struct usb_device_id *id);
static void skel_disconnect (struct usb_interface *intf); static void skel_disconnect (struct usb_interface *interface);
static void skel_write_bulk_callback (struct urb *urb, struct pt_regs *regs); static void skel_write_bulk_callback (struct urb *urb, struct pt_regs *regs);
...@@ -163,7 +163,7 @@ static struct file_operations skel_fops = { ...@@ -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, * 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 * 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", .name = "usb/skel%d",
.fops = &skel_fops, .fops = &skel_fops,
.mode = S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH, .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 ...@@ -515,7 +515,7 @@ static int skel_probe(struct usb_interface *interface, const struct usb_device_i
return -ENODEV; return -ENODEV;
} }
retval = usb_register_dev (intf, &skel_class); retval = usb_register_dev (interface, &skel_class);
if (retval) { if (retval) {
/* something prevented us from registering this driver */ /* something prevented us from registering this driver */
err ("Not able to get a minor for this device."); 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 ...@@ -533,7 +533,7 @@ static int skel_probe(struct usb_interface *interface, const struct usb_device_i
init_MUTEX (&dev->sem); init_MUTEX (&dev->sem);
dev->udev = udev; dev->udev = udev;
dev->interface = interface; dev->interface = interface;
dev->minor = intf->minor; dev->minor = interface->minor;
/* set up the endpoint information */ /* set up the endpoint information */
/* check out the endpoints */ /* check out the endpoints */
...@@ -610,7 +610,7 @@ static int skel_probe(struct usb_interface *interface, const struct usb_device_i ...@@ -610,7 +610,7 @@ static int skel_probe(struct usb_interface *interface, const struct usb_device_i
dev = NULL; dev = NULL;
exit_minor: exit_minor:
usb_deregister_dev (intf, &skel_class); usb_deregister_dev (interface, &skel_class);
exit: exit:
if (dev) { if (dev) {
...@@ -654,7 +654,7 @@ static void skel_disconnect(struct usb_interface *interface) ...@@ -654,7 +654,7 @@ static void skel_disconnect(struct usb_interface *interface)
minor = dev->minor; minor = dev->minor;
/* give back our minor */ /* give back our minor */
usb_deregister_dev (intf, &skel_class); usb_deregister_dev (interface, &skel_class);
/* terminate an ongoing write */ /* terminate an ongoing write */
if (atomic_read (&dev->write_busy)) { 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