Skip to content

Commit

Permalink
PM / core: Drop legacy class suspend/resume operations
Browse files Browse the repository at this point in the history
There are no classes using the legacy suspend/resume operations in
the tree any more, so drop these operations and update the code
referring to them accordingly.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Rafael J. Wysocki committed Sep 25, 2017
1 parent e19b205 commit a380f2e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 28 deletions.
32 changes: 9 additions & 23 deletions drivers/base/power/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -848,16 +848,10 @@ static int device_resume(struct device *dev, pm_message_t state, bool async)
goto Driver;
}

if (dev->class) {
if (dev->class->pm) {
info = "class ";
callback = pm_op(dev->class->pm, state);
goto Driver;
} else if (dev->class->resume) {
info = "legacy class ";
callback = dev->class->resume;
goto End;
}
if (dev->class && dev->class->pm) {
info = "class ";
callback = pm_op(dev->class->pm, state);
goto Driver;
}

if (dev->bus) {
Expand Down Expand Up @@ -1508,17 +1502,10 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
goto Run;
}

if (dev->class) {
if (dev->class->pm) {
info = "class ";
callback = pm_op(dev->class->pm, state);
goto Run;
} else if (dev->class->suspend) {
pm_dev_dbg(dev, state, "legacy class ");
error = legacy_suspend(dev, state, dev->class->suspend,
"legacy class ");
goto End;
}
if (dev->class && dev->class->pm) {
info = "class ";
callback = pm_op(dev->class->pm, state);
goto Run;
}

if (dev->bus) {
Expand Down Expand Up @@ -1862,8 +1849,7 @@ void device_pm_check_callbacks(struct device *dev)
dev->power.no_pm_callbacks =
(!dev->bus || (pm_ops_is_empty(dev->bus->pm) &&
!dev->bus->suspend && !dev->bus->resume)) &&
(!dev->class || (pm_ops_is_empty(dev->class->pm) &&
!dev->class->suspend && !dev->class->resume)) &&
(!dev->class || pm_ops_is_empty(dev->class->pm)) &&
(!dev->type || pm_ops_is_empty(dev->type->pm)) &&
(!dev->pm_domain || pm_ops_is_empty(&dev->pm_domain->ops)) &&
(!dev->driver || (pm_ops_is_empty(dev->driver->pm) &&
Expand Down
5 changes: 0 additions & 5 deletions include/linux/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,6 @@ int subsys_virtual_register(struct bus_type *subsys,
* @devnode: Callback to provide the devtmpfs.
* @class_release: Called to release this class.
* @dev_release: Called to release the device.
* @suspend: Used to put the device to sleep mode, usually to a low power
* state.
* @resume: Used to bring the device from the sleep mode.
* @shutdown_pre: Called at shut-down time before driver shutdown.
* @ns_type: Callbacks so sysfs can detemine namespaces.
* @namespace: Namespace of the device belongs to this class.
Expand Down Expand Up @@ -402,8 +399,6 @@ struct class {
void (*class_release)(struct class *class);
void (*dev_release)(struct device *dev);

int (*suspend)(struct device *dev, pm_message_t state);
int (*resume)(struct device *dev);
int (*shutdown_pre)(struct device *dev);

const struct kobj_ns_type_operations *ns_type;
Expand Down

0 comments on commit a380f2e

Please sign in to comment.