From: Johannes Berg <[email protected]> After some more discussion this patch replaces it: From: Johannes Berg <[email protected]> Subject: suspend: add arch irq disable/enable hooks For powermac, we need to do some things between suspending devices and device_power_off, for example setting the decrementer. This patch allows architectures to define arch_s2ram_{en,dis}able_irqs in their asm/suspend.h to have control over this step. Signed-off-by: Johannes Berg <[email protected]> Acked-by: Pavel Machek <[email protected]> Cc: Andrew Morton <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> --- include/linux/pm.h | 18 ++++++++++++++++++ kernel/power/main.c | 18 +++++++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/include/linux/pm.h b/include/linux/pm.h index b0ab623..9bd86db 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h @@ -166,6 +166,24 @@ extern struct pm_ops *pm_ops; extern int pm_suspend(suspend_state_t state); +/** + * arch_suspend_disable_irqs - disable IRQs for suspend + * + * Disables IRQs (in the default case). This is a weak symbol in the common + * code and thus allows architectures to override it if more needs to be + * done. Not called for suspend to disk. + */ +extern void arch_suspend_disable_irqs(void); + +/** + * arch_suspend_enable_irqs - enable IRQs after suspend + * + * Enables IRQs (in the default case). This is a weak symbol in the common + * code and thus allows architectures to override it if more needs to be + * done. Not called for suspend to disk. + */ +extern void arch_suspend_enable_irqs(void); + /* * Device power management */ diff --git a/kernel/power/main.c b/kernel/power/main.c index a064dfd..3062e94 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c @@ -111,13 +111,24 @@ static int suspend_prepare(suspend_state_t state) return error; } +/* default implementation */ +void __attribute__ ((weak)) arch_suspend_disable_irqs(void) +{ + local_irq_disable(); +} + +/* default implementation */ +void __attribute__ ((weak)) arch_suspend_enable_irqs(void) +{ + local_irq_enable(); +} int suspend_enter(suspend_state_t state) { int error = 0; - unsigned long flags; - local_irq_save(flags); + arch_suspend_disable_irqs(); + BUG_ON(!irqs_disabled()); if ((error = device_power_down(PMSG_SUSPEND))) { printk(KERN_ERR "Some devices failed to power down\n"); @@ -126,7 +137,8 @@ int suspend_enter(suspend_state_t state) error = pm_ops->enter(state); device_power_up(); Done: - local_irq_restore(flags); + arch_suspend_enable_irqs(); + BUG_ON(irqs_disabled()); return error; } -- 1.5.1.2 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- [PATCH 44/46] mod_sysfs_setup() doesn't return errno when kobject_add_dir() failure occurs
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 44/46] mod_sysfs_setup() doesn't return errno when kobject_add_dir() failure occurs
- References:
- [GIT PATCH] Driver core patches for 2.6.21
- From: Greg KH <[email protected]>
- [PATCH 01/46] driver core: fix device_add error path
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 02/46] driver core: fix namespace issue with devices assigned to classes
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 03/46] dev_printk and new-style class devices
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 05/46] driver core: Use attribute groups in struct device_type
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 06/46] Driver core: add name to device_type
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 07/46] kobject: kobject_shadow_add cleanup
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 08/46] driver core: per-subsystem multithreaded probing
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 09/46] powerpc: make it compile for multithread change
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 10/46] driver core: don't fail attaching the device if it cannot be bound
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 11/46] Driver core: remove unneeded completion from driver release path
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 12/46] kref: fix CPU ordering with respect to krefs
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 13/46] Driver core: notify userspace of network device renames
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 14/46] Driver core: suppress uevents via filter
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 15/46] Driver core: switch firmware_class to uevent_suppress.
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 16/46] uevent: use add_uevent_var() instead of open coding it
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 17/46] Driver core: add suspend() and resume() to struct device_type
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 18/46] Kobject: kobject_uevent.c: Collapse unnecessary loop nesting (top_kobj)
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 19/46] kobject: kobject_add() reference leak
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 20/46] Driver core: remove use of rwsem
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 21/46] SCSI: use the proper semaphore to protect the class lists
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 22/46] USB: remove use of the bus rwsem, as it doesn't really protect anything.
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 23/46] PNP: stop using the subsystem rwsem
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 24/46] Input: serio - do not touch bus's rwsem
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 25/46] Input: gameport - do not touch bus's rwsem
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 26/46] IDE: remove rwsem use from ide-proc core
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 27/46] IEEE1394: remove rwsem use from ieee1394 core
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 28/46] PHY: remove rwsem use from phy core
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 29/46] qeth: Remove usage of subsys.rwsem
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 30/46] kobject core: remove rwsem from struct subsystem
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 31/46] Driver core: make uevent-environment available in uevent-file
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 32/46] Driver core: warn when userspace writes to the uevent file in a non-supported way
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 33/46] kobject: Comment and warning fixes to kobject.c
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 34/46] the overdue removal of the mount/umount uevents
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 35/46] debugfs: Add debugfs_create_u64()
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 36/46] driver core: bus_add_driver should return an error if no bus
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 37/46] Driver core: use mutex instead of semaphore in DMA pool handler
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 38/46] sysfs: bin.c printk fix
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 39/46] s390: cio: Delay uevents for subchannels
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 40/46] device_schedule_callback() needs a module reference
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 41/46] security: prevent permission checking of file removal via sysfs_remove_group()
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 42/46] define platform wakeup hook, use in pci_enable_wake()
- From: Greg Kroah-Hartman <[email protected]>
- [GIT PATCH] Driver core patches for 2.6.21
- Prev by Date: Re: [GIT PATCH] USB patches for 2.6.21
- Next by Date: [PATCH 27/46] IEEE1394: remove rwsem use from ieee1394 core
- Previous by thread: [PATCH 42/46] define platform wakeup hook, use in pci_enable_wake()
- Next by thread: [PATCH 44/46] mod_sysfs_setup() doesn't return errno when kobject_add_dir() failure occurs
- Index(es):