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>
This commit is contained in:
@@ -253,7 +253,6 @@ static inline struct fw_ohci *fw_ohci(struct fw_card *card)
|
|||||||
#define OHCI1394_MAX_PHYS_RESP_RETRIES 0x8
|
#define OHCI1394_MAX_PHYS_RESP_RETRIES 0x8
|
||||||
|
|
||||||
#define OHCI1394_REGISTER_SIZE 0x800
|
#define OHCI1394_REGISTER_SIZE 0x800
|
||||||
#define OHCI_LOOP_COUNT 500
|
|
||||||
#define OHCI1394_PCI_HCI_Control 0x40
|
#define OHCI1394_PCI_HCI_Control 0x40
|
||||||
#define SELF_ID_BUF_SIZE 0x800
|
#define SELF_ID_BUF_SIZE 0x800
|
||||||
#define OHCI_TCODE_PHY_PACKET 0x0e
|
#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)
|
static int software_reset(struct fw_ohci *ohci)
|
||||||
{
|
{
|
||||||
|
u32 val;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
reg_write(ohci, OHCI1394_HCControlSet, OHCI1394_HCControl_softReset);
|
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 (!(val & OHCI1394_HCControl_softReset))
|
||||||
if ((reg_read(ohci, OHCI1394_HCControlSet) &
|
|
||||||
OHCI1394_HCControl_softReset) == 0)
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
msleep(1);
|
msleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user