aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/host/ehci-sched.c
diff options
context:
space:
mode:
authorKarsten Wiese <fzu@wemgehoertderstaat.de>2008-02-16 13:44:42 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2008-04-24 21:16:35 -0700
commitc765d4cad977f7e454a53d5bca5a942156b2d94c (patch)
treef73f80b89d96d5a05bed5d261ac0437b1b966b84 /drivers/usb/host/ehci-sched.c
parent96f9bc373c83a67922dc32f358e8a3b3dd4e18a0 (diff)
downloadlinux-stericsson-c765d4cad977f7e454a53d5bca5a942156b2d94c.tar.gz
USB: EHCI: Refactor "if (handshake()) state = HC_STATE_HALT"
Refactor the EHCI "if (handshake()) state = HC_STATE_HALT" idiom, which appears 4 times, by replacing it with calls to a new function called handshake_on_error_set_halt(). Saves a few bytes too. Signed-off-by: Karsten Wiese <fzu@wemgehoertderstaat.de> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/ehci-sched.c')
-rw-r--r--drivers/usb/host/ehci-sched.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index 8a8e08a51ba3..38c606c13db1 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -440,11 +440,10 @@ static int enable_periodic (struct ehci_hcd *ehci)
/* did clearing PSE did take effect yet?
* takes effect only at frame boundaries...
*/
- status = handshake(ehci, &ehci->regs->status, STS_PSS, 0, 9 * 125);
- if (status != 0) {
- ehci_to_hcd(ehci)->state = HC_STATE_HALT;
+ status = handshake_on_error_set_halt(ehci, &ehci->regs->status,
+ STS_PSS, 0, 9 * 125);
+ if (status)
return status;
- }
cmd = ehci_readl(ehci, &ehci->regs->command) | CMD_PSE;
ehci_writel(ehci, cmd, &ehci->regs->command);
@@ -465,11 +464,10 @@ static int disable_periodic (struct ehci_hcd *ehci)
/* did setting PSE not take effect yet?
* takes effect only at frame boundaries...
*/
- status = handshake(ehci, &ehci->regs->status, STS_PSS, STS_PSS, 9 * 125);
- if (status != 0) {
- ehci_to_hcd(ehci)->state = HC_STATE_HALT;
+ status = handshake_on_error_set_halt(ehci, &ehci->regs->status,
+ STS_PSS, STS_PSS, 9 * 125);
+ if (status)
return status;
- }
cmd = ehci_readl(ehci, &ehci->regs->command) & ~CMD_PSE;
ehci_writel(ehci, cmd, &ehci->regs->command);