Commit b2063054 authored by Paul Mackerras's avatar Paul Mackerras Committed by Linus Torvalds

[PATCH] ppc64: replace schedule_timeout in iSeries_pci_reset

This patch is from Nishanth Aravamudan <nacc@us.ibm.com>.

Replace schedule_timeout() with msleep to simplify the code and to express the
delay in milliseconds instead of HZ.
Signed-off-by: default avatarNishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 6f86913c
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/delay.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/iSeries/HvCallPci.h> #include <asm/iSeries/HvCallPci.h>
...@@ -49,7 +50,7 @@ ...@@ -49,7 +50,7 @@
int iSeries_Device_ToggleReset(struct pci_dev *PciDev, int AssertTime, int iSeries_Device_ToggleReset(struct pci_dev *PciDev, int AssertTime,
int DelayTime) int DelayTime)
{ {
unsigned long AssertDelay, WaitDelay; unsigned int AssertDelay, WaitDelay;
struct iSeries_Device_Node *DeviceNode = struct iSeries_Device_Node *DeviceNode =
(struct iSeries_Device_Node *)PciDev->sysdata; (struct iSeries_Device_Node *)PciDev->sysdata;
...@@ -62,14 +63,14 @@ int iSeries_Device_ToggleReset(struct pci_dev *PciDev, int AssertTime, ...@@ -62,14 +63,14 @@ int iSeries_Device_ToggleReset(struct pci_dev *PciDev, int AssertTime,
* Set defaults, Assert is .5 second, Wait is 3 seconds. * Set defaults, Assert is .5 second, Wait is 3 seconds.
*/ */
if (AssertTime == 0) if (AssertTime == 0)
AssertDelay = (5 * HZ) / 10; AssertDelay = 500;
else else
AssertDelay = (AssertTime * HZ) / 10; AssertDelay = AssertTime * 100;
if (DelayTime == 0) if (DelayTime == 0)
WaitDelay = (30 * HZ) / 10; WaitDelay = 3000;
else else
WaitDelay = (DelayTime * HZ) / 10; WaitDelay = DelayTime * 100;
/* /*
* Assert reset * Assert reset
...@@ -77,8 +78,7 @@ int iSeries_Device_ToggleReset(struct pci_dev *PciDev, int AssertTime, ...@@ -77,8 +78,7 @@ int iSeries_Device_ToggleReset(struct pci_dev *PciDev, int AssertTime,
DeviceNode->ReturnCode = HvCallPci_setSlotReset(ISERIES_BUS(DeviceNode), DeviceNode->ReturnCode = HvCallPci_setSlotReset(ISERIES_BUS(DeviceNode),
0x00, DeviceNode->AgentId, 1); 0x00, DeviceNode->AgentId, 1);
if (DeviceNode->ReturnCode == 0) { if (DeviceNode->ReturnCode == 0) {
set_current_state(TASK_UNINTERRUPTIBLE); msleep(AssertDelay); /* Sleep for the time */
schedule_timeout(AssertDelay); /* Sleep for the time */
DeviceNode->ReturnCode = DeviceNode->ReturnCode =
HvCallPci_setSlotReset(ISERIES_BUS(DeviceNode), HvCallPci_setSlotReset(ISERIES_BUS(DeviceNode),
0x00, DeviceNode->AgentId, 0); 0x00, DeviceNode->AgentId, 0);
...@@ -86,8 +86,7 @@ int iSeries_Device_ToggleReset(struct pci_dev *PciDev, int AssertTime, ...@@ -86,8 +86,7 @@ int iSeries_Device_ToggleReset(struct pci_dev *PciDev, int AssertTime,
/* /*
* Wait for device to reset * Wait for device to reset
*/ */
set_current_state(TASK_UNINTERRUPTIBLE); msleep(WaitDelay);
schedule_timeout(WaitDelay);
} }
if (DeviceNode->ReturnCode == 0) if (DeviceNode->ReturnCode == 0)
PCIFR("Slot 0x%04X.%02 Reset\n", ISERIES_BUS(DeviceNode), PCIFR("Slot 0x%04X.%02 Reset\n", ISERIES_BUS(DeviceNode),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment