Commit cf81f1c2 authored by Johannes Erdfelt's avatar Johannes Erdfelt Committed by Greg Kroah-Hartman

[PATCH] uhci.c cleanup

This patch merely cleans up the code a little and doesn't fix any bugs.
It makes a couple of code paths a bit easier to understand, removes an
unused variable (uhci_list) and some procfs variables when not using
procfs.
parent 89e62afe
...@@ -1631,8 +1631,7 @@ static void uhci_transfer_result(struct uhci *uhci, struct urb *urb) ...@@ -1631,8 +1631,7 @@ static void uhci_transfer_result(struct uhci *uhci, struct urb *urb)
if (urb->status != -EINPROGRESS) { if (urb->status != -EINPROGRESS) {
info("uhci_transfer_result: called for URB %p not in flight?", urb); info("uhci_transfer_result: called for URB %p not in flight?", urb);
spin_unlock_irqrestore(&urb->lock, flags); goto out;
return;
} }
switch (usb_pipetype(urb->pipe)) { switch (usb_pipetype(urb->pipe)) {
...@@ -1652,10 +1651,8 @@ static void uhci_transfer_result(struct uhci *uhci, struct urb *urb) ...@@ -1652,10 +1651,8 @@ static void uhci_transfer_result(struct uhci *uhci, struct urb *urb)
urbp->status = ret; urbp->status = ret;
if (ret == -EINPROGRESS) { if (ret == -EINPROGRESS)
spin_unlock_irqrestore(&urb->lock, flags); goto out;
return;
}
switch (usb_pipetype(urb->pipe)) { switch (usb_pipetype(urb->pipe)) {
case PIPE_CONTROL: case PIPE_CONTROL:
...@@ -1669,11 +1666,8 @@ static void uhci_transfer_result(struct uhci *uhci, struct urb *urb) ...@@ -1669,11 +1666,8 @@ static void uhci_transfer_result(struct uhci *uhci, struct urb *urb)
break; break;
case PIPE_INTERRUPT: case PIPE_INTERRUPT:
/* Interrupts are an exception */ /* Interrupts are an exception */
if (urb->interval) { if (urb->interval)
uhci_add_complete(urb); goto out_complete;
spin_unlock_irqrestore(&urb->lock, flags);
return; /* <-- note return */
}
/* Release bandwidth for Interrupt or Isoc. transfers */ /* Release bandwidth for Interrupt or Isoc. transfers */
/* Spinlock needed ? */ /* Spinlock needed ? */
...@@ -1689,8 +1683,10 @@ static void uhci_transfer_result(struct uhci *uhci, struct urb *urb) ...@@ -1689,8 +1683,10 @@ static void uhci_transfer_result(struct uhci *uhci, struct urb *urb)
/* Remove it from uhci->urb_list */ /* Remove it from uhci->urb_list */
list_del_init(&urb->urb_list); list_del_init(&urb->urb_list);
out_complete:
uhci_add_complete(urb); uhci_add_complete(urb);
out:
spin_unlock_irqrestore(&urb->lock, flags); spin_unlock_irqrestore(&urb->lock, flags);
} }
...@@ -2724,6 +2720,7 @@ static int alloc_uhci(struct pci_dev *dev, unsigned int io_addr, unsigned int io ...@@ -2724,6 +2720,7 @@ static int alloc_uhci(struct pci_dev *dev, unsigned int io_addr, unsigned int io
} }
uhci->dev = dev; uhci->dev = dev;
uhci->irq = dev->irq;
uhci->io_addr = io_addr; uhci->io_addr = io_addr;
uhci->io_size = io_size; uhci->io_size = io_size;
pci_set_drvdata(dev, uhci); pci_set_drvdata(dev, uhci);
...@@ -2932,8 +2929,6 @@ static int alloc_uhci(struct pci_dev *dev, unsigned int io_addr, unsigned int io ...@@ -2932,8 +2929,6 @@ static int alloc_uhci(struct pci_dev *dev, unsigned int io_addr, unsigned int io
if (request_irq(dev->irq, uhci_interrupt, SA_SHIRQ, "usb-uhci", uhci)) if (request_irq(dev->irq, uhci_interrupt, SA_SHIRQ, "usb-uhci", uhci))
goto err_request_irq; goto err_request_irq;
uhci->irq = dev->irq;
/* disable legacy emulation */ /* disable legacy emulation */
pci_write_config_word(uhci->dev, USBLEGSUP, USBLEGSUP_DEFAULT); pci_write_config_word(uhci->dev, USBLEGSUP, USBLEGSUP_DEFAULT);
......
...@@ -287,17 +287,17 @@ struct virt_root_hub { ...@@ -287,17 +287,17 @@ struct virt_root_hub {
struct uhci { struct uhci {
struct pci_dev *dev; struct pci_dev *dev;
#ifdef CONFIG_PROC_FS
/* procfs */ /* procfs */
int num; int num;
struct proc_dir_entry *proc_entry; struct proc_dir_entry *proc_entry;
#endif
/* Grabbed from PCI */ /* Grabbed from PCI */
int irq; int irq;
unsigned int io_addr; unsigned int io_addr;
unsigned int io_size; unsigned int io_size;
struct list_head uhci_list;
struct pci_pool *qh_pool; struct pci_pool *qh_pool;
struct pci_pool *td_pool; struct pci_pool *td_pool;
......
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