Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1630695 > unrolled thread

[PATCH 1/2] power: supply: sbs-battery: Don't ignore the first external power change

Started byPaul Kocialkowski <contact@paulk.fr>
First post2017-04-25 17:40 +0200
Last post2017-05-01 13:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/2] power: supply: sbs-battery: Don't ignore the first external power change Paul Kocialkowski <contact@paulk.fr> - 2017-04-25 17:40 +0200
    Re: [PATCH 1/2] power: supply: sbs-battery: Don't ignore the first  external power change Sebastian Reichel <sebastian.reichel@collabora.co.uk> - 2017-05-01 13:40 +0200

#1630695 — [PATCH 1/2] power: supply: sbs-battery: Don't ignore the first external power change

FromPaul Kocialkowski <contact@paulk.fr>
Date2017-04-25 17:40 +0200
Subject[PATCH 1/2] power: supply: sbs-battery: Don't ignore the first external power change
Message-ID<tAaJl-6y9-39@gated-at.bofh.it>
A mechanism to ignore the first external power change notification was
put in place years ago to ignore the power_supply_register notification.

However, this doesn't apply to the current situation anymore, as the
first notification is always the result of a legitimate power change.

This removes this deprecated mechanism, which puts back the driver's
state machine to a sane state (an ignored first notification previously
caused a charging/discharging status inversion).

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
 drivers/power/supply/sbs-battery.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c
index 8bb2eb38eb1c..3e7125c8e4d1 100644
--- a/drivers/power/supply/sbs-battery.c
+++ b/drivers/power/supply/sbs-battery.c
@@ -171,7 +171,6 @@ struct sbs_info {
 	u32				i2c_retry_count;
 	u32				poll_retry_count;
 	struct delayed_work		work;
-	int				ignore_changes;
 };
 
 static char model_name[I2C_SMBUS_BLOCK_MAX + 1];
@@ -694,11 +693,6 @@ static void sbs_external_power_changed(struct power_supply *psy)
 {
 	struct sbs_info *chip = power_supply_get_drvdata(psy);
 
-	if (chip->ignore_changes > 0) {
-		chip->ignore_changes--;
-		return;
-	}
-
 	/* cancel outstanding work */
 	cancel_delayed_work_sync(&chip->work);
 
@@ -775,10 +769,6 @@ static int sbs_probe(struct i2c_client *client,
 	chip->enable_detection = false;
 	psy_cfg.of_node = client->dev.of_node;
 	psy_cfg.drv_data = chip;
-	/* ignore first notification of external change, it is generated
-	 * from the power_supply_register call back
-	 */
-	chip->ignore_changes = 1;
 	chip->last_state = POWER_SUPPLY_STATUS_UNKNOWN;
 
 	/* use pdata if available, fall back to DT properties,
-- 
2.12.2

[toc] | [next] | [standalone]


#1633615 — Re: [PATCH 1/2] power: supply: sbs-battery: Don't ignore the first external power change

FromSebastian Reichel <sebastian.reichel@collabora.co.uk>
Date2017-05-01 13:40 +0200
SubjectRe: [PATCH 1/2] power: supply: sbs-battery: Don't ignore the first external power change
Message-ID<tChQm-8m-17@gated-at.bofh.it>
In reply to#1630695

[Multipart message — attachments visible in raw view] — view raw

Hi,

On Tue, Apr 25, 2017 at 05:09:04PM +0200, Paul Kocialkowski wrote:
> A mechanism to ignore the first external power change notification was
> put in place years ago to ignore the power_supply_register notification.
> 
> However, this doesn't apply to the current situation anymore, as the
> first notification is always the result of a legitimate power change.
> 
> This removes this deprecated mechanism, which puts back the driver's
> state machine to a sane state (an ignored first notification previously
> caused a charging/discharging status inversion).
> 
> Signed-off-by: Paul Kocialkowski <contact@paulk.fr>

Thanks, queued.

-- Sebastian

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web