PM: Simplify the new suspend/hibernation framework for devices
Subsystems (7)
PATCH 1/1 PM: Simplify the new suspend/hibernation framework for devices
Hi Greg,
I promised at the KS that I would simplify the new suspend/hibernation framework for devices to avoid the confusion with two types of PM operations and pointers to PM operations from too many places.
The appended patch is intended for this purpose. Unfortunately, I can't split it into subsystem-related patches, because compilation would be broken between them.
The patch applies to linux-next, but it's trivial to make it apply to the mainline. It's been compiled on x86 (both 32-bit and 64-bit) and tested on hp nx6325, doesn't appear to break anything.
Thanks,
Rafael
---
From: Rafael J. Wysocki <[email protected]>
PM: Simplify the new suspend/hibernation framework for devices
Following the discussion at the Kernel Summit, simplify the new device PM framework by merging 'struct pm_ops' and 'struct pm_ext_ops' and removing pointers to 'struct pm_ext_ops' from 'struct platform_driver' and 'struct pci_driver'.
After this change, the suspend/hibernation callbacks will only reside in 'struct device_driver' as well as at the bus type/ device class/device type level. Accordingly, PCI and platform device drivers are now expected to put their suspend/hibernation callbacks into the 'struct device_driver' embedded in 'struct pci_driver' or 'struct platform_driver', respectively.
--- drivers/base/platform.c | 115 ++++++++++++++++++++-------------------- drivers/base/power/main.c | 19 +++--- drivers/pci/pci-driver.c | 46 ++++++---------- drivers/usb/core/usb.c | 4 - include/linux/device.h | 8 +- include/linux/pci.h | 1 include/linux/platform_device.h | 1 include/linux/pm.h | 76 ++++++++------------------ 8 files changed, 119 insertions(+), 151 deletions(-)
include/linux/pm.h +25 -51
@@ -41,7 +41,7 @@ typedef struct pm_message { } pm_message_t;/** -* struct pm_ops - device PM callbacks +* struct dev_pm_ops - device PM callbacks * * Several driver power state transitions are externally visible, affecting * the state of pending I/O queues and (for drivers that touch hardware)
@@ -126,46 +126,6 @@ typedef struct pm_message {* On most platforms, there are no restrictions on availability of * resources like clocks during @restore(). * -* All of the above callbacks, except for @complete(), return error codes. -* However, the error codes returned by the resume operations, @resume(), -* @thaw(), and @restore(), do not cause the PM core to abort the resume -* transition during which they are returned. The error codes returned in -* that cases are only printed by the PM core to the system logs for debugging -* purposes. Still, it is recommended that drivers only return error codes -* from their resume methods in case of an unrecoverable failure (i.e. when the -* device being handled refuses to resume and becomes unusable) to allow us to -* modify the PM core in the future, so that it can avoid attempting to handle -* devices that failed to resume and their children. -* -* It is allowed to unregister devices while the above callbacks are being -* executed. However, it is not allowed to unregister a device from within any -* of its own callbacks. -*/ - -struct pm_ops { -int (*prepare)(struct device *dev); -void (*complete)(struct device *dev); -int (*suspend)(struct device *dev); -int (*resume)(struct device *dev); -int (*freeze)(struct device *dev); -int (*thaw)(struct device *dev); -int (*poweroff)(struct device *dev); -int (*restore)(struct device *dev); -}; - -/** -* struct pm_ext_ops - extended device PM callbacks -* -* Some devices require certain operations related to suspend and hibernation -* to be carried out with interrupts disabled. Thus, 'struct pm_ext_ops' below -* is defined, adding callbacks to be executed with interrupts disabled to -* 'struct pm_ops'. -* -* The following callbacks included in 'struct pm_ext_ops' are executed with -* the nonboot CPUs switched off and with interrupts disabled on the only -* functional CPU. They also are executed with the PM core list of devices -* locked, so they must NOT unregister any devices. -* * @suspend_noirq: Complete the operations of ->suspend() by carrying out any * actions required for suspending the device that need interrupts to be * disabled
@@ -190,18 +150,32 @@ struct pm_ops {* actions required for restoring the operations of the device that need * interrupts to be disabled * -* All of the above callbacks return error codes, but the error codes returned -* by the resume operations, @resume_noirq(), @thaw_noirq(), and -* @restore_noirq(), do not cause the PM core to abort the resume transition -* during which they are returned. The error codes returned in that cases are -* only printed by the PM core to the system logs for debugging purposes. -* Still, as stated above, it is recommended that drivers only return error -* codes from their resume methods if the device being handled fails to resume -* and is not usable any more. +* All of the above callbacks, except for @complete(), return error codes. +* However, the error codes returned by the resume operations, @resume(), +* @thaw(), @restore(), @resume_noirq(), @thaw_noirq(), and @restore_noirq() do +* not cause the PM core to abort the resume transition during which they are +* returned. The error codes returned in that cases are only printed by the PM +* core to the system logs for debugging purposes. Still, it is recommended +* that drivers only return error codes from their resume methods in case of an +* unrecoverable failure (i.e. when the device being handled refuses to resume +* and becomes unusable) to allow us to modify the PM core in the future, so +* that it can avoid attempting to handle devices that failed to resume and +* their children. +* +* It is allowed to unregister devices while the above callbacks are being +* executed. However, it is not allowed to unregister a device from within any +* of its own callbacks. */ -struct pm_ext_ops { -struct pm_ops base; +struct dev_pm_ops { +int (*prepare)(struct device *dev); +void (*complete)(struct device *dev); +int (*suspend)(struct device *dev); +int (*resume)(struct device *dev); +int (*freeze)(struct device *dev); +int (*thaw)(struct device *dev); +int (*poweroff)(struct device *dev); +int (*restore)(struct device *dev);int (*suspend_noirq)(struct device *dev);int (*resume_noirq)(struct device *dev);int (*freeze_noirq)(struct device *dev);
include/linux/device.h +4 -4
@@ -65,7 +65,7 @@ struct bus_type {int (*resume_early)(struct device *dev);int (*resume)(struct device *dev); -struct pm_ext_ops *pm; +struct dev_pm_ops *pm;struct bus_type_private *p; };
@@ -133,7 +133,7 @@ struct device_driver {int (*resume) (struct device *dev);struct attribute_group **groups; -struct pm_ops *pm; +struct dev_pm_ops *pm;struct driver_private *p; };
@@ -201,7 +201,7 @@ struct class {enum sysfs_tag_type tag_type;const void *(*sysfs_tag)(struct device *dev); -struct pm_ops *pm; +struct dev_pm_ops *pm;struct class_private *p; };
@@ -291,7 +291,7 @@ struct device_type {int (*uevent)(struct device *dev,struct kobj_uevent_env *env);void (*release)(struct device *dev); -struct pm_ops *pm; +struct dev_pm_ops *pm; };/* interface for exporting device attributes */
include/linux/platform_device.h +0 -1
@@ -53,7 +53,6 @@ struct platform_driver {int (*suspend_late)(struct platform_device *,pm_message_t state);int (*resume_early)(struct platform_device *);int (*resume)(struct platform_device *); -struct pm_ext_ops *pm;struct device_driver driver; };
include/linux/pci.h +0 -1
@@ -414,7 +414,6 @@ struct pci_driver {int (*resume_early) (struct pci_dev *dev);int (*resume) (struct pci_dev *dev);/* Device woken up */ void (*shutdown) (struct pci_dev *dev); -struct pm_ext_ops *pm;struct pci_error_handlers *err_handler;struct device_driver driver;struct pci_dynids dynids;
drivers/pci/pci-driver.c +18 -28
108 lines not on this page · raw message
drivers/base/platform.c +60 -55
223 lines not on this page · raw message
drivers/usb/core/usb.c +2 -2
@@ -286,7 +286,7 @@ static int usb_dev_restore(struct devicereturn usb_resume (dev); } -static struct pm_ops usb_device_pm_ops = { +static struct dev_pm_ops usb_device_pm_ops = { .prepare = usb_dev_prepare, .complete = usb_dev_complete, .suspend = usb_dev_suspend,
@@ -301,7 +301,7 @@ static struct pm_ops usb_device_pm_ops =#define ksuspend_usb_init () 0#define ksuspend_usb_cleanup () do {} while (0) -#define usb_device_pm_ops (*(struct pm_ops *)0) +#define usb_device_pm_ops (*(struct dev_pm_ops *)0)#endif /* CONFIG_PM */
drivers/base/power/main.c +10 -9
@@ -112,7 +112,8 @@ void device_pm_remove(struct device *dev* @ops: PM operations to choose from. * @state: PM transition of the system being carried out. */ -static int pm_op (struct device *dev,struct pm_ops *ops,pm_message_t state) +static int pm_op (struct device *dev,struct dev_pm_ops *ops, +pm_message_t state) {int error =0 ;
@@ -174,7 +175,7 @@ static int pm_op(struct device *dev, str* The operation is executed with interrupts disabled by the only remaining * functional CPU in the system. */ -static int pm_noirq_op (struct device *dev,struct pm_ext_ops *ops, +static int pm_noirq_op (struct device *dev,struct dev_pm_ops *ops,pm_message_t state) {int error =0 ;
@@ -355,7 +356,7 @@ static int resume_device(struct device *if (dev->bus) {if (dev->bus->pm) {pm_dev_dbg (dev, state,"" ); - error =pm_op (dev, &dev->bus->pm->base, state); + error =pm_op (dev, dev->bus->pm, state); }else if (dev->bus->resume) {pm_dev_dbg (dev, state,"legacy " ); error = dev->bus->resume (dev);
@@ -440,9 +441,9 @@ static void complete_device(struct devic dev->type->pm->complete (dev); } -if (dev->bus && dev->bus->pm && dev->bus->pm->base.complete) { +if (dev->bus && dev->bus->pm && dev->bus->pm->complete) {pm_dev_dbg (dev, state,"completing " ); - dev->bus->pm->base.complete (dev); + dev->bus->pm->complete (dev); }up (&dev->sem);
@@ -600,7 +601,7 @@ static int suspend_device(struct deviceif (dev->bus) {if (dev->bus->pm) {pm_dev_dbg (dev, state,"" ); - error =pm_op (dev, &dev->bus->pm->base, state); + error =pm_op (dev, dev->bus->pm, state); }else if (dev->bus->suspend) {pm_dev_dbg (dev, state,"legacy " ); error = dev->bus->suspend (dev, state);
@@ -661,10 +662,10 @@ static int prepare_device(struct devicedown (&dev->sem); -if (dev->bus && dev->bus->pm && dev->bus->pm->base.prepare) { +if (dev->bus && dev->bus->pm && dev->bus->pm->prepare) {pm_dev_dbg (dev, state,"preparing " ); - error = dev->bus->pm->base.prepare (dev); -suspend_report_result (dev->bus->pm->base.prepare, error); + error = dev->bus->pm->prepare (dev); +suspend_report_result (dev->bus->pm->prepare, error);if (error) goto End; }
Quoted 6 lines · Rafael J. Wysocki
Hi Greg,
I promised at the KS that I would simplify the new suspend/hibernation framework for devices to avoid the confusion with two types of PM operations and pointers to PM operations from too many places.
Quoted 7 lines
The appended patch is intended for this purpose. Unfortunately, I can't split it into subsystem-related patches, because compilation would be broken between them.
The patch applies to linux-next, but it's trivial to make it apply to the mainline. It's been compiled on x86 (both 32-bit and 64-bit) and tested on hp nx6325, doesn't appear to break anything.
This one had a checkpatch.pl problem, sorry for that. Updated patch is appended.
Thanks,
Rafael
---
From: Rafael J. Wysocki <[email protected]>
PM: Simplify the new suspend/hibernation framework for devices
Following the discussion at the Kernel Summit, simplify the new device PM framework by merging 'struct pm_ops' and 'struct pm_ext_ops' and removing pointers to 'struct pm_ext_ops' from 'struct platform_driver' and 'struct pci_driver'.
After this change, the suspend/hibernation callbacks will only reside in 'struct device_driver' as well as at the bus type/ device class/device type level. Accordingly, PCI and platform device drivers are now expected to put their suspend/hibernation callbacks into the 'struct device_driver' embedded in 'struct pci_driver' or 'struct platform_driver', respectively.
--- drivers/base/platform.c | 115 ++++++++++++++++++++-------------------- drivers/base/power/main.c | 19 +++--- drivers/pci/pci-driver.c | 46 ++++++---------- drivers/usb/core/usb.c | 4 - include/linux/device.h | 8 +- include/linux/pci.h | 1 include/linux/platform_device.h | 1 include/linux/pm.h | 76 ++++++++------------------ 8 files changed, 119 insertions(+), 151 deletions(-)
include/linux/pm.h +25 -51
@@ -41,7 +41,7 @@ typedef struct pm_message { } pm_message_t;/** -* struct pm_ops - device PM callbacks +* struct dev_pm_ops - device PM callbacks * * Several driver power state transitions are externally visible, affecting * the state of pending I/O queues and (for drivers that touch hardware)
@@ -126,46 +126,6 @@ typedef struct pm_message {* On most platforms, there are no restrictions on availability of * resources like clocks during @restore(). * -* All of the above callbacks, except for @complete(), return error codes. -* However, the error codes returned by the resume operations, @resume(), -* @thaw(), and @restore(), do not cause the PM core to abort the resume -* transition during which they are returned. The error codes returned in -* that cases are only printed by the PM core to the system logs for debugging -* purposes. Still, it is recommended that drivers only return error codes -* from their resume methods in case of an unrecoverable failure (i.e. when the -* device being handled refuses to resume and becomes unusable) to allow us to -* modify the PM core in the future, so that it can avoid attempting to handle -* devices that failed to resume and their children. -* -* It is allowed to unregister devices while the above callbacks are being -* executed. However, it is not allowed to unregister a device from within any -* of its own callbacks. -*/ - -struct pm_ops { -int (*prepare)(struct device *dev); -void (*complete)(struct device *dev); -int (*suspend)(struct device *dev); -int (*resume)(struct device *dev); -int (*freeze)(struct device *dev); -int (*thaw)(struct device *dev); -int (*poweroff)(struct device *dev); -int (*restore)(struct device *dev); -}; - -/** -* struct pm_ext_ops - extended device PM callbacks -* -* Some devices require certain operations related to suspend and hibernation -* to be carried out with interrupts disabled. Thus, 'struct pm_ext_ops' below -* is defined, adding callbacks to be executed with interrupts disabled to -* 'struct pm_ops'. -* -* The following callbacks included in 'struct pm_ext_ops' are executed with -* the nonboot CPUs switched off and with interrupts disabled on the only -* functional CPU. They also are executed with the PM core list of devices -* locked, so they must NOT unregister any devices. -* * @suspend_noirq: Complete the operations of ->suspend() by carrying out any * actions required for suspending the device that need interrupts to be * disabled
@@ -190,18 +150,32 @@ struct pm_ops {* actions required for restoring the operations of the device that need * interrupts to be disabled * -* All of the above callbacks return error codes, but the error codes returned -* by the resume operations, @resume_noirq(), @thaw_noirq(), and -* @restore_noirq(), do not cause the PM core to abort the resume transition -* during which they are returned. The error codes returned in that cases are -* only printed by the PM core to the system logs for debugging purposes. -* Still, as stated above, it is recommended that drivers only return error -* codes from their resume methods if the device being handled fails to resume -* and is not usable any more. +* All of the above callbacks, except for @complete(), return error codes. +* However, the error codes returned by the resume operations, @resume(), +* @thaw(), @restore(), @resume_noirq(), @thaw_noirq(), and @restore_noirq() do +* not cause the PM core to abort the resume transition during which they are +* returned. The error codes returned in that cases are only printed by the PM +* core to the system logs for debugging purposes. Still, it is recommended +* that drivers only return error codes from their resume methods in case of an +* unrecoverable failure (i.e. when the device being handled refuses to resume +* and becomes unusable) to allow us to modify the PM core in the future, so +* that it can avoid attempting to handle devices that failed to resume and +* their children. +* +* It is allowed to unregister devices while the above callbacks are being +* executed. However, it is not allowed to unregister a device from within any +* of its own callbacks. */ -struct pm_ext_ops { -struct pm_ops base; +struct dev_pm_ops { +int (*prepare)(struct device *dev); +void (*complete)(struct device *dev); +int (*suspend)(struct device *dev); +int (*resume)(struct device *dev); +int (*freeze)(struct device *dev); +int (*thaw)(struct device *dev); +int (*poweroff)(struct device *dev); +int (*restore)(struct device *dev);int (*suspend_noirq)(struct device *dev);int (*resume_noirq)(struct device *dev);int (*freeze_noirq)(struct device *dev);
include/linux/device.h +4 -4
@@ -65,7 +65,7 @@ struct bus_type {int (*resume_early)(struct device *dev);int (*resume)(struct device *dev); -struct pm_ext_ops *pm; +struct dev_pm_ops *pm;struct bus_type_private *p; };
@@ -133,7 +133,7 @@ struct device_driver {int (*resume) (struct device *dev);struct attribute_group **groups; -struct pm_ops *pm; +struct dev_pm_ops *pm;struct driver_private *p; };
@@ -201,7 +201,7 @@ struct class {enum sysfs_tag_type tag_type;const void *(*sysfs_tag)(struct device *dev); -struct pm_ops *pm; +struct dev_pm_ops *pm;struct class_private *p; };
@@ -291,7 +291,7 @@ struct device_type {int (*uevent)(struct device *dev,struct kobj_uevent_env *env);void (*release)(struct device *dev); -struct pm_ops *pm; +struct dev_pm_ops *pm; };/* interface for exporting device attributes */
include/linux/platform_device.h +0 -1
@@ -53,7 +53,6 @@ struct platform_driver {int (*suspend_late)(struct platform_device *,pm_message_t state);int (*resume_early)(struct platform_device *);int (*resume)(struct platform_device *); -struct pm_ext_ops *pm;struct device_driver driver; };
include/linux/pci.h +0 -1
@@ -414,7 +414,6 @@ struct pci_driver {int (*resume_early) (struct pci_dev *dev);int (*resume) (struct pci_dev *dev);/* Device woken up */ void (*shutdown) (struct pci_dev *dev); -struct pm_ext_ops *pm;struct pci_error_handlers *err_handler;struct device_driver driver;struct pci_dynids dynids;
drivers/pci/pci-driver.c +18 -28
108 lines not on this page · raw message
drivers/base/platform.c +60 -55
223 lines not on this page · raw message
drivers/usb/core/usb.c +2 -2
@@ -286,7 +286,7 @@ static int usb_dev_restore(struct devicereturn usb_resume (dev); } -static struct pm_ops usb_device_pm_ops = { +static struct dev_pm_ops usb_device_pm_ops = { .prepare = usb_dev_prepare, .complete = usb_dev_complete, .suspend = usb_dev_suspend,
@@ -301,7 +301,7 @@ static struct pm_ops usb_device_pm_ops =#define ksuspend_usb_init () 0#define ksuspend_usb_cleanup () do {} while (0) -#define usb_device_pm_ops (*(struct pm_ops *)0) +#define usb_device_pm_ops (*(struct dev_pm_ops *)0)#endif /* CONFIG_PM */
drivers/base/power/main.c +10 -9
@@ -112,7 +112,8 @@ void device_pm_remove(struct device *dev* @ops: PM operations to choose from. * @state: PM transition of the system being carried out. */ -static int pm_op (struct device *dev,struct pm_ops *ops,pm_message_t state) +static int pm_op (struct device *dev,struct dev_pm_ops *ops, +pm_message_t state) {int error =0 ;
@@ -174,7 +175,7 @@ static int pm_op(struct device *dev, str* The operation is executed with interrupts disabled by the only remaining * functional CPU in the system. */ -static int pm_noirq_op (struct device *dev,struct pm_ext_ops *ops, +static int pm_noirq_op (struct device *dev,struct dev_pm_ops *ops,pm_message_t state) {int error =0 ;
@@ -355,7 +356,7 @@ static int resume_device(struct device *if (dev->bus) {if (dev->bus->pm) {pm_dev_dbg (dev, state,"" ); - error =pm_op (dev, &dev->bus->pm->base, state); + error =pm_op (dev, dev->bus->pm, state); }else if (dev->bus->resume) {pm_dev_dbg (dev, state,"legacy " ); error = dev->bus->resume (dev);
@@ -440,9 +441,9 @@ static void complete_device(struct devic dev->type->pm->complete (dev); } -if (dev->bus && dev->bus->pm && dev->bus->pm->base.complete) { +if (dev->bus && dev->bus->pm && dev->bus->pm->complete) {pm_dev_dbg (dev, state,"completing " ); - dev->bus->pm->base.complete (dev); + dev->bus->pm->complete (dev); }up (&dev->sem);
@@ -600,7 +601,7 @@ static int suspend_device(struct deviceif (dev->bus) {if (dev->bus->pm) {pm_dev_dbg (dev, state,"" ); - error =pm_op (dev, &dev->bus->pm->base, state); + error =pm_op (dev, dev->bus->pm, state); }else if (dev->bus->suspend) {pm_dev_dbg (dev, state,"legacy " ); error = dev->bus->suspend (dev, state);
@@ -661,10 +662,10 @@ static int prepare_device(struct devicedown (&dev->sem); -if (dev->bus && dev->bus->pm && dev->bus->pm->base.prepare) { +if (dev->bus && dev->bus->pm && dev->bus->pm->prepare) {pm_dev_dbg (dev, state,"preparing " ); - error = dev->bus->pm->base.prepare (dev); -suspend_report_result (dev->bus->pm->base.prepare, error); + error = dev->bus->pm->prepare (dev); +suspend_report_result (dev->bus->pm->prepare, error);if (error) goto End; }
Quoted 11 lines · Rafael J. Wysocki
Quoted 10 lines · Rafael J. Wysocki
Hi Greg,
I promised at the KS that I would simplify the new suspend/hibernation framework for devices to avoid the confusion with two types of PM operations and pointers to PM operations from too many places.
The appended patch is intended for this purpose. Unfortunately, I can't split it into subsystem-related patches, because compilation would be broken between them.
Quoted 6 lines
Quoted 3 lines
The patch applies to linux-next, but it's trivial to make it apply to the mainline. It's been compiled on x86 (both 32-bit and 64-bit) and tested on hp nx6325, doesn't appear to break anything.
This one had a checkpatch.pl problem, sorry for that. Updated patch is appended.
Seems ok to me. ACK.
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 11 lines · Rafael J. Wysocki
Quoted 10 lines · Rafael J. Wysocki
Hi Greg,
I promised at the KS that I would simplify the new suspend/hibernation framework for devices to avoid the confusion with two types of PM operations and pointers to PM operations from too many places.
The appended patch is intended for this purpose. Unfortunately, I can't split it into subsystem-related patches, because compilation would be broken between them.
Quoted 6 lines
Quoted 3 lines
The patch applies to linux-next, but it's trivial to make it apply to the mainline. It's been compiled on x86 (both 32-bit and 64-bit) and tested on hp nx6325, doesn't appear to break anything.
This one had a checkpatch.pl problem, sorry for that. Updated patch is appended.
Seems ok to me. ACK.
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 11 lines · Rafael J. Wysocki
Quoted 10 lines · Rafael J. Wysocki
Hi Greg,
I promised at the KS that I would simplify the new suspend/hibernation framework for devices to avoid the confusion with two types of PM operations and pointers to PM operations from too many places.
The appended patch is intended for this purpose. Unfortunately, I can't split it into subsystem-related patches, because compilation would be broken between them.
Quoted 6 lines
Quoted 3 lines
The patch applies to linux-next, but it's trivial to make it apply to the mainline. It's been compiled on x86 (both 32-bit and 64-bit) and tested on hp nx6325, doesn't appear to break anything.
This one had a checkpatch.pl problem, sorry for that. Updated patch is appended.
I've added this to my tree (Jesse, is this ok, as it does have a PCI portion?)
But it's too late for .28, especially due to the -next tree not up and running right now. I'll let it bake in -mm and -next and it should go into .29.
Is that ok?
thanks,
greg k-h
Quoted 11 lines · Rafael J. Wysocki
Quoted 10 lines · Rafael J. Wysocki
Hi Greg,
I promised at the KS that I would simplify the new suspend/hibernation framework for devices to avoid the confusion with two types of PM operations and pointers to PM operations from too many places.
The appended patch is intended for this purpose. Unfortunately, I can't split it into subsystem-related patches, because compilation would be broken between them.
Quoted 6 lines
Quoted 3 lines
The patch applies to linux-next, but it's trivial to make it apply to the mainline. It's been compiled on x86 (both 32-bit and 64-bit) and tested on hp nx6325, doesn't appear to break anything.
This one had a checkpatch.pl problem, sorry for that. Updated patch is appended.
I've added this to my tree (Jesse, is this ok, as it does have a PCI portion?)
But it's too late for .28, especially due to the -next tree not up and running right now. I'll let it bake in -mm and -next and it should go into .29.
Is that ok?
thanks,
greg k-h
Quoted 19 lines · Greg KH
Quoted 11 lines · Rafael J. Wysocki
Quoted 10 lines · Rafael J. Wysocki
Hi Greg,
I promised at the KS that I would simplify the new suspend/hibernation framework for devices to avoid the confusion with two types of PM operations and pointers to PM operations from too many places.
The appended patch is intended for this purpose. Unfortunately, I can't split it into subsystem-related patches, because compilation would be broken between them.
Quoted 6 lines
Quoted 3 lines
The patch applies to linux-next, but it's trivial to make it apply to the mainline. It's been compiled on x86 (both 32-bit and 64-bit) and tested on hp nx6325, doesn't appear to break anything.
This one had a checkpatch.pl problem, sorry for that. Updated patch is appended.
Quoted 8 lines
I've added this to my tree (Jesse, is this ok, as it does have a PCI portion?)
But it's too late for .28, especially due to the -next tree not up and running right now. I'll let it bake in -mm and -next and it should go into .29.
Is that ok?
Well, if anyone pushes anything depending on this framework for .27, that will become a !@#$%^&* mess (we've had this problem once already).
Other than that, fine by me.
Thanks,
Rafael
Quoted 23 lines · Rafael J. Wysocki
Quoted 22 lines · Greg KH
Quoted 11 lines · Rafael J. Wysocki
Quoted 10 lines · Rafael J. Wysocki
Hi Greg,
I promised at the KS that I would simplify the new suspend/hibernation framework for devices to avoid the confusion with two types of PM operations and pointers to PM operations from too many places.
The appended patch is intended for this purpose. Unfortunately, I can't split it into subsystem-related patches, because compilation would be broken between them.
Quoted 6 lines
Quoted 3 lines
The patch applies to linux-next, but it's trivial to make it apply to the mainline. It's been compiled on x86 (both 32-bit and 64-bit) and tested on hp nx6325, doesn't appear to break anything.
This one had a checkpatch.pl problem, sorry for that. Updated patch is appended.
I've added this to my tree (Jesse, is this ok, as it does have a PCI portion?)
Quoted 8 lines
Quoted 5 lines
But it's too late for .28, especially due to the -next tree not up and running right now. I'll let it bake in -mm and -next and it should go into .29.
Is that ok?
Well, if anyone pushes anything depending on this framework for .27, that will become a !@#$%^&* mess (we've had this problem once already).
Do we have any drivers that depend on this framework in any tree? Is anyone needing this now?
thanks,
greg k-h
Quoted 28 lines · Greg KH
Quoted 27 lines · Rafael J. Wysocki
Quoted 26 lines · Greg KH
Quoted 11 lines · Rafael J. Wysocki
Quoted 10 lines · Rafael J. Wysocki
Hi Greg,
I promised at the KS that I would simplify the new suspend/hibernation framework for devices to avoid the confusion with two types of PM operations and pointers to PM operations from too many places.
The appended patch is intended for this purpose. Unfortunately, I can't split it into subsystem-related patches, because compilation would be broken between them.
Quoted 6 lines
Quoted 3 lines
The patch applies to linux-next, but it's trivial to make it apply to the mainline. It's been compiled on x86 (both 32-bit and 64-bit) and tested on hp nx6325, doesn't appear to break anything.
This one had a checkpatch.pl problem, sorry for that. Updated patch is appended.
I've added this to my tree (Jesse, is this ok, as it does have a PCI portion?)
But it's too late for .28, especially due to the -next tree not up and running right now. I'll let it bake in -mm and -next and it should go into .29.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Is that ok?
Well, if anyone pushes anything depending on this framework for .27, that will become a !@#$%^&* mess (we've had this problem once already).
Do we have any drivers that depend on this framework in any tree? Is anyone needing this now?
Well, I thought that the Hannes' work would depend on it quite a bit. :-)
Apart from this no one should really need it right now. I hope.
Thanks,
Rafael
Quoted 31 lines · Rafael J. Wysocki
Quoted 30 lines · Greg KH
Quoted 29 lines · Rafael J. Wysocki
Quoted 27 lines · Greg KH
Quoted 11 lines · Rafael J. Wysocki
Quoted 10 lines · Rafael J. Wysocki
Hi Greg,
I promised at the KS that I would simplify the new suspend/hibernation framework for devices to avoid the confusion with two types of PM operations and pointers to PM operations from too many places.
The appended patch is intended for this purpose. Unfortunately, I can't split it into subsystem-related patches, because compilation would be broken between them.
Quoted 6 lines
Quoted 3 lines
The patch applies to linux-next, but it's trivial to make it apply to the mainline. It's been compiled on x86 (both 32-bit and 64-bit) and tested on hp nx6325, doesn't appear to break anything.
This one had a checkpatch.pl problem, sorry for that. Updated patch is appended.
I've added this to my tree (Jesse, is this ok, as it does have a PCI portion?)
But it's too late for .28, especially due to the -next tree not up and running right now. I'll let it bake in -mm and -next and it should go into .29.
Is that ok?
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Well, if anyone pushes anything depending on this framework for .27, that will become a !@#$%^&* mess (we've had this problem once already).
Do we have any drivers that depend on this framework in any tree? Is anyone needing this now?
Well, I thought that the Hannes' work would depend on it quite a bit. :-)
Hannes's work is still in my TO-APPLY mbox, only his cleanup patches are in the tree and queued up for .28. Now that your patch is in, his can be based off of this, and all of them go into .29.
Sound good?
thanks,
greg k-h
Quoted 31 lines · Rafael J. Wysocki
Quoted 30 lines · Greg KH
Quoted 29 lines · Rafael J. Wysocki
Quoted 27 lines · Greg KH
Quoted 11 lines · Rafael J. Wysocki
Quoted 10 lines · Rafael J. Wysocki
Hi Greg,
I promised at the KS that I would simplify the new suspend/hibernation framework for devices to avoid the confusion with two types of PM operations and pointers to PM operations from too many places.
The appended patch is intended for this purpose. Unfortunately, I can't split it into subsystem-related patches, because compilation would be broken between them.
Quoted 6 lines
Quoted 3 lines
The patch applies to linux-next, but it's trivial to make it apply to the mainline. It's been compiled on x86 (both 32-bit and 64-bit) and tested on hp nx6325, doesn't appear to break anything.
This one had a checkpatch.pl problem, sorry for that. Updated patch is appended.
I've added this to my tree (Jesse, is this ok, as it does have a PCI portion?)
But it's too late for .28, especially due to the -next tree not up and running right now. I'll let it bake in -mm and -next and it should go into .29.
Is that ok?
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Well, if anyone pushes anything depending on this framework for .27, that will become a !@#$%^&* mess (we've had this problem once already).
Do we have any drivers that depend on this framework in any tree? Is anyone needing this now?
Well, I thought that the Hannes' work would depend on it quite a bit. :-)
Hannes's work is still in my TO-APPLY mbox, only his cleanup patches are in the tree and queued up for .28. Now that your patch is in, his can be based off of this, and all of them go into .29.
Sound good?
thanks,
greg k-h
Quoted 38 lines · Greg KH
Quoted 37 lines · Rafael J. Wysocki
Quoted 35 lines · Greg KH
Quoted 23 lines · Rafael J. Wysocki
Quoted 22 lines · Greg KH
Quoted 11 lines · Rafael J. Wysocki
Quoted 10 lines · Rafael J. Wysocki
Hi Greg,
I promised at the KS that I would simplify the new suspend/hibernation framework for devices to avoid the confusion with two types of PM operations and pointers to PM operations from too many places.
The appended patch is intended for this purpose. Unfortunately, I can't split it into subsystem-related patches, because compilation would be broken between them.
Quoted 6 lines
Quoted 3 lines
The patch applies to linux-next, but it's trivial to make it apply to the mainline. It's been compiled on x86 (both 32-bit and 64-bit) and tested on hp nx6325, doesn't appear to break anything.
This one had a checkpatch.pl problem, sorry for that. Updated patch is appended.
I've added this to my tree (Jesse, is this ok, as it does have a PCI portion?)
Quoted 8 lines
Quoted 5 lines
But it's too late for .28, especially due to the -next tree not up and running right now. I'll let it bake in -mm and -next and it should go into .29.
Is that ok?
Well, if anyone pushes anything depending on this framework for .27, that will become a !@#$%^&* mess (we've had this problem once already).
Do we have any drivers that depend on this framework in any tree? Is anyone needing this now?
Quoted 7 lines
Quoted 1 line
Well, I thought that the Hannes' work would depend on it quite a bit. :-)
Hannes's work is still in my TO-APPLY mbox, only his cleanup patches are in the tree and queued up for .28. Now that your patch is in, his can be based off of this, and all of them go into .29.
Sound good?
Yes, fine by me.
Thanks,
Rafael
Quoted 38 lines · Greg KH
Quoted 37 lines · Rafael J. Wysocki
Quoted 35 lines · Greg KH
Quoted 23 lines · Rafael J. Wysocki
Quoted 22 lines · Greg KH
Quoted 11 lines · Rafael J. Wysocki
Quoted 10 lines · Rafael J. Wysocki
Hi Greg,
I promised at the KS that I would simplify the new suspend/hibernation framework for devices to avoid the confusion with two types of PM operations and pointers to PM operations from too many places.
The appended patch is intended for this purpose. Unfortunately, I can't split it into subsystem-related patches, because compilation would be broken between them.
Quoted 6 lines
Quoted 3 lines
The patch applies to linux-next, but it's trivial to make it apply to the mainline. It's been compiled on x86 (both 32-bit and 64-bit) and tested on hp nx6325, doesn't appear to break anything.
This one had a checkpatch.pl problem, sorry for that. Updated patch is appended.
I've added this to my tree (Jesse, is this ok, as it does have a PCI portion?)
Quoted 8 lines
Quoted 5 lines
But it's too late for .28, especially due to the -next tree not up and running right now. I'll let it bake in -mm and -next and it should go into .29.
Is that ok?
Well, if anyone pushes anything depending on this framework for .27, that will become a !@#$%^&* mess (we've had this problem once already).
Do we have any drivers that depend on this framework in any tree? Is anyone needing this now?
Quoted 7 lines
Quoted 1 line
Well, I thought that the Hannes' work would depend on it quite a bit. :-)
Hannes's work is still in my TO-APPLY mbox, only his cleanup patches are in the tree and queued up for .28. Now that your patch is in, his can be based off of this, and all of them go into .29.
Sound good?
Yes, fine by me.
Thanks,
Rafael
Quoted 28 lines · Greg KH
Quoted 27 lines · Rafael J. Wysocki
Quoted 26 lines · Greg KH
Quoted 11 lines · Rafael J. Wysocki
Quoted 10 lines · Rafael J. Wysocki
Hi Greg,
I promised at the KS that I would simplify the new suspend/hibernation framework for devices to avoid the confusion with two types of PM operations and pointers to PM operations from too many places.
The appended patch is intended for this purpose. Unfortunately, I can't split it into subsystem-related patches, because compilation would be broken between them.
Quoted 6 lines
Quoted 3 lines
The patch applies to linux-next, but it's trivial to make it apply to the mainline. It's been compiled on x86 (both 32-bit and 64-bit) and tested on hp nx6325, doesn't appear to break anything.
This one had a checkpatch.pl problem, sorry for that. Updated patch is appended.
I've added this to my tree (Jesse, is this ok, as it does have a PCI portion?)
But it's too late for .28, especially due to the -next tree not up and running right now. I'll let it bake in -mm and -next and it should go into .29.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Is that ok?
Well, if anyone pushes anything depending on this framework for .27, that will become a !@#$%^&* mess (we've had this problem once already).
Do we have any drivers that depend on this framework in any tree? Is anyone needing this now?
Well, I thought that the Hannes' work would depend on it quite a bit. :-)
Apart from this no one should really need it right now. I hope.
Thanks,
Rafael
Quoted 23 lines · Rafael J. Wysocki
Quoted 22 lines · Greg KH
Quoted 11 lines · Rafael J. Wysocki
Quoted 10 lines · Rafael J. Wysocki
Hi Greg,
I promised at the KS that I would simplify the new suspend/hibernation framework for devices to avoid the confusion with two types of PM operations and pointers to PM operations from too many places.
The appended patch is intended for this purpose. Unfortunately, I can't split it into subsystem-related patches, because compilation would be broken between them.
Quoted 6 lines
Quoted 3 lines
The patch applies to linux-next, but it's trivial to make it apply to the mainline. It's been compiled on x86 (both 32-bit and 64-bit) and tested on hp nx6325, doesn't appear to break anything.
This one had a checkpatch.pl problem, sorry for that. Updated patch is appended.
I've added this to my tree (Jesse, is this ok, as it does have a PCI portion?)
Quoted 8 lines
Quoted 5 lines
But it's too late for .28, especially due to the -next tree not up and running right now. I'll let it bake in -mm and -next and it should go into .29.
Is that ok?
Well, if anyone pushes anything depending on this framework for .27, that will become a !@#$%^&* mess (we've had this problem once already).
Do we have any drivers that depend on this framework in any tree? Is anyone needing this now?
thanks,
greg k-h
Quoted 19 lines · Greg KH
Quoted 11 lines · Rafael J. Wysocki
Quoted 10 lines · Rafael J. Wysocki
Hi Greg,
I promised at the KS that I would simplify the new suspend/hibernation framework for devices to avoid the confusion with two types of PM operations and pointers to PM operations from too many places.
The appended patch is intended for this purpose. Unfortunately, I can't split it into subsystem-related patches, because compilation would be broken between them.
Quoted 6 lines
Quoted 3 lines
The patch applies to linux-next, but it's trivial to make it apply to the mainline. It's been compiled on x86 (both 32-bit and 64-bit) and tested on hp nx6325, doesn't appear to break anything.
This one had a checkpatch.pl problem, sorry for that. Updated patch is appended.
Quoted 8 lines
I've added this to my tree (Jesse, is this ok, as it does have a PCI portion?)
But it's too late for .28, especially due to the -next tree not up and running right now. I'll let it bake in -mm and -next and it should go into .29.
Is that ok?
Well, if anyone pushes anything depending on this framework for .27, that will become a !@#$%^&* mess (we've had this problem once already).
Other than that, fine by me.
Thanks,
Rafael
Quoted 19 lines · Greg KH
Quoted 11 lines · Rafael J. Wysocki
Quoted 10 lines · Rafael J. Wysocki
Hi Greg,
I promised at the KS that I would simplify the new suspend/hibernation framework for devices to avoid the confusion with two types of PM operations and pointers to PM operations from too many places.
The appended patch is intended for this purpose. Unfortunately, I can't split it into subsystem-related patches, because compilation would be broken between them.
Quoted 6 lines
Quoted 3 lines
The patch applies to linux-next, but it's trivial to make it apply to the mainline. It's been compiled on x86 (both 32-bit and 64-bit) and tested on hp nx6325, doesn't appear to break anything.
This one had a checkpatch.pl problem, sorry for that. Updated patch is appended.
Quoted 8 lines
I've added this to my tree (Jesse, is this ok, as it does have a PCI portion?)
But it's too late for .28, especially due to the -next tree not up and running right now. I'll let it bake in -mm and -next and it should go into .29.
Is that ok?
There are a couple of trivial PCI bits, but it's fine if they come in through your tree for 2.6.29.
Thanks,
Jesse
Quoted 19 lines · Greg KH
Quoted 11 lines · Rafael J. Wysocki
Quoted 10 lines · Rafael J. Wysocki
Hi Greg,
I promised at the KS that I would simplify the new suspend/hibernation framework for devices to avoid the confusion with two types of PM operations and pointers to PM operations from too many places.
The appended patch is intended for this purpose. Unfortunately, I can't split it into subsystem-related patches, because compilation would be broken between them.
Quoted 6 lines
Quoted 3 lines
The patch applies to linux-next, but it's trivial to make it apply to the mainline. It's been compiled on x86 (both 32-bit and 64-bit) and tested on hp nx6325, doesn't appear to break anything.
This one had a checkpatch.pl problem, sorry for that. Updated patch is appended.
Quoted 8 lines
I've added this to my tree (Jesse, is this ok, as it does have a PCI portion?)
But it's too late for .28, especially due to the -next tree not up and running right now. I'll let it bake in -mm and -next and it should go into .29.
Is that ok?
There are a couple of trivial PCI bits, but it's fine if they come in through your tree for 2.6.29.
Thanks,
Jesse
Quoted 6 lines · Rafael J. Wysocki
Hi Greg,
I promised at the KS that I would simplify the new suspend/hibernation framework for devices to avoid the confusion with two types of PM operations and pointers to PM operations from too many places.
Quoted 7 lines
The appended patch is intended for this purpose. Unfortunately, I can't split it into subsystem-related patches, because compilation would be broken between them.
The patch applies to linux-next, but it's trivial to make it apply to the mainline. It's been compiled on x86 (both 32-bit and 64-bit) and tested on hp nx6325, doesn't appear to break anything.
This one had a checkpatch.pl problem, sorry for that. Updated patch is appended.
Thanks,
Rafael
---
From: Rafael J. Wysocki <[email protected]>
PM: Simplify the new suspend/hibernation framework for devices
Following the discussion at the Kernel Summit, simplify the new device PM framework by merging 'struct pm_ops' and 'struct pm_ext_ops' and removing pointers to 'struct pm_ext_ops' from 'struct platform_driver' and 'struct pci_driver'.
After this change, the suspend/hibernation callbacks will only reside in 'struct device_driver' as well as at the bus type/ device class/device type level. Accordingly, PCI and platform device drivers are now expected to put their suspend/hibernation callbacks into the 'struct device_driver' embedded in 'struct pci_driver' or 'struct platform_driver', respectively.
--- drivers/base/platform.c | 115 ++++++++++++++++++++-------------------- drivers/base/power/main.c | 19 +++--- drivers/pci/pci-driver.c | 46 ++++++---------- drivers/usb/core/usb.c | 4 - include/linux/device.h | 8 +- include/linux/pci.h | 1 include/linux/platform_device.h | 1 include/linux/pm.h | 76 ++++++++------------------ 8 files changed, 119 insertions(+), 151 deletions(-)
include/linux/pm.h +25 -51
@@ -41,7 +41,7 @@ typedef struct pm_message { } pm_message_t;/** -* struct pm_ops - device PM callbacks +* struct dev_pm_ops - device PM callbacks * * Several driver power state transitions are externally visible, affecting * the state of pending I/O queues and (for drivers that touch hardware)
@@ -126,46 +126,6 @@ typedef struct pm_message {* On most platforms, there are no restrictions on availability of * resources like clocks during @restore(). * -* All of the above callbacks, except for @complete(), return error codes. -* However, the error codes returned by the resume operations, @resume(), -* @thaw(), and @restore(), do not cause the PM core to abort the resume -* transition during which they are returned. The error codes returned in -* that cases are only printed by the PM core to the system logs for debugging -* purposes. Still, it is recommended that drivers only return error codes -* from their resume methods in case of an unrecoverable failure (i.e. when the -* device being handled refuses to resume and becomes unusable) to allow us to -* modify the PM core in the future, so that it can avoid attempting to handle -* devices that failed to resume and their children. -* -* It is allowed to unregister devices while the above callbacks are being -* executed. However, it is not allowed to unregister a device from within any -* of its own callbacks. -*/ - -struct pm_ops { -int (*prepare)(struct device *dev); -void (*complete)(struct device *dev); -int (*suspend)(struct device *dev); -int (*resume)(struct device *dev); -int (*freeze)(struct device *dev); -int (*thaw)(struct device *dev); -int (*poweroff)(struct device *dev); -int (*restore)(struct device *dev); -}; - -/** -* struct pm_ext_ops - extended device PM callbacks -* -* Some devices require certain operations related to suspend and hibernation -* to be carried out with interrupts disabled. Thus, 'struct pm_ext_ops' below -* is defined, adding callbacks to be executed with interrupts disabled to -* 'struct pm_ops'. -* -* The following callbacks included in 'struct pm_ext_ops' are executed with -* the nonboot CPUs switched off and with interrupts disabled on the only -* functional CPU. They also are executed with the PM core list of devices -* locked, so they must NOT unregister any devices. -* * @suspend_noirq: Complete the operations of ->suspend() by carrying out any * actions required for suspending the device that need interrupts to be * disabled
@@ -190,18 +150,32 @@ struct pm_ops {* actions required for restoring the operations of the device that need * interrupts to be disabled * -* All of the above callbacks return error codes, but the error codes returned -* by the resume operations, @resume_noirq(), @thaw_noirq(), and -* @restore_noirq(), do not cause the PM core to abort the resume transition -* during which they are returned. The error codes returned in that cases are -* only printed by the PM core to the system logs for debugging purposes. -* Still, as stated above, it is recommended that drivers only return error -* codes from their resume methods if the device being handled fails to resume -* and is not usable any more. +* All of the above callbacks, except for @complete(), return error codes. +* However, the error codes returned by the resume operations, @resume(), +* @thaw(), @restore(), @resume_noirq(), @thaw_noirq(), and @restore_noirq() do +* not cause the PM core to abort the resume transition during which they are +* returned. The error codes returned in that cases are only printed by the PM +* core to the system logs for debugging purposes. Still, it is recommended +* that drivers only return error codes from their resume methods in case of an +* unrecoverable failure (i.e. when the device being handled refuses to resume +* and becomes unusable) to allow us to modify the PM core in the future, so +* that it can avoid attempting to handle devices that failed to resume and +* their children. +* +* It is allowed to unregister devices while the above callbacks are being +* executed. However, it is not allowed to unregister a device from within any +* of its own callbacks. */ -struct pm_ext_ops { -struct pm_ops base; +struct dev_pm_ops { +int (*prepare)(struct device *dev); +void (*complete)(struct device *dev); +int (*suspend)(struct device *dev); +int (*resume)(struct device *dev); +int (*freeze)(struct device *dev); +int (*thaw)(struct device *dev); +int (*poweroff)(struct device *dev); +int (*restore)(struct device *dev);int (*suspend_noirq)(struct device *dev);int (*resume_noirq)(struct device *dev);int (*freeze_noirq)(struct device *dev);
include/linux/device.h +4 -4
@@ -65,7 +65,7 @@ struct bus_type {int (*resume_early)(struct device *dev);int (*resume)(struct device *dev); -struct pm_ext_ops *pm; +struct dev_pm_ops *pm;struct bus_type_private *p; };
@@ -133,7 +133,7 @@ struct device_driver {int (*resume) (struct device *dev);struct attribute_group **groups; -struct pm_ops *pm; +struct dev_pm_ops *pm;struct driver_private *p; };
@@ -201,7 +201,7 @@ struct class {enum sysfs_tag_type tag_type;const void *(*sysfs_tag)(struct device *dev); -struct pm_ops *pm; +struct dev_pm_ops *pm;struct class_private *p; };
@@ -291,7 +291,7 @@ struct device_type {int (*uevent)(struct device *dev,struct kobj_uevent_env *env);void (*release)(struct device *dev); -struct pm_ops *pm; +struct dev_pm_ops *pm; };/* interface for exporting device attributes */
include/linux/platform_device.h +0 -1
@@ -53,7 +53,6 @@ struct platform_driver {int (*suspend_late)(struct platform_device *,pm_message_t state);int (*resume_early)(struct platform_device *);int (*resume)(struct platform_device *); -struct pm_ext_ops *pm;struct device_driver driver; };
include/linux/pci.h +0 -1
@@ -414,7 +414,6 @@ struct pci_driver {int (*resume_early) (struct pci_dev *dev);int (*resume) (struct pci_dev *dev);/* Device woken up */ void (*shutdown) (struct pci_dev *dev); -struct pm_ext_ops *pm;struct pci_error_handlers *err_handler;struct device_driver driver;struct pci_dynids dynids;
drivers/pci/pci-driver.c +18 -28
108 lines not on this page · raw message
drivers/base/platform.c +60 -55
223 lines not on this page · raw message
drivers/usb/core/usb.c +2 -2
@@ -286,7 +286,7 @@ static int usb_dev_restore(struct devicereturn usb_resume (dev); } -static struct pm_ops usb_device_pm_ops = { +static struct dev_pm_ops usb_device_pm_ops = { .prepare = usb_dev_prepare, .complete = usb_dev_complete, .suspend = usb_dev_suspend,
@@ -301,7 +301,7 @@ static struct pm_ops usb_device_pm_ops =#define ksuspend_usb_init () 0#define ksuspend_usb_cleanup () do {} while (0) -#define usb_device_pm_ops (*(struct pm_ops *)0) +#define usb_device_pm_ops (*(struct dev_pm_ops *)0)#endif /* CONFIG_PM */
drivers/base/power/main.c +10 -9
@@ -112,7 +112,8 @@ void device_pm_remove(struct device *dev* @ops: PM operations to choose from. * @state: PM transition of the system being carried out. */ -static int pm_op (struct device *dev,struct pm_ops *ops,pm_message_t state) +static int pm_op (struct device *dev,struct dev_pm_ops *ops, +pm_message_t state) {int error =0 ;
@@ -174,7 +175,7 @@ static int pm_op(struct device *dev, str* The operation is executed with interrupts disabled by the only remaining * functional CPU in the system. */ -static int pm_noirq_op (struct device *dev,struct pm_ext_ops *ops, +static int pm_noirq_op (struct device *dev,struct dev_pm_ops *ops,pm_message_t state) {int error =0 ;
@@ -355,7 +356,7 @@ static int resume_device(struct device *if (dev->bus) {if (dev->bus->pm) {pm_dev_dbg (dev, state,"" ); - error =pm_op (dev, &dev->bus->pm->base, state); + error =pm_op (dev, dev->bus->pm, state); }else if (dev->bus->resume) {pm_dev_dbg (dev, state,"legacy " ); error = dev->bus->resume (dev);
@@ -440,9 +441,9 @@ static void complete_device(struct devic dev->type->pm->complete (dev); } -if (dev->bus && dev->bus->pm && dev->bus->pm->base.complete) { +if (dev->bus && dev->bus->pm && dev->bus->pm->complete) {pm_dev_dbg (dev, state,"completing " ); - dev->bus->pm->base.complete (dev); + dev->bus->pm->complete (dev); }up (&dev->sem);
@@ -600,7 +601,7 @@ static int suspend_device(struct deviceif (dev->bus) {if (dev->bus->pm) {pm_dev_dbg (dev, state,"" ); - error =pm_op (dev, &dev->bus->pm->base, state); + error =pm_op (dev, dev->bus->pm, state); }else if (dev->bus->suspend) {pm_dev_dbg (dev, state,"legacy " ); error = dev->bus->suspend (dev, state);
@@ -661,10 +662,10 @@ static int prepare_device(struct devicedown (&dev->sem); -if (dev->bus && dev->bus->pm && dev->bus->pm->base.prepare) { +if (dev->bus && dev->bus->pm && dev->bus->pm->prepare) {pm_dev_dbg (dev, state,"preparing " ); - error = dev->bus->pm->base.prepare (dev); -suspend_report_result (dev->bus->pm->base.prepare, error); + error = dev->bus->pm->prepare (dev); +suspend_report_result (dev->bus->pm->prepare, error);if (error) goto End; }