Commit e521dca64e0f82d844928c5ee88d82fdced50cbe
Committed by
Linus Torvalds
1 parent
6995f17a5a
Exists in
master
and in
7 other branches
[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: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing 3 changed files with 14 additions and 10 deletions Side-by-side Diff
arch/ppc/platforms/pmac_feature.c
... | ... | @@ -1591,8 +1591,10 @@ |
1591 | 1591 | } |
1592 | 1592 | |
1593 | 1593 | |
1594 | -static void __pmac pmac_tweak_clock_spreading(struct macio_chip* macio, int enable) | |
1594 | +void __pmac pmac_tweak_clock_spreading(int enable) | |
1595 | 1595 | { |
1596 | + struct macio_chip* macio = &macio_chips[0]; | |
1597 | + | |
1596 | 1598 | /* Hack for doing clock spreading on some machines PowerBooks and |
1597 | 1599 | * iBooks. This implements the "platform-do-clockspreading" OF |
1598 | 1600 | * property as decoded manually on various models. For safety, we also |
... | ... | @@ -1707,9 +1709,6 @@ |
1707 | 1709 | macio->type != macio_intrepid) |
1708 | 1710 | return -ENODEV; |
1709 | 1711 | |
1710 | - /* Disable clock spreading */ | |
1711 | - pmac_tweak_clock_spreading(macio, 0); | |
1712 | - | |
1713 | 1712 | /* We power off the wireless slot in case it was not done |
1714 | 1713 | * by the driver. We don't power it on automatically however |
1715 | 1714 | */ |
... | ... | @@ -1852,9 +1851,6 @@ |
1852 | 1851 | UN_OUT(UNI_N_CLOCK_CNTL, save_unin_clock_ctl); |
1853 | 1852 | udelay(100); |
1854 | 1853 | |
1855 | - /* Enable clock spreading */ | |
1856 | - pmac_tweak_clock_spreading(macio, 1); | |
1857 | - | |
1858 | 1854 | return 0; |
1859 | 1855 | } |
1860 | 1856 | |
... | ... | @@ -2822,7 +2818,7 @@ |
2822 | 2818 | * clock spreading now. This should be a platform function but we |
2823 | 2819 | * don't do these at the moment |
2824 | 2820 | */ |
2825 | - pmac_tweak_clock_spreading(&macio_chips[0], 1); | |
2821 | + pmac_tweak_clock_spreading(1); | |
2826 | 2822 | |
2827 | 2823 | #endif /* CONFIG_POWER4 */ |
2828 | 2824 |
drivers/macintosh/via-pmu.c
... | ... | @@ -2351,6 +2351,10 @@ |
2351 | 2351 | return -EBUSY; |
2352 | 2352 | } |
2353 | 2353 | |
2354 | + /* Disable clock spreading on some machines */ | |
2355 | + pmac_tweak_clock_spreading(0); | |
2356 | + | |
2357 | + /* Stop preemption */ | |
2354 | 2358 | preempt_disable(); |
2355 | 2359 | |
2356 | 2360 | /* Make sure the decrementer won't interrupt us */ |
2357 | 2361 | |
2358 | 2362 | |
... | ... | @@ -2417,10 +2421,11 @@ |
2417 | 2421 | |
2418 | 2422 | /* Re-enable local CPU interrupts */ |
2419 | 2423 | local_irq_enable(); |
2420 | - | |
2421 | 2424 | mdelay(100); |
2422 | - | |
2423 | 2425 | preempt_enable(); |
2426 | + | |
2427 | + /* Re-enable clock spreading on some machines */ | |
2428 | + pmac_tweak_clock_spreading(1); | |
2424 | 2429 | |
2425 | 2430 | /* Resume devices */ |
2426 | 2431 | device_resume(); |
include/asm-ppc/pmac_feature.h
... | ... | @@ -316,6 +316,9 @@ |
316 | 316 | extern void pmac_suspend_agp_for_card(struct pci_dev *dev); |
317 | 317 | extern void pmac_resume_agp_for_card(struct pci_dev *dev); |
318 | 318 | |
319 | +/* Used by the via-pmu driver for suspend/resume | |
320 | + */ | |
321 | +extern void pmac_tweak_clock_spreading(int enable); | |
319 | 322 | |
320 | 323 | /* |
321 | 324 | * The part below is for use by macio_asic.c only, do not rely |