aboutsummaryrefslogtreecommitdiff
path: root/drivers/firewire
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2011-07-03 17:39:26 +0200
committerStefan Richter <stefanr@s5r6.in-berlin.de>2011-07-09 17:12:09 +0200
commit9f426173e54a4f0882f9516c226f3165a3bd5474 (patch)
treea34fc50c7f562eea8726b60c41744567396aa692 /drivers/firewire
parent215fa444c2a6d571f1f915cf3dc7a8b01cc51a0a (diff)
firewire: ohci: skip soft reset retries after card ejection
The software reset in firewire-ohci's pci_remove does not have a great prospect of success if the card was already physically removed at this point. So let's skip the 500 ms that were spent in retries here. Also, replace a defined constant by its open-coded value. This is not a constant from a specification but an arbitrarily chosen retry limit. It was only used in this single place. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire')
-rw-r--r--drivers/firewire/ohci.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
index 44859887627..4f6d72f87f6 100644
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -253,7 +253,6 @@ static inline struct fw_ohci *fw_ohci(struct fw_card *card)
#define OHCI1394_MAX_PHYS_RESP_RETRIES 0x8
#define OHCI1394_REGISTER_SIZE 0x800
-#define OHCI_LOOP_COUNT 500
#define OHCI1394_PCI_HCI_Control 0x40
#define SELF_ID_BUF_SIZE 0x800
#define OHCI_TCODE_PHY_PACKET 0x0e
@@ -1967,14 +1966,18 @@ static irqreturn_t irq_handler(int irq, void *data)
static int software_reset(struct fw_ohci *ohci)
{
+ u32 val;
int i;
reg_write(ohci, OHCI1394_HCControlSet, OHCI1394_HCControl_softReset);
+ for (i = 0; i < 500; i++) {
+ val = reg_read(ohci, OHCI1394_HCControlSet);
+ if (!~val)
+ return -ENODEV; /* Card was ejected. */
- for (i = 0; i < OHCI_LOOP_COUNT; i++) {
- if ((reg_read(ohci, OHCI1394_HCControlSet) &
- OHCI1394_HCControl_softReset) == 0)
+ if (!(val & OHCI1394_HCControl_softReset))
return 0;
+
msleep(1);
}