Skip to content

Commit

Permalink
PXA: Use dev_pm_ops in z2_battery
Browse files Browse the repository at this point in the history
Signed-off-by: Marek Vasut <[email protected]>
Signed-off-by: Anton Vorontsov <[email protected]>
  • Loading branch information
marex authored and enomsg committed May 20, 2011
1 parent 9c6f874 commit 906649d
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions drivers/power/z2_battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,24 +271,33 @@ static int __devexit z2_batt_remove(struct i2c_client *client)
}

#ifdef CONFIG_PM
static int z2_batt_suspend(struct i2c_client *client, pm_message_t state)
static int z2_batt_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct z2_charger *charger = i2c_get_clientdata(client);

flush_work_sync(&charger->bat_work);
return 0;
}

static int z2_batt_resume(struct i2c_client *client)
static int z2_batt_resume(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct z2_charger *charger = i2c_get_clientdata(client);

schedule_work(&charger->bat_work);
return 0;
}

static const struct dev_pm_ops z2_battery_pm_ops = {
.suspend = z2_batt_suspend,
.resume = z2_batt_resume,
};

#define Z2_BATTERY_PM_OPS (&z2_battery_pm_ops)

#else
#define z2_batt_suspend NULL
#define z2_batt_resume NULL
#define Z2_BATTERY_PM_OPS (NULL)
#endif

static const struct i2c_device_id z2_batt_id[] = {
Expand All @@ -301,11 +310,10 @@ static struct i2c_driver z2_batt_driver = {
.driver = {
.name = "z2-battery",
.owner = THIS_MODULE,
.pm = Z2_BATTERY_PM_OPS
},
.probe = z2_batt_probe,
.remove = z2_batt_remove,
.suspend = z2_batt_suspend,
.resume = z2_batt_resume,
.id_table = z2_batt_id,
};

Expand Down

0 comments on commit 906649d

Please sign in to comment.