.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * I2C client/driver for the Maxim/Dallas DS2782 Stand-Alone Fuel Gauge IC |
---|
3 | 4 | * |
---|
.. | .. |
---|
8 | 9 | * DS2786 added by Yulia Vilensky <vilensky@compulab.co.il> |
---|
9 | 10 | * |
---|
10 | 11 | * UEvent sending added by Evgeny Romanov <romanov@neurosoft.ru> |
---|
11 | | - * |
---|
12 | | - * This program is free software; you can redistribute it and/or modify |
---|
13 | | - * it under the terms of the GNU General Public License version 2 as |
---|
14 | | - * published by the Free Software Foundation. |
---|
15 | | - * |
---|
16 | 12 | */ |
---|
17 | 13 | |
---|
18 | 14 | #include <linux/kernel.h> |
---|
.. | .. |
---|
319 | 315 | static int ds278x_battery_remove(struct i2c_client *client) |
---|
320 | 316 | { |
---|
321 | 317 | struct ds278x_info *info = i2c_get_clientdata(client); |
---|
| 318 | + int id = info->id; |
---|
322 | 319 | |
---|
323 | 320 | power_supply_unregister(info->battery); |
---|
| 321 | + cancel_delayed_work_sync(&info->bat_work); |
---|
324 | 322 | kfree(info->battery_desc.name); |
---|
| 323 | + kfree(info); |
---|
325 | 324 | |
---|
326 | 325 | mutex_lock(&battery_lock); |
---|
327 | | - idr_remove(&battery_id, info->id); |
---|
| 326 | + idr_remove(&battery_id, id); |
---|
328 | 327 | mutex_unlock(&battery_lock); |
---|
329 | 328 | |
---|
330 | | - cancel_delayed_work(&info->bat_work); |
---|
331 | | - |
---|
332 | | - kfree(info); |
---|
333 | 329 | return 0; |
---|
334 | 330 | } |
---|
335 | 331 | |
---|
.. | .. |
---|
471 | 467 | module_i2c_driver(ds278x_battery_driver); |
---|
472 | 468 | |
---|
473 | 469 | MODULE_AUTHOR("Ryan Mallon"); |
---|
474 | | -MODULE_DESCRIPTION("Maxim/Dallas DS2782 Stand-Alone Fuel Gauage IC driver"); |
---|
| 470 | +MODULE_DESCRIPTION("Maxim/Dallas DS2782 Stand-Alone Fuel Gauge IC driver"); |
---|
475 | 471 | MODULE_LICENSE("GPL"); |
---|