diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2011-07-03 11:39:26 -0400 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2011-07-09 11:12:09 -0400 |
commit | 9f426173e54a4f0882f9516c226f3165a3bd5474 (patch) | |
tree | a34fc50c7f562eea8726b60c41744567396aa692 /drivers/firewire/ohci.c | |
parent | 215fa444c2a6d571f1f915cf3dc7a8b01cc51a0a (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/ohci.c')
-rw-r--r-- | drivers/firewire/ohci.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 448598876278..4f6d72f87f6f 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) | |||
253 | #define OHCI1394_MAX_PHYS_RESP_RETRIES 0x8 | 253 | #define OHCI1394_MAX_PHYS_RESP_RETRIES 0x8 |
254 | 254 | ||
255 | #define OHCI1394_REGISTER_SIZE 0x800 | 255 | #define OHCI1394_REGISTER_SIZE 0x800 |
256 | #define OHCI_LOOP_COUNT 500 | ||
257 | #define OHCI1394_PCI_HCI_Control 0x40 | 256 | #define OHCI1394_PCI_HCI_Control 0x40 |
258 | #define SELF_ID_BUF_SIZE 0x800 | 257 | #define SELF_ID_BUF_SIZE 0x800 |
259 | #define OHCI_TCODE_PHY_PACKET 0x0e | 258 | #define OHCI_TCODE_PHY_PACKET 0x0e |
@@ -1967,14 +1966,18 @@ static irqreturn_t irq_handler(int irq, void *data) | |||
1967 | 1966 | ||
1968 | static int software_reset(struct fw_ohci *ohci) | 1967 | static int software_reset(struct fw_ohci *ohci) |
1969 | { | 1968 | { |
1969 | u32 val; | ||
1970 | int i; | 1970 | int i; |
1971 | 1971 | ||
1972 | reg_write(ohci, OHCI1394_HCControlSet, OHCI1394_HCControl_softReset); | 1972 | reg_write(ohci, OHCI1394_HCControlSet, OHCI1394_HCControl_softReset); |
1973 | for (i = 0; i < 500; i++) { | ||
1974 | val = reg_read(ohci, OHCI1394_HCControlSet); | ||
1975 | if (!~val) | ||
1976 | return -ENODEV; /* Card was ejected. */ | ||
1973 | 1977 | ||
1974 | for (i = 0; i < OHCI_LOOP_COUNT; i++) { | 1978 | if (!(val & OHCI1394_HCControl_softReset)) |
1975 | if ((reg_read(ohci, OHCI1394_HCControlSet) & | ||
1976 | OHCI1394_HCControl_softReset) == 0) | ||
1977 | return 0; | 1979 | return 0; |
1980 | |||
1978 | msleep(1); | 1981 | msleep(1); |
1979 | } | 1982 | } |
1980 | 1983 | ||