diff options
author | Karsten Wiese <fzu@wemgehoertderstaat.de> | 2008-02-16 16:44:42 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-04-25 00:16:35 -0400 |
commit | c765d4cad977f7e454a53d5bca5a942156b2d94c (patch) | |
tree | f73f80b89d96d5a05bed5d261ac0437b1b966b84 /drivers/usb/host/ehci-sched.c | |
parent | 96f9bc373c83a67922dc32f358e8a3b3dd4e18a0 (diff) |
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.c | 14 |
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) | |||
440 | /* did clearing PSE did take effect yet? | 440 | /* did clearing PSE did take effect yet? |
441 | * takes effect only at frame boundaries... | 441 | * takes effect only at frame boundaries... |
442 | */ | 442 | */ |
443 | status = handshake(ehci, &ehci->regs->status, STS_PSS, 0, 9 * 125); | 443 | status = handshake_on_error_set_halt(ehci, &ehci->regs->status, |
444 | if (status != 0) { | 444 | STS_PSS, 0, 9 * 125); |
445 | ehci_to_hcd(ehci)->state = HC_STATE_HALT; | 445 | if (status) |
446 | return status; | 446 | return status; |
447 | } | ||
448 | 447 | ||
449 | cmd = ehci_readl(ehci, &ehci->regs->command) | CMD_PSE; | 448 | cmd = ehci_readl(ehci, &ehci->regs->command) | CMD_PSE; |
450 | ehci_writel(ehci, cmd, &ehci->regs->command); | 449 | ehci_writel(ehci, cmd, &ehci->regs->command); |
@@ -465,11 +464,10 @@ static int disable_periodic (struct ehci_hcd *ehci) | |||
465 | /* did setting PSE not take effect yet? | 464 | /* did setting PSE not take effect yet? |
466 | * takes effect only at frame boundaries... | 465 | * takes effect only at frame boundaries... |
467 | */ | 466 | */ |
468 | status = handshake(ehci, &ehci->regs->status, STS_PSS, STS_PSS, 9 * 125); | 467 | status = handshake_on_error_set_halt(ehci, &ehci->regs->status, |
469 | if (status != 0) { | 468 | STS_PSS, STS_PSS, 9 * 125); |
470 | ehci_to_hcd(ehci)->state = HC_STATE_HALT; | 469 | if (status) |
471 | return status; | 470 | return status; |
472 | } | ||
473 | 471 | ||
474 | cmd = ehci_readl(ehci, &ehci->regs->command) & ~CMD_PSE; | 472 | cmd = ehci_readl(ehci, &ehci->regs->command) & ~CMD_PSE; |
475 | ehci_writel(ehci, cmd, &ehci->regs->command); | 473 | ehci_writel(ehci, cmd, &ehci->regs->command); |