linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] power: supply: sbs-battery: remove unused enable_detection flags
@ 2020-08-11  4:41 Ikjoon Jang
  2020-08-27 21:58 ` Sebastian Reichel
  0 siblings, 1 reply; 2+ messages in thread
From: Ikjoon Jang @ 2020-08-11  4:41 UTC (permalink / raw)
  To: Sebastian Reichel, linux-pm; +Cc: linux-kernel, Ikjoon Jang

Remove unused enable_detection flag which is always true after
the device is proved.

Signed-off-by: Ikjoon Jang <ikjn@chromium.org>
---
v2: initialize work queue before registering power supply
---
 drivers/power/supply/sbs-battery.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c
index 83b9924033bd..1b706adc8d43 100644
--- a/drivers/power/supply/sbs-battery.c
+++ b/drivers/power/supply/sbs-battery.c
@@ -185,7 +185,6 @@ struct sbs_info {
 	struct power_supply		*power_supply;
 	bool				is_present;
 	struct gpio_desc		*gpio_detect;
-	bool				enable_detection;
 	bool				charger_broadcasts;
 	int				last_state;
 	int				poll_time;
@@ -876,9 +875,6 @@ static int sbs_get_property(struct power_supply *psy,
 		return -EINVAL;
 	}
 
-	if (!chip->enable_detection)
-		goto done;
-
 	if (!chip->gpio_detect &&
 		chip->is_present != (ret >= 0)) {
 		sbs_update_presence(chip, (ret >= 0));
@@ -1007,7 +1003,6 @@ static int sbs_probe(struct i2c_client *client)
 
 	chip->flags = (u32)(uintptr_t)device_get_match_data(&client->dev);
 	chip->client = client;
-	chip->enable_detection = false;
 	psy_cfg.of_node = client->dev.of_node;
 	psy_cfg.drv_data = chip;
 	chip->last_state = POWER_SUPPLY_STATUS_UNKNOWN;
@@ -1077,6 +1072,8 @@ static int sbs_probe(struct i2c_client *client)
 		}
 	}
 
+	INIT_DELAYED_WORK(&chip->work, sbs_delayed_work);
+
 	chip->power_supply = devm_power_supply_register(&client->dev, sbs_desc,
 						   &psy_cfg);
 	if (IS_ERR(chip->power_supply)) {
@@ -1089,10 +1086,6 @@ static int sbs_probe(struct i2c_client *client)
 	dev_info(&client->dev,
 		"%s: battery gas gauge device registered\n", client->name);
 
-	INIT_DELAYED_WORK(&chip->work, sbs_delayed_work);
-
-	chip->enable_detection = true;
-
 	return 0;
 
 exit_psupply:
-- 
2.28.0.236.gb10cc79966-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] power: supply: sbs-battery: remove unused enable_detection flags
  2020-08-11  4:41 [PATCH v2] power: supply: sbs-battery: remove unused enable_detection flags Ikjoon Jang
@ 2020-08-27 21:58 ` Sebastian Reichel
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2020-08-27 21:58 UTC (permalink / raw)
  To: Ikjoon Jang; +Cc: linux-pm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2184 bytes --]

Hi,

On Tue, Aug 11, 2020 at 12:41:41PM +0800, Ikjoon Jang wrote:
> Remove unused enable_detection flag which is always true after
> the device is proved.
> 
> Signed-off-by: Ikjoon Jang <ikjn@chromium.org>
> ---
> v2: initialize work queue before registering power supply
> ---

Thanks, queued.

-- Sebastian

>  drivers/power/supply/sbs-battery.c | 11 ++---------
>  1 file changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c
> index 83b9924033bd..1b706adc8d43 100644
> --- a/drivers/power/supply/sbs-battery.c
> +++ b/drivers/power/supply/sbs-battery.c
> @@ -185,7 +185,6 @@ struct sbs_info {
>  	struct power_supply		*power_supply;
>  	bool				is_present;
>  	struct gpio_desc		*gpio_detect;
> -	bool				enable_detection;
>  	bool				charger_broadcasts;
>  	int				last_state;
>  	int				poll_time;
> @@ -876,9 +875,6 @@ static int sbs_get_property(struct power_supply *psy,
>  		return -EINVAL;
>  	}
>  
> -	if (!chip->enable_detection)
> -		goto done;
> -
>  	if (!chip->gpio_detect &&
>  		chip->is_present != (ret >= 0)) {
>  		sbs_update_presence(chip, (ret >= 0));
> @@ -1007,7 +1003,6 @@ static int sbs_probe(struct i2c_client *client)
>  
>  	chip->flags = (u32)(uintptr_t)device_get_match_data(&client->dev);
>  	chip->client = client;
> -	chip->enable_detection = false;
>  	psy_cfg.of_node = client->dev.of_node;
>  	psy_cfg.drv_data = chip;
>  	chip->last_state = POWER_SUPPLY_STATUS_UNKNOWN;
> @@ -1077,6 +1072,8 @@ static int sbs_probe(struct i2c_client *client)
>  		}
>  	}
>  
> +	INIT_DELAYED_WORK(&chip->work, sbs_delayed_work);
> +
>  	chip->power_supply = devm_power_supply_register(&client->dev, sbs_desc,
>  						   &psy_cfg);
>  	if (IS_ERR(chip->power_supply)) {
> @@ -1089,10 +1086,6 @@ static int sbs_probe(struct i2c_client *client)
>  	dev_info(&client->dev,
>  		"%s: battery gas gauge device registered\n", client->name);
>  
> -	INIT_DELAYED_WORK(&chip->work, sbs_delayed_work);
> -
> -	chip->enable_detection = true;
> -
>  	return 0;
>  
>  exit_psupply:
> -- 
> 2.28.0.236.gb10cc79966-goog
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-27 21:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-11  4:41 [PATCH v2] power: supply: sbs-battery: remove unused enable_detection flags Ikjoon Jang
2020-08-27 21:58 ` Sebastian Reichel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).