Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Benjamin Herrenschmidt and committed by
Linus Torvalds
e521dca6 6995f17a

+14 -10
+4 -8
arch/ppc/platforms/pmac_feature.c
··· 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 ··· 1708 1706 if (macio->type != macio_keylargo && macio->type != macio_pangea && 1709 1707 macio->type != macio_intrepid) 1710 1708 return -ENODEV; 1711 - 1712 - /* Disable clock spreading */ 1713 - pmac_tweak_clock_spreading(macio, 0); 1714 1709 1715 1710 /* We power off the wireless slot in case it was not done 1716 1711 * by the driver. We don't power it on automatically however ··· 1850 1851 1851 1852 UN_OUT(UNI_N_CLOCK_CNTL, save_unin_clock_ctl); 1852 1853 udelay(100); 1853 - 1854 - /* Enable clock spreading */ 1855 - pmac_tweak_clock_spreading(macio, 1); 1856 1854 1857 1855 return 0; 1858 1856 } ··· 2818 2822 * clock spreading now. This should be a platform function but we 2819 2823 * don't do these at the moment 2820 2824 */ 2821 - pmac_tweak_clock_spreading(&macio_chips[0], 1); 2825 + pmac_tweak_clock_spreading(1); 2822 2826 2823 2827 #endif /* CONFIG_POWER4 */ 2824 2828
+7 -2
drivers/macintosh/via-pmu.c
··· 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 */ ··· 2421 2417 2422 2418 /* Re-enable local CPU interrupts */ 2423 2419 local_irq_enable(); 2424 - 2425 2420 mdelay(100); 2426 - 2427 2421 preempt_enable(); 2422 + 2423 + /* Re-enable clock spreading on some machines */ 2424 + pmac_tweak_clock_spreading(1); 2428 2425 2429 2426 /* Resume devices */ 2430 2427 device_resume();
+3
include/asm-ppc/pmac_feature.h
··· 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