Commit b40f8d39 authored by Daniel Walker's avatar Daniel Walker Committed by Greg Kroah-Hartman

usb: u132-hcd driver style clean up

I was converting a semaphore in this file to a mutex when I noticed that
this file has some fairly rampant style problems. Practically every line
has spaces instead of tabs .. Once I cleared that up, checkpatch.pl showed
a number of other problem.. I think this file might be a good one to review
for new style checks that could be added..

Below are the only two remaining which I didn't remove. 

#5083: FILE: drivers/usb/host/u132-hcd.c:2907:
+               error:

WARNING: labels should not be indented
#5087: FILE: drivers/usb/host/u132-hcd.c:2911:
+               stall:

These labels are actually inside a switch statement, and they are right
under "default:". "default:" appears to be exempt and these other label
should be too, or default shouldn't be exempt.

I also deleted a few lines due to single statements inside { } , 

if (is_error()) {
	return;
}

becomes,

if (is_error())
	return;

with one line deleted.
Signed-off-by: default avatarDaniel Walker <dwalker@mvista.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 619a6f1d
...@@ -84,8 +84,8 @@ static DECLARE_WAIT_QUEUE_HEAD(u132_hcd_wait); ...@@ -84,8 +84,8 @@ static DECLARE_WAIT_QUEUE_HEAD(u132_hcd_wait);
* *
*/ */
static struct mutex u132_module_lock; static struct mutex u132_module_lock;
static int u132_exiting = 0; static int u132_exiting;
static int u132_instances = 0; static int u132_instances;
static struct list_head u132_static_list; static struct list_head u132_static_list;
/* /*
* end of the global variables protected by u132_module_lock * end of the global variables protected by u132_module_lock
...@@ -329,9 +329,8 @@ static void u132_ring_queue_work(struct u132 *u132, struct u132_ring *ring, ...@@ -329,9 +329,8 @@ static void u132_ring_queue_work(struct u132 *u132, struct u132_ring *ring,
static void u132_ring_cancel_work(struct u132 *u132, struct u132_ring *ring) static void u132_ring_cancel_work(struct u132 *u132, struct u132_ring *ring)
{ {
if (cancel_delayed_work(&ring->scheduler)) { if (cancel_delayed_work(&ring->scheduler))
kref_put(&u132->kref, u132_hcd_delete); kref_put(&u132->kref, u132_hcd_delete);
}
} }
static void u132_endp_delete(struct kref *kref) static void u132_endp_delete(struct kref *kref)
...@@ -356,7 +355,8 @@ static void u132_endp_delete(struct kref *kref) ...@@ -356,7 +355,8 @@ static void u132_endp_delete(struct kref *kref)
struct u132_endp, endp_ring); struct u132_endp, endp_ring);
ring->curr_endp = next_endp; ring->curr_endp = next_endp;
list_del(head); list_del(head);
}} else }
} else
list_del(head); list_del(head);
if (endp->input) { if (endp->input) {
udev->endp_number_in[usb_endp] = 0; udev->endp_number_in[usb_endp] = 0;
...@@ -534,7 +534,8 @@ static void u132_hcd_giveback_urb(struct u132 *u132, struct u132_endp *endp, ...@@ -534,7 +534,8 @@ static void u132_hcd_giveback_urb(struct u132 *u132, struct u132_endp *endp,
endp->active = 0; endp->active = 0;
spin_unlock_irqrestore(&endp->queue_lock.slock, irqs); spin_unlock_irqrestore(&endp->queue_lock.slock, irqs);
kfree(urbq); kfree(urbq);
} down(&u132->scheduler_lock); }
down(&u132->scheduler_lock);
ring = endp->ring; ring = endp->ring;
ring->in_use = 0; ring->in_use = 0;
u132_ring_cancel_work(u132, ring); u132_ring_cancel_work(u132, ring);
...@@ -653,9 +654,10 @@ static void u132_hcd_interrupt_recv(void *data, struct urb *urb, u8 *buf, ...@@ -653,9 +654,10 @@ static void u132_hcd_interrupt_recv(void *data, struct urb *urb, u8 *buf,
u8 *u = urb->transfer_buffer + urb->actual_length; u8 *u = urb->transfer_buffer + urb->actual_length;
u8 *b = buf; u8 *b = buf;
int L = len; int L = len;
while (L-- > 0) {
while (L-- > 0)
*u++ = *b++; *u++ = *b++;
}
urb->actual_length += len; urb->actual_length += len;
if ((condition_code == TD_CC_NOERROR) && if ((condition_code == TD_CC_NOERROR) &&
(urb->transfer_buffer_length > urb->actual_length)) { (urb->transfer_buffer_length > urb->actual_length)) {
...@@ -668,8 +670,7 @@ static void u132_hcd_interrupt_recv(void *data, struct urb *urb, u8 *buf, ...@@ -668,8 +670,7 @@ static void u132_hcd_interrupt_recv(void *data, struct urb *urb, u8 *buf,
retval = edset_single(u132, ring, endp, urb, retval = edset_single(u132, ring, endp, urb,
address, endp->toggle_bits, address, endp->toggle_bits,
u132_hcd_interrupt_recv); u132_hcd_interrupt_recv);
if (retval == 0) { if (retval != 0)
} else
u132_hcd_giveback_urb(u132, endp, urb, u132_hcd_giveback_urb(u132, endp, urb,
retval); retval);
} else { } else {
...@@ -756,8 +757,7 @@ static void u132_hcd_bulk_output_sent(void *data, struct urb *urb, u8 *buf, ...@@ -756,8 +757,7 @@ static void u132_hcd_bulk_output_sent(void *data, struct urb *urb, u8 *buf,
up(&u132->scheduler_lock); up(&u132->scheduler_lock);
retval = edset_output(u132, ring, endp, urb, address, retval = edset_output(u132, ring, endp, urb, address,
endp->toggle_bits, u132_hcd_bulk_output_sent); endp->toggle_bits, u132_hcd_bulk_output_sent);
if (retval == 0) { if (retval != 0)
} else
u132_hcd_giveback_urb(u132, endp, urb, retval); u132_hcd_giveback_urb(u132, endp, urb, retval);
return; return;
} else { } else {
...@@ -805,9 +805,10 @@ static void u132_hcd_bulk_input_recv(void *data, struct urb *urb, u8 *buf, ...@@ -805,9 +805,10 @@ static void u132_hcd_bulk_input_recv(void *data, struct urb *urb, u8 *buf,
u8 *u = urb->transfer_buffer + urb->actual_length; u8 *u = urb->transfer_buffer + urb->actual_length;
u8 *b = buf; u8 *b = buf;
int L = len; int L = len;
while (L-- > 0) {
while (L-- > 0)
*u++ = *b++; *u++ = *b++;
}
urb->actual_length += len; urb->actual_length += len;
if ((condition_code == TD_CC_NOERROR) && if ((condition_code == TD_CC_NOERROR) &&
(urb->transfer_buffer_length > urb->actual_length)) { (urb->transfer_buffer_length > urb->actual_length)) {
...@@ -820,8 +821,7 @@ static void u132_hcd_bulk_input_recv(void *data, struct urb *urb, u8 *buf, ...@@ -820,8 +821,7 @@ static void u132_hcd_bulk_input_recv(void *data, struct urb *urb, u8 *buf,
ring->number, endp, urb, address, ring->number, endp, urb, address,
endp->usb_endp, endp->toggle_bits, endp->usb_endp, endp->toggle_bits,
u132_hcd_bulk_input_recv); u132_hcd_bulk_input_recv);
if (retval == 0) { if (retval != 0)
} else
u132_hcd_giveback_urb(u132, endp, urb, retval); u132_hcd_giveback_urb(u132, endp, urb, retval);
return; return;
} else if (condition_code == TD_CC_NOERROR) { } else if (condition_code == TD_CC_NOERROR) {
...@@ -944,9 +944,10 @@ static void u132_hcd_configure_input_recv(void *data, struct urb *urb, u8 *buf, ...@@ -944,9 +944,10 @@ static void u132_hcd_configure_input_recv(void *data, struct urb *urb, u8 *buf,
u8 *u = urb->transfer_buffer; u8 *u = urb->transfer_buffer;
u8 *b = buf; u8 *b = buf;
int L = len; int L = len;
while (L-- > 0) {
while (L-- > 0)
*u++ = *b++; *u++ = *b++;
}
urb->actual_length = len; urb->actual_length = len;
if ((condition_code == TD_CC_NOERROR) || ((condition_code == if ((condition_code == TD_CC_NOERROR) || ((condition_code ==
TD_DATAUNDERRUN) && ((urb->transfer_flags & TD_DATAUNDERRUN) && ((urb->transfer_flags &
...@@ -957,8 +958,7 @@ static void u132_hcd_configure_input_recv(void *data, struct urb *urb, u8 *buf, ...@@ -957,8 +958,7 @@ static void u132_hcd_configure_input_recv(void *data, struct urb *urb, u8 *buf,
ring->number, endp, urb, address, ring->number, endp, urb, address,
endp->usb_endp, 0x3, endp->usb_endp, 0x3,
u132_hcd_configure_empty_sent); u132_hcd_configure_empty_sent);
if (retval == 0) { if (retval != 0)
} else
u132_hcd_giveback_urb(u132, endp, urb, retval); u132_hcd_giveback_urb(u132, endp, urb, retval);
return; return;
} else if (condition_code == TD_CC_STALL) { } else if (condition_code == TD_CC_STALL) {
...@@ -1057,8 +1057,7 @@ static void u132_hcd_configure_setup_sent(void *data, struct urb *urb, u8 *buf, ...@@ -1057,8 +1057,7 @@ static void u132_hcd_configure_setup_sent(void *data, struct urb *urb, u8 *buf,
ring->number, endp, urb, address, ring->number, endp, urb, address,
endp->usb_endp, 0, endp->usb_endp, 0,
u132_hcd_configure_input_recv); u132_hcd_configure_input_recv);
if (retval == 0) { if (retval != 0)
} else
u132_hcd_giveback_urb(u132, endp, urb, retval); u132_hcd_giveback_urb(u132, endp, urb, retval);
return; return;
} else { } else {
...@@ -1069,8 +1068,7 @@ static void u132_hcd_configure_setup_sent(void *data, struct urb *urb, u8 *buf, ...@@ -1069,8 +1068,7 @@ static void u132_hcd_configure_setup_sent(void *data, struct urb *urb, u8 *buf,
ring->number, endp, urb, address, ring->number, endp, urb, address,
endp->usb_endp, 0, endp->usb_endp, 0,
u132_hcd_configure_empty_recv); u132_hcd_configure_empty_recv);
if (retval == 0) { if (retval != 0)
} else
u132_hcd_giveback_urb(u132, endp, urb, retval); u132_hcd_giveback_urb(u132, endp, urb, retval);
return; return;
} }
...@@ -1155,8 +1153,7 @@ static void u132_hcd_enumeration_address_sent(void *data, struct urb *urb, ...@@ -1155,8 +1153,7 @@ static void u132_hcd_enumeration_address_sent(void *data, struct urb *urb,
retval = usb_ftdi_elan_edset_input(u132->platform_dev, retval = usb_ftdi_elan_edset_input(u132->platform_dev,
ring->number, endp, urb, 0, endp->usb_endp, 0, ring->number, endp, urb, 0, endp->usb_endp, 0,
u132_hcd_enumeration_empty_recv); u132_hcd_enumeration_empty_recv);
if (retval == 0) { if (retval != 0)
} else
u132_hcd_giveback_urb(u132, endp, urb, retval); u132_hcd_giveback_urb(u132, endp, urb, retval);
return; return;
} else { } else {
...@@ -1236,16 +1233,16 @@ static void u132_hcd_initial_input_recv(void *data, struct urb *urb, u8 *buf, ...@@ -1236,16 +1233,16 @@ static void u132_hcd_initial_input_recv(void *data, struct urb *urb, u8 *buf,
u8 *u = urb->transfer_buffer; u8 *u = urb->transfer_buffer;
u8 *b = buf; u8 *b = buf;
int L = len; int L = len;
while (L-- > 0) {
while (L-- > 0)
*u++ = *b++; *u++ = *b++;
}
urb->actual_length = len; urb->actual_length = len;
up(&u132->scheduler_lock); up(&u132->scheduler_lock);
retval = usb_ftdi_elan_edset_empty(u132->platform_dev, retval = usb_ftdi_elan_edset_empty(u132->platform_dev,
ring->number, endp, urb, address, endp->usb_endp, 0x3, ring->number, endp, urb, address, endp->usb_endp, 0x3,
u132_hcd_initial_empty_sent); u132_hcd_initial_empty_sent);
if (retval == 0) { if (retval != 0)
} else
u132_hcd_giveback_urb(u132, endp, urb, retval); u132_hcd_giveback_urb(u132, endp, urb, retval);
return; return;
} else { } else {
...@@ -1289,8 +1286,7 @@ static void u132_hcd_initial_setup_sent(void *data, struct urb *urb, u8 *buf, ...@@ -1289,8 +1286,7 @@ static void u132_hcd_initial_setup_sent(void *data, struct urb *urb, u8 *buf,
retval = usb_ftdi_elan_edset_input(u132->platform_dev, retval = usb_ftdi_elan_edset_input(u132->platform_dev,
ring->number, endp, urb, address, endp->usb_endp, 0, ring->number, endp, urb, address, endp->usb_endp, 0,
u132_hcd_initial_input_recv); u132_hcd_initial_input_recv);
if (retval == 0) { if (retval != 0)
} else
u132_hcd_giveback_urb(u132, endp, urb, retval); u132_hcd_giveback_urb(u132, endp, urb, retval);
return; return;
} else { } else {
...@@ -1412,8 +1408,7 @@ static void u132_hcd_endp_work_scheduler(struct work_struct *work) ...@@ -1412,8 +1408,7 @@ static void u132_hcd_endp_work_scheduler(struct work_struct *work)
up(&u132->scheduler_lock); up(&u132->scheduler_lock);
retval = edset_single(u132, ring, endp, urb, address, retval = edset_single(u132, ring, endp, urb, address,
endp->toggle_bits, u132_hcd_interrupt_recv); endp->toggle_bits, u132_hcd_interrupt_recv);
if (retval == 0) { if (retval != 0)
} else
u132_hcd_giveback_urb(u132, endp, urb, retval); u132_hcd_giveback_urb(u132, endp, urb, retval);
return; return;
} }
...@@ -1433,8 +1428,7 @@ static void u132_hcd_endp_work_scheduler(struct work_struct *work) ...@@ -1433,8 +1428,7 @@ static void u132_hcd_endp_work_scheduler(struct work_struct *work)
up(&u132->scheduler_lock); up(&u132->scheduler_lock);
retval = edset_setup(u132, ring, endp, urb, address, retval = edset_setup(u132, ring, endp, urb, address,
0x2, u132_hcd_initial_setup_sent); 0x2, u132_hcd_initial_setup_sent);
if (retval == 0) { if (retval != 0)
} else
u132_hcd_giveback_urb(u132, endp, urb, retval); u132_hcd_giveback_urb(u132, endp, urb, retval);
return; return;
} else if (endp->usb_addr == 0) { } else if (endp->usb_addr == 0) {
...@@ -1447,8 +1441,7 @@ static void u132_hcd_endp_work_scheduler(struct work_struct *work) ...@@ -1447,8 +1441,7 @@ static void u132_hcd_endp_work_scheduler(struct work_struct *work)
up(&u132->scheduler_lock); up(&u132->scheduler_lock);
retval = edset_setup(u132, ring, endp, urb, 0, 0x2, retval = edset_setup(u132, ring, endp, urb, 0, 0x2,
u132_hcd_enumeration_address_sent); u132_hcd_enumeration_address_sent);
if (retval == 0) { if (retval != 0)
} else
u132_hcd_giveback_urb(u132, endp, urb, retval); u132_hcd_giveback_urb(u132, endp, urb, retval);
return; return;
} else { } else {
...@@ -1462,8 +1455,7 @@ static void u132_hcd_endp_work_scheduler(struct work_struct *work) ...@@ -1462,8 +1455,7 @@ static void u132_hcd_endp_work_scheduler(struct work_struct *work)
up(&u132->scheduler_lock); up(&u132->scheduler_lock);
retval = edset_setup(u132, ring, endp, urb, address, retval = edset_setup(u132, ring, endp, urb, address,
0x2, u132_hcd_configure_setup_sent); 0x2, u132_hcd_configure_setup_sent);
if (retval == 0) { if (retval != 0)
} else
u132_hcd_giveback_urb(u132, endp, urb, retval); u132_hcd_giveback_urb(u132, endp, urb, retval);
return; return;
} }
...@@ -1555,7 +1547,7 @@ static int u132_periodic_reinit(struct u132 *u132) ...@@ -1555,7 +1547,7 @@ static int u132_periodic_reinit(struct u132 *u132)
if (retval) if (retval)
return retval; return retval;
retval = u132_write_pcimem(u132, periodicstart, retval = u132_write_pcimem(u132, periodicstart,
((9 *fi) / 10) & 0x3fff); ((9 * fi) / 10) & 0x3fff);
if (retval) if (retval)
return retval; return retval;
return 0; return 0;
...@@ -1598,9 +1590,9 @@ static int u132_init(struct u132 *u132) ...@@ -1598,9 +1590,9 @@ static int u132_init(struct u132 *u132)
if (retval) if (retval)
return retval; return retval;
} }
if (u132->num_ports > MAX_U132_PORTS) { if (u132->num_ports > MAX_U132_PORTS)
return -EINVAL; return -EINVAL;
}
return 0; return 0;
} }
...@@ -1629,8 +1621,6 @@ static int u132_run(struct u132 *u132) ...@@ -1629,8 +1621,6 @@ static int u132_run(struct u132 *u132)
if (retval) if (retval)
return retval; return retval;
u132->hc_fminterval = temp & 0x3fff; u132->hc_fminterval = temp & 0x3fff;
if (u132->hc_fminterval != FI) {
}
u132->hc_fminterval |= FSMP(u132->hc_fminterval) << 16; u132->hc_fminterval |= FSMP(u132->hc_fminterval) << 16;
} }
retval = u132_read_pcimem(u132, control, &u132->hc_control); retval = u132_read_pcimem(u132, control, &u132->hc_control);
...@@ -1677,13 +1667,14 @@ static int u132_run(struct u132 *u132) ...@@ -1677,13 +1667,14 @@ static int u132_run(struct u132 *u132)
retval = u132_read_pcimem(u132, control, &control); retval = u132_read_pcimem(u132, control, &control);
if (retval) if (retval)
return retval; return retval;
retry:retval = u132_read_pcimem(u132, cmdstatus, &status); retry:
retval = u132_read_pcimem(u132, cmdstatus, &status);
if (retval) if (retval)
return retval; return retval;
retval = u132_write_pcimem(u132, cmdstatus, OHCI_HCR); retval = u132_write_pcimem(u132, cmdstatus, OHCI_HCR);
if (retval) if (retval)
return retval; return retval;
extra:{ extra: {
retval = u132_read_pcimem(u132, cmdstatus, &status); retval = u132_read_pcimem(u132, cmdstatus, &status);
if (retval) if (retval)
return retval; return retval;
...@@ -1882,9 +1873,8 @@ static int create_endpoint_and_queue_int(struct u132 *u132, ...@@ -1882,9 +1873,8 @@ static int create_endpoint_and_queue_int(struct u132 *u132,
u8 endp_number; u8 endp_number;
struct u132_endp *endp = kmalloc(sizeof(struct u132_endp), mem_flags); struct u132_endp *endp = kmalloc(sizeof(struct u132_endp), mem_flags);
if (!endp) { if (!endp)
return -ENOMEM; return -ENOMEM;
}
spin_lock_init(&endp->queue_lock.slock); spin_lock_init(&endp->queue_lock.slock);
spin_lock_irqsave(&endp->queue_lock.slock, irqs); spin_lock_irqsave(&endp->queue_lock.slock, irqs);
...@@ -1982,9 +1972,8 @@ static int create_endpoint_and_queue_bulk(struct u132 *u132, ...@@ -1982,9 +1972,8 @@ static int create_endpoint_and_queue_bulk(struct u132 *u132,
u8 endp_number; u8 endp_number;
struct u132_endp *endp = kmalloc(sizeof(struct u132_endp), mem_flags); struct u132_endp *endp = kmalloc(sizeof(struct u132_endp), mem_flags);
if (!endp) { if (!endp)
return -ENOMEM; return -ENOMEM;
}
spin_lock_init(&endp->queue_lock.slock); spin_lock_init(&endp->queue_lock.slock);
spin_lock_irqsave(&endp->queue_lock.slock, irqs); spin_lock_irqsave(&endp->queue_lock.slock, irqs);
...@@ -2079,9 +2068,8 @@ static int create_endpoint_and_queue_control(struct u132 *u132, ...@@ -2079,9 +2068,8 @@ static int create_endpoint_and_queue_control(struct u132 *u132,
u8 endp_number; u8 endp_number;
struct u132_endp *endp = kmalloc(sizeof(struct u132_endp), mem_flags); struct u132_endp *endp = kmalloc(sizeof(struct u132_endp), mem_flags);
if (!endp) { if (!endp)
return -ENOMEM; return -ENOMEM;
}
spin_lock_init(&endp->queue_lock.slock); spin_lock_init(&endp->queue_lock.slock);
spin_lock_irqsave(&endp->queue_lock.slock, irqs); spin_lock_irqsave(&endp->queue_lock.slock, irqs);
...@@ -2238,8 +2226,7 @@ static int queue_control_on_old_endpoint(struct u132 *u132, ...@@ -2238,8 +2226,7 @@ static int queue_control_on_old_endpoint(struct u132 *u132,
u8 address = u132->addr[usb_addr].address; u8 address = u132->addr[usb_addr].address;
struct u132_udev *udev = &u132->udev[address]; struct u132_udev *udev = &u132->udev[address];
urb->hcpriv = u132; urb->hcpriv = u132;
if (udev->enumeration == 2) { if (udev->enumeration != 2)
} else
udev->enumeration = 2; udev->enumeration = 2;
if (endp->queue_size++ < ENDP_QUEUE_SIZE) { if (endp->queue_size++ < ENDP_QUEUE_SIZE) {
endp->urb_list[ENDP_QUEUE_MASK & endp->queue_last++] = endp->urb_list[ENDP_QUEUE_MASK & endp->queue_last++] =
...@@ -2364,7 +2351,7 @@ static int u132_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, ...@@ -2364,7 +2351,7 @@ static int u132_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
u16 urb_size = 8; u16 urb_size = 8;
u8 *b = urb->setup_packet; u8 *b = urb->setup_packet;
int i = 0; int i = 0;
char data[30 *3 + 4]; char data[30 * 3 + 4];
char *d = data; char *d = data;
int m = (sizeof(data) - 1) / 3; int m = (sizeof(data) - 1) / 3;
int l = 0; int l = 0;
...@@ -2606,15 +2593,15 @@ static int u132_roothub_descriptor(struct u132 *u132, ...@@ -2606,15 +2593,15 @@ static int u132_roothub_descriptor(struct u132 *u132,
desc->bHubContrCurrent = 0; desc->bHubContrCurrent = 0;
desc->bNbrPorts = u132->num_ports; desc->bNbrPorts = u132->num_ports;
temp = 1 + (u132->num_ports / 8); temp = 1 + (u132->num_ports / 8);
desc->bDescLength = 7 + 2 *temp; desc->bDescLength = 7 + 2 * temp;
temp = 0; temp = 0;
if (rh_a & RH_A_NPS) if (rh_a & RH_A_NPS)
temp |= 0x0002; temp |= 0x0002;
if (rh_a & RH_A_PSM) if (rh_a & RH_A_PSM)
temp |= 0x0001; temp |= 0x0001;
if (rh_a & RH_A_NOCP) { if (rh_a & RH_A_NOCP)
temp |= 0x0010; temp |= 0x0010;
} else if (rh_a & RH_A_OCPM) else if (rh_a & RH_A_OCPM)
temp |= 0x0008; temp |= 0x0008;
desc->wHubCharacteristics = cpu_to_le16(temp); desc->wHubCharacteristics = cpu_to_le16(temp);
retval = u132_read_pcimem(u132, roothub.b, &rh_b); retval = u132_read_pcimem(u132, roothub.b, &rh_b);
...@@ -2680,9 +2667,9 @@ static int u132_roothub_portreset(struct u132 *u132, int port_index) ...@@ -2680,9 +2667,9 @@ static int u132_roothub_portreset(struct u132 *u132, int port_index)
roothub.portstatus[port_index], &portstat); roothub.portstatus[port_index], &portstat);
if (retval) if (retval)
return retval; return retval;
if (RH_PS_PRS & portstat) { if (RH_PS_PRS & portstat)
continue; continue;
} else else
break; break;
} while (tick_before(now, reset_done)); } while (tick_before(now, reset_done));
if (RH_PS_PRS & portstat) if (RH_PS_PRS & portstat)
...@@ -2820,9 +2807,9 @@ static int u132_hub_status_data(struct usb_hcd *hcd, char *buf) ...@@ -2820,9 +2807,9 @@ static int u132_hub_status_data(struct usb_hcd *hcd, char *buf)
goto done; goto done;
} }
} }
if (u132->hc_roothub_status & (RH_HS_LPSC | RH_HS_OCIC)) { if (u132->hc_roothub_status & (RH_HS_LPSC | RH_HS_OCIC))
buf[0] = changed = 1; buf[0] = changed = 1;
} else else
buf[0] = 0; buf[0] = 0;
if (u132->num_ports > 7) { if (u132->num_ports > 7) {
buf[1] = 0; buf[1] = 0;
...@@ -2833,20 +2820,20 @@ static int u132_hub_status_data(struct usb_hcd *hcd, char *buf) ...@@ -2833,20 +2820,20 @@ static int u132_hub_status_data(struct usb_hcd *hcd, char *buf)
RH_PS_PESC | RH_PS_PSSC | RH_PS_OCIC | RH_PS_PESC | RH_PS_PSSC | RH_PS_OCIC |
RH_PS_PRSC)) { RH_PS_PRSC)) {
changed = 1; changed = 1;
if (i < 7) { if (i < 7)
buf[0] |= 1 << (i + 1); buf[0] |= 1 << (i + 1);
} else else
buf[1] |= 1 << (i - 7); buf[1] |= 1 << (i - 7);
continue; continue;
} }
if (!(u132->hc_roothub_portstatus[i] & RH_PS_CCS)) { if (!(u132->hc_roothub_portstatus[i] & RH_PS_CCS))
continue; continue;
}
if ((u132->hc_roothub_portstatus[i] & RH_PS_PSS)) { if ((u132->hc_roothub_portstatus[i] & RH_PS_PSS))
continue; continue;
} }
} done:
done:return changed ? length : 0; return changed ? length : 0;
} }
} }
...@@ -2920,10 +2907,12 @@ static int u132_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, ...@@ -2920,10 +2907,12 @@ static int u132_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
} }
default: default:
goto stall; goto stall;
error:u132_disable(u132); error:
u132_disable(u132);
u132->going = 1; u132->going = 1;
break; break;
stall:retval = -EPIPE; stall:
retval = -EPIPE;
break; break;
} }
mutex_unlock(&u132->sw_lock); mutex_unlock(&u132->sw_lock);
...@@ -3105,7 +3094,8 @@ static void u132_initialise(struct u132 *u132, struct platform_device *pdev) ...@@ -3105,7 +3094,8 @@ static void u132_initialise(struct u132 *u132, struct platform_device *pdev)
ring->curr_endp = NULL; ring->curr_endp = NULL;
INIT_DELAYED_WORK(&ring->scheduler, INIT_DELAYED_WORK(&ring->scheduler,
u132_hcd_ring_work_scheduler); u132_hcd_ring_work_scheduler);
} mutex_lock(&u132->sw_lock); }
mutex_lock(&u132->sw_lock);
INIT_DELAYED_WORK(&u132->monitor, u132_hcd_monitor_work); INIT_DELAYED_WORK(&u132->monitor, u132_hcd_monitor_work);
while (ports-- > 0) { while (ports-- > 0) {
struct u132_port *port = &u132->port[ports]; struct u132_port *port = &u132->port[ports];
...@@ -3114,10 +3104,12 @@ static void u132_initialise(struct u132 *u132, struct platform_device *pdev) ...@@ -3114,10 +3104,12 @@ static void u132_initialise(struct u132 *u132, struct platform_device *pdev)
port->enable = 0; port->enable = 0;
port->power = 0; port->power = 0;
port->Status = 0; port->Status = 0;
} while (addrs-- > 0) { }
while (addrs-- > 0) {
struct u132_addr *addr = &u132->addr[addrs]; struct u132_addr *addr = &u132->addr[addrs];
addr->address = 0; addr->address = 0;
} while (udevs-- > 0) { }
while (udevs-- > 0) {
struct u132_udev *udev = &u132->udev[udevs]; struct u132_udev *udev = &u132->udev[udevs];
int i = ARRAY_SIZE(udev->endp_number_in); int i = ARRAY_SIZE(udev->endp_number_in);
int o = ARRAY_SIZE(udev->endp_number_out); int o = ARRAY_SIZE(udev->endp_number_out);
...@@ -3125,16 +3117,16 @@ static void u132_initialise(struct u132 *u132, struct platform_device *pdev) ...@@ -3125,16 +3117,16 @@ static void u132_initialise(struct u132 *u132, struct platform_device *pdev)
udev->udev_number = 0; udev->udev_number = 0;
udev->usb_addr = 0; udev->usb_addr = 0;
udev->portnumber = 0; udev->portnumber = 0;
while (i-- > 0) { while (i-- > 0)
udev->endp_number_in[i] = 0; udev->endp_number_in[i] = 0;
}
while (o-- > 0) { while (o-- > 0)
udev->endp_number_out[o] = 0; udev->endp_number_out[o] = 0;
} }
} while (endps-- > 0)
while (endps-- > 0) {
u132->endp[endps] = NULL; u132->endp[endps] = NULL;
}
mutex_unlock(&u132->sw_lock); mutex_unlock(&u132->sw_lock);
return; return;
} }
...@@ -3146,10 +3138,11 @@ static int __devinit u132_probe(struct platform_device *pdev) ...@@ -3146,10 +3138,11 @@ static int __devinit u132_probe(struct platform_device *pdev)
u32 control; u32 control;
u32 rh_a = -1; u32 rh_a = -1;
u32 num_ports; u32 num_ports;
msleep(100); msleep(100);
if (u132_exiting > 0) { if (u132_exiting > 0)
return -ENODEV; return -ENODEV;
}
retval = ftdi_write_pcimem(pdev, intrdisable, OHCI_INTR_MIE); retval = ftdi_write_pcimem(pdev, intrdisable, OHCI_INTR_MIE);
if (retval) if (retval)
return retval; return retval;
...@@ -3160,9 +3153,9 @@ static int __devinit u132_probe(struct platform_device *pdev) ...@@ -3160,9 +3153,9 @@ static int __devinit u132_probe(struct platform_device *pdev)
if (retval) if (retval)
return retval; return retval;
num_ports = rh_a & RH_A_NDP; /* refuse to confuse usbcore */ num_ports = rh_a & RH_A_NDP; /* refuse to confuse usbcore */
if (pdev->dev.dma_mask) { if (pdev->dev.dma_mask)
return -EINVAL; return -EINVAL;
}
hcd = usb_create_hcd(&u132_hc_driver, &pdev->dev, pdev->dev.bus_id); hcd = usb_create_hcd(&u132_hc_driver, &pdev->dev, pdev->dev.bus_id);
if (!hcd) { if (!hcd) {
printk(KERN_ERR "failed to create the usb hcd struct for U132\n" printk(KERN_ERR "failed to create the usb hcd struct for U132\n"
...@@ -3301,7 +3294,8 @@ static void __exit u132_hcd_exit(void) ...@@ -3301,7 +3294,8 @@ static void __exit u132_hcd_exit(void)
mutex_unlock(&u132_module_lock); mutex_unlock(&u132_module_lock);
list_for_each_entry_safe(u132, temp, &u132_static_list, u132_list) { list_for_each_entry_safe(u132, temp, &u132_static_list, u132_list) {
platform_device_unregister(u132->platform_dev); platform_device_unregister(u132->platform_dev);
} platform_driver_unregister(&u132_platform_driver); }
platform_driver_unregister(&u132_platform_driver);
printk(KERN_INFO "u132-hcd driver deregistered\n"); printk(KERN_INFO "u132-hcd driver deregistered\n");
wait_event(u132_hcd_wait, u132_instances == 0); wait_event(u132_hcd_wait, u132_instances == 0);
flush_workqueue(workqueue); flush_workqueue(workqueue);
......
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