lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Fri, 4 Jun 2021 14:01:56 +0200
From:   Sebastian Reichel <sebastian.reichel@...labora.com>
To:     Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>
Cc:     linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
        Iskren Chernev <iskren.chernev@...il.com>,
        Jonathan Bakker <xc-racer2@...e.ca>,
        Matheus Castello <matheus@...tello.eng.br>,
        Marek Szyprowski <m.szyprowski@...sung.com>
Subject: Re: [RFT PATCH 1/3] power: supply: max17040: remove non-working
 POWER_SUPPLY_PROP_STATUS

Hi,

On Fri, May 07, 2021 at 12:19:25PM -0400, Krzysztof Kozlowski wrote:
> 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 <krzysztof.kozlowski@...onical.com>
> ---

Thanks, I queued the series.

-- Sebastian

>  drivers/power/supply/max17040_battery.c | 32 +++----------------------
>  1 file changed, 3 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/power/supply/max17040_battery.c b/drivers/power/supply/max17040_battery.c
> index 1aab868adabf..12854c87df53 100644
> --- a/drivers/power/supply/max17040_battery.c
> +++ b/drivers/power/supply/max17040_battery.c
> @@ -147,8 +147,6 @@ struct max17040_chip {
>  
>  	/* battery capacity */
>  	int soc;
> -	/* State Of Charge */
> -	int status;
>  	/* Low alert threshold from 32% to 1% of the State of Charge */
>  	u32 low_soc_alert;
>  	/* some devices return twice the capacity */
> @@ -225,24 +223,6 @@ static int max17040_get_online(struct max17040_chip *chip)
>  		chip->pdata->battery_online() : 1;
>  }
>  
> -static int max17040_get_status(struct max17040_chip *chip)
> -{
> -	if (!chip->pdata || !chip->pdata->charger_online
> -			|| !chip->pdata->charger_enable)
> -		return POWER_SUPPLY_STATUS_UNKNOWN;
> -
> -	if (max17040_get_soc(chip) > MAX17040_BATTERY_FULL)
> -		return POWER_SUPPLY_STATUS_FULL;
> -
> -	if (chip->pdata->charger_online())
> -		if (chip->pdata->charger_enable())
> -			return POWER_SUPPLY_STATUS_CHARGING;
> -		else
> -			return POWER_SUPPLY_STATUS_NOT_CHARGING;
> -	else
> -		return POWER_SUPPLY_STATUS_DISCHARGING;
> -}
> -
>  static int max17040_get_of_data(struct max17040_chip *chip)
>  {
>  	struct device *dev = &chip->client->dev;
> @@ -283,7 +263,6 @@ static int max17040_get_of_data(struct max17040_chip *chip)
>  static void max17040_check_changes(struct max17040_chip *chip)
>  {
>  	chip->soc = max17040_get_soc(chip);
> -	chip->status = max17040_get_status(chip);
>  }
>  
>  static void max17040_queue_work(struct max17040_chip *chip)
> @@ -302,17 +281,16 @@ static void max17040_stop_work(void *data)
>  static void max17040_work(struct work_struct *work)
>  {
>  	struct max17040_chip *chip;
> -	int last_soc, last_status;
> +	int last_soc;
>  
>  	chip = container_of(work, struct max17040_chip, work.work);
>  
> -	/* store SOC and status to check changes */
> +	/* store SOC to check changes */
>  	last_soc = chip->soc;
> -	last_status = chip->status;
>  	max17040_check_changes(chip);
>  
>  	/* check changes and send uevent */
> -	if (last_soc != chip->soc || last_status != chip->status)
> +	if (last_soc != chip->soc)
>  		power_supply_changed(chip->battery);
>  
>  	max17040_queue_work(chip);
> @@ -415,9 +393,6 @@ static int max17040_get_property(struct power_supply *psy,
>  	struct max17040_chip *chip = power_supply_get_drvdata(psy);
>  
>  	switch (psp) {
> -	case POWER_SUPPLY_PROP_STATUS:
> -		val->intval = max17040_get_status(chip);
> -		break;
>  	case POWER_SUPPLY_PROP_ONLINE:
>  		val->intval = max17040_get_online(chip);
>  		break;
> @@ -444,7 +419,6 @@ static const struct regmap_config max17040_regmap = {
>  };
>  
>  static enum power_supply_property max17040_battery_props[] = {
> -	POWER_SUPPLY_PROP_STATUS,
>  	POWER_SUPPLY_PROP_ONLINE,
>  	POWER_SUPPLY_PROP_VOLTAGE_NOW,
>  	POWER_SUPPLY_PROP_CAPACITY,
> -- 
> 2.25.1
> 

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ