Skip to content

Commit c603bec

Browse files
krzksre
authored andcommitted
power: supply: max17040: remove non-working POWER_SUPPLY_PROP_STATUS
The driver was reporting POWER_SUPPLY_PROP_STATUS via platform data functions. Without platform data, the max17040_get_status() functions returns early with POWER_SUPPLY_STATUS_UNKNOWN. Since there are no platforms using the driver with platform data (no board files with the driver), the status property was always unknown. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
1 parent 8ef9f68 commit c603bec

File tree

1 file changed

+3
-29
lines changed

1 file changed

+3
-29
lines changed

drivers/power/supply/max17040_battery.c

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,6 @@ struct max17040_chip {
147147

148148
/* battery capacity */
149149
int soc;
150-
/* State Of Charge */
151-
int status;
152150
/* Low alert threshold from 32% to 1% of the State of Charge */
153151
u32 low_soc_alert;
154152
/* some devices return twice the capacity */
@@ -225,24 +223,6 @@ static int max17040_get_online(struct max17040_chip *chip)
225223
chip->pdata->battery_online() : 1;
226224
}
227225

228-
static int max17040_get_status(struct max17040_chip *chip)
229-
{
230-
if (!chip->pdata || !chip->pdata->charger_online
231-
|| !chip->pdata->charger_enable)
232-
return POWER_SUPPLY_STATUS_UNKNOWN;
233-
234-
if (max17040_get_soc(chip) > MAX17040_BATTERY_FULL)
235-
return POWER_SUPPLY_STATUS_FULL;
236-
237-
if (chip->pdata->charger_online())
238-
if (chip->pdata->charger_enable())
239-
return POWER_SUPPLY_STATUS_CHARGING;
240-
else
241-
return POWER_SUPPLY_STATUS_NOT_CHARGING;
242-
else
243-
return POWER_SUPPLY_STATUS_DISCHARGING;
244-
}
245-
246226
static int max17040_get_of_data(struct max17040_chip *chip)
247227
{
248228
struct device *dev = &chip->client->dev;
@@ -283,7 +263,6 @@ static int max17040_get_of_data(struct max17040_chip *chip)
283263
static void max17040_check_changes(struct max17040_chip *chip)
284264
{
285265
chip->soc = max17040_get_soc(chip);
286-
chip->status = max17040_get_status(chip);
287266
}
288267

289268
static void max17040_queue_work(struct max17040_chip *chip)
@@ -302,17 +281,16 @@ static void max17040_stop_work(void *data)
302281
static void max17040_work(struct work_struct *work)
303282
{
304283
struct max17040_chip *chip;
305-
int last_soc, last_status;
284+
int last_soc;
306285

307286
chip = container_of(work, struct max17040_chip, work.work);
308287

309-
/* store SOC and status to check changes */
288+
/* store SOC to check changes */
310289
last_soc = chip->soc;
311-
last_status = chip->status;
312290
max17040_check_changes(chip);
313291

314292
/* check changes and send uevent */
315-
if (last_soc != chip->soc || last_status != chip->status)
293+
if (last_soc != chip->soc)
316294
power_supply_changed(chip->battery);
317295

318296
max17040_queue_work(chip);
@@ -413,9 +391,6 @@ static int max17040_get_property(struct power_supply *psy,
413391
struct max17040_chip *chip = power_supply_get_drvdata(psy);
414392

415393
switch (psp) {
416-
case POWER_SUPPLY_PROP_STATUS:
417-
val->intval = max17040_get_status(chip);
418-
break;
419394
case POWER_SUPPLY_PROP_ONLINE:
420395
val->intval = max17040_get_online(chip);
421396
break;
@@ -442,7 +417,6 @@ static const struct regmap_config max17040_regmap = {
442417
};
443418

444419
static enum power_supply_property max17040_battery_props[] = {
445-
POWER_SUPPLY_PROP_STATUS,
446420
POWER_SUPPLY_PROP_ONLINE,
447421
POWER_SUPPLY_PROP_VOLTAGE_NOW,
448422
POWER_SUPPLY_PROP_CAPACITY,

0 commit comments

Comments
 (0)