Commit e13246e0 authored by Nishanth Aravamudan's avatar Nishanth Aravamudan Committed by Linus Torvalds

[PATCH] macintosh/mediabay: replace schedule_timeout() with msleep()

Use msleep() instead of schedule_timeout() to guarantee the task delays the
desired time.
Signed-off-by: default avatarNishanth Aravamudan <nacc@us.ibm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 8f4a5aba
...@@ -686,15 +686,13 @@ static int __devinit media_bay_attach(struct macio_dev *mdev, const struct of_ma ...@@ -686,15 +686,13 @@ static int __devinit media_bay_attach(struct macio_dev *mdev, const struct of_ma
/* Force an immediate detect */ /* Force an immediate detect */
set_mb_power(bay, 0); set_mb_power(bay, 0);
set_current_state(TASK_UNINTERRUPTIBLE); msleep(MB_POWER_DELAY);
schedule_timeout(MS_TO_HZ(MB_POWER_DELAY));
bay->content_id = MB_NO; bay->content_id = MB_NO;
bay->last_value = bay->ops->content(bay); bay->last_value = bay->ops->content(bay);
bay->value_count = MS_TO_HZ(MB_STABLE_DELAY); bay->value_count = MS_TO_HZ(MB_STABLE_DELAY);
bay->state = mb_empty; bay->state = mb_empty;
do { do {
set_current_state(TASK_UNINTERRUPTIBLE); msleep(MB_POLL_DELAY);
schedule_timeout(MS_TO_HZ(MB_POLL_DELAY));
media_bay_step(i); media_bay_step(i);
} while((bay->state != mb_empty) && } while((bay->state != mb_empty) &&
(bay->state != mb_up)); (bay->state != mb_up));
...@@ -719,8 +717,7 @@ static int __pmac media_bay_suspend(struct macio_dev *mdev, u32 state) ...@@ -719,8 +717,7 @@ static int __pmac media_bay_suspend(struct macio_dev *mdev, u32 state)
bay->sleeping = 1; bay->sleeping = 1;
set_mb_power(bay, 0); set_mb_power(bay, 0);
up(&bay->lock); up(&bay->lock);
set_current_state(TASK_UNINTERRUPTIBLE); msleep(MB_POLL_DELAY);
schedule_timeout(MS_TO_HZ(MB_POLL_DELAY));
mdev->ofdev.dev.power_state = state; mdev->ofdev.dev.power_state = state;
} }
return 0; return 0;
...@@ -740,8 +737,7 @@ static int __pmac media_bay_resume(struct macio_dev *mdev) ...@@ -740,8 +737,7 @@ static int __pmac media_bay_resume(struct macio_dev *mdev)
/* Force MB power to 0 */ /* Force MB power to 0 */
down(&bay->lock); down(&bay->lock);
set_mb_power(bay, 0); set_mb_power(bay, 0);
set_current_state(TASK_UNINTERRUPTIBLE); msleep(MB_POWER_DELAY);
schedule_timeout(MS_TO_HZ(MB_POWER_DELAY));
if (bay->ops->content(bay) != bay->content_id) { if (bay->ops->content(bay) != bay->content_id) {
printk("mediabay%d: content changed during sleep...\n", bay->index); printk("mediabay%d: content changed during sleep...\n", bay->index);
up(&bay->lock); up(&bay->lock);
...@@ -755,8 +751,7 @@ static int __pmac media_bay_resume(struct macio_dev *mdev) ...@@ -755,8 +751,7 @@ static int __pmac media_bay_resume(struct macio_dev *mdev)
bay->cd_retry = 0; bay->cd_retry = 0;
#endif #endif
do { do {
set_current_state(TASK_UNINTERRUPTIBLE); msleep(MB_POLL_DELAY);
schedule_timeout(MS_TO_HZ(MB_POLL_DELAY));
media_bay_step(bay->index); media_bay_step(bay->index);
} while((bay->state != mb_empty) && } while((bay->state != mb_empty) &&
(bay->state != mb_up)); (bay->state != mb_up));
......
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