Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 906649de authored by Marek Vasut's avatar Marek Vasut Committed by Anton Vorontsov
Browse files

PXA: Use dev_pm_ops in z2_battery

parent 9c6f8740
Loading
Loading
Loading
Loading
+14 −6
Original line number Original line Diff line number Diff line
@@ -271,24 +271,33 @@ static int __devexit z2_batt_remove(struct i2c_client *client)
}
}


#ifdef CONFIG_PM
#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);
	struct z2_charger *charger = i2c_get_clientdata(client);


	flush_work_sync(&charger->bat_work);
	flush_work_sync(&charger->bat_work);
	return 0;
	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);
	struct z2_charger *charger = i2c_get_clientdata(client);


	schedule_work(&charger->bat_work);
	schedule_work(&charger->bat_work);
	return 0;
	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
#else
#define z2_batt_suspend NULL
#define	Z2_BATTERY_PM_OPS	(NULL)
#define z2_batt_resume NULL
#endif
#endif


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