Skip to content

Commit

Permalink
PNP: convert PNP driver bus legacy pm_ops to dev_pm_ops
Browse files Browse the repository at this point in the history
Convert drivers/pnp/driver.c bus legacy pm_ops to dev_pm_ops using
existing suspend and resume routines.  Add freeze interface to
handle PM_EVENT_FREEZE correctly with dev_pm_ops.  pm_op() looks for
freeze interface when the event is PM_EVENT_FREEZE.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Shuah Khan authored and Rafael J. Wysocki committed Jul 27, 2013
1 parent 3b2f64d commit eaf140b
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions drivers/pnp/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ static int pnp_bus_match(struct device *dev, struct device_driver *drv)
return 1;
}

static int pnp_bus_suspend(struct device *dev, pm_message_t state)
static int __pnp_bus_suspend(struct device *dev, pm_message_t state)
{
struct pnp_dev *pnp_dev = to_pnp_dev(dev);
struct pnp_driver *pnp_drv = pnp_dev->driver;
Expand All @@ -180,6 +180,16 @@ static int pnp_bus_suspend(struct device *dev, pm_message_t state)
return 0;
}

static int pnp_bus_suspend(struct device *dev)
{
return __pnp_bus_suspend(dev, PMSG_SUSPEND);
}

static int pnp_bus_freeze(struct device *dev)
{
return __pnp_bus_suspend(dev, PMSG_FREEZE);
}

static int pnp_bus_resume(struct device *dev)
{
struct pnp_dev *pnp_dev = to_pnp_dev(dev);
Expand Down Expand Up @@ -210,14 +220,19 @@ static int pnp_bus_resume(struct device *dev)
return 0;
}

static const struct dev_pm_ops pnp_bus_dev_pm_ops = {
.suspend = pnp_bus_suspend,
.freeze = pnp_bus_freeze,
.resume = pnp_bus_resume,
};

struct bus_type pnp_bus_type = {
.name = "pnp",
.match = pnp_bus_match,
.probe = pnp_device_probe,
.remove = pnp_device_remove,
.shutdown = pnp_device_shutdown,
.suspend = pnp_bus_suspend,
.resume = pnp_bus_resume,
.pm = &pnp_bus_dev_pm_ops,
.dev_attrs = pnp_interface_attrs,
};

Expand Down

0 comments on commit eaf140b

Please sign in to comment.