Commit e521dca6 authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Linus Torvalds

[PATCH] ppc32: Fix might_sleep() warning with clock spreading

The clock spreading disable/enable code was called to late/early during
the suspend/resume code on some laptops and would trigger a
might_sleep() warning due to the down() call in the low level i2c code.

This fixes it by calling those functions earlier/later when interrupts
are still enabled.
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 6995f17a
...@@ -1591,8 +1591,10 @@ intrepid_shutdown(struct macio_chip* macio, int sleep_mode) ...@@ -1591,8 +1591,10 @@ intrepid_shutdown(struct macio_chip* macio, int sleep_mode)
} }
static void __pmac pmac_tweak_clock_spreading(struct macio_chip* macio, int enable) void __pmac pmac_tweak_clock_spreading(int enable)
{ {
struct macio_chip* macio = &macio_chips[0];
/* Hack for doing clock spreading on some machines PowerBooks and /* Hack for doing clock spreading on some machines PowerBooks and
* iBooks. This implements the "platform-do-clockspreading" OF * iBooks. This implements the "platform-do-clockspreading" OF
* property as decoded manually on various models. For safety, we also * property as decoded manually on various models. For safety, we also
...@@ -1707,9 +1709,6 @@ core99_sleep(void) ...@@ -1707,9 +1709,6 @@ core99_sleep(void)
macio->type != macio_intrepid) macio->type != macio_intrepid)
return -ENODEV; return -ENODEV;
/* Disable clock spreading */
pmac_tweak_clock_spreading(macio, 0);
/* We power off the wireless slot in case it was not done /* We power off the wireless slot in case it was not done
* by the driver. We don't power it on automatically however * by the driver. We don't power it on automatically however
*/ */
...@@ -1852,9 +1851,6 @@ core99_wake_up(void) ...@@ -1852,9 +1851,6 @@ core99_wake_up(void)
UN_OUT(UNI_N_CLOCK_CNTL, save_unin_clock_ctl); UN_OUT(UNI_N_CLOCK_CNTL, save_unin_clock_ctl);
udelay(100); udelay(100);
/* Enable clock spreading */
pmac_tweak_clock_spreading(macio, 1);
return 0; return 0;
} }
...@@ -2822,7 +2818,7 @@ set_initial_features(void) ...@@ -2822,7 +2818,7 @@ set_initial_features(void)
* clock spreading now. This should be a platform function but we * clock spreading now. This should be a platform function but we
* don't do these at the moment * don't do these at the moment
*/ */
pmac_tweak_clock_spreading(&macio_chips[0], 1); pmac_tweak_clock_spreading(1);
#endif /* CONFIG_POWER4 */ #endif /* CONFIG_POWER4 */
......
...@@ -2351,6 +2351,10 @@ pmac_suspend_devices(void) ...@@ -2351,6 +2351,10 @@ pmac_suspend_devices(void)
return -EBUSY; return -EBUSY;
} }
/* Disable clock spreading on some machines */
pmac_tweak_clock_spreading(0);
/* Stop preemption */
preempt_disable(); preempt_disable();
/* Make sure the decrementer won't interrupt us */ /* Make sure the decrementer won't interrupt us */
...@@ -2417,11 +2421,12 @@ pmac_wakeup_devices(void) ...@@ -2417,11 +2421,12 @@ pmac_wakeup_devices(void)
/* Re-enable local CPU interrupts */ /* Re-enable local CPU interrupts */
local_irq_enable(); local_irq_enable();
mdelay(100); mdelay(100);
preempt_enable(); preempt_enable();
/* Re-enable clock spreading on some machines */
pmac_tweak_clock_spreading(1);
/* Resume devices */ /* Resume devices */
device_resume(); device_resume();
......
...@@ -316,6 +316,9 @@ extern void pmac_register_agp_pm(struct pci_dev *bridge, ...@@ -316,6 +316,9 @@ extern void pmac_register_agp_pm(struct pci_dev *bridge,
extern void pmac_suspend_agp_for_card(struct pci_dev *dev); extern void pmac_suspend_agp_for_card(struct pci_dev *dev);
extern void pmac_resume_agp_for_card(struct pci_dev *dev); extern void pmac_resume_agp_for_card(struct pci_dev *dev);
/* Used by the via-pmu driver for suspend/resume
*/
extern void pmac_tweak_clock_spreading(int enable);
/* /*
* The part below is for use by macio_asic.c only, do not rely * The part below is for use by macio_asic.c only, do not rely
......
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