Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

max17040_battery: Use dev_pm_ops

Use dev_pm_ops instead of the deprecated legacy suspend/resume callbacks.

Cc: Minkyu Kang <mk7.kang@samsung.com>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Minkyu Kang <mk7.kang@samsung.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>

authored by

Lars-Peter Clausen and committed by
Anton Vorontsov
43cf454a cc6616f6

+11 -9
+11 -9
drivers/power/max17040_battery.c
··· 246 246 return 0; 247 247 } 248 248 249 - #ifdef CONFIG_PM 249 + #ifdef CONFIG_PM_SLEEP 250 250 251 - static int max17040_suspend(struct i2c_client *client, 252 - pm_message_t state) 251 + static int max17040_suspend(struct device *dev) 253 252 { 253 + struct i2c_client *client = to_i2c_client(dev); 254 254 struct max17040_chip *chip = i2c_get_clientdata(client); 255 255 256 256 cancel_delayed_work(&chip->work); 257 257 return 0; 258 258 } 259 259 260 - static int max17040_resume(struct i2c_client *client) 260 + static int max17040_resume(struct device *dev) 261 261 { 262 + struct i2c_client *client = to_i2c_client(dev); 262 263 struct max17040_chip *chip = i2c_get_clientdata(client); 263 264 264 265 schedule_delayed_work(&chip->work, MAX17040_DELAY); 265 266 return 0; 266 267 } 267 268 269 + static SIMPLE_DEV_PM_OPS(max17040_pm_ops, max17040_suspend, max17040_resume); 270 + #define MAX17040_PM_OPS (&max17040_pm_ops) 271 + 268 272 #else 269 273 270 - #define max17040_suspend NULL 271 - #define max17040_resume NULL 274 + #define MAX17040_PM_OPS NULL 272 275 273 - #endif /* CONFIG_PM */ 276 + #endif /* CONFIG_PM_SLEEP */ 274 277 275 278 static const struct i2c_device_id max17040_id[] = { 276 279 { "max17040", 0 }, ··· 284 281 static struct i2c_driver max17040_i2c_driver = { 285 282 .driver = { 286 283 .name = "max17040", 284 + .pm = MAX17040_PM_OPS, 287 285 }, 288 286 .probe = max17040_probe, 289 287 .remove = max17040_remove, 290 - .suspend = max17040_suspend, 291 - .resume = max17040_resume, 292 288 .id_table = max17040_id, 293 289 }; 294 290 module_i2c_driver(max17040_i2c_driver);