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] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 24 Aug 2020 23:38:59 +0200
From:   Sebastian Reichel <sebastian.reichel@...labora.com>
To:     Dmitry Osipenko <digetx@...il.com>
Cc:     Lee Jones <lee.jones@...aro.org>, Rob Herring <robh+dt@...nel.org>,
        Thierry Reding <thierry.reding@...il.com>,
        Jonathan Hunter <jonathanh@...dia.com>,
        Pavel Machek <pavel@....cz>, Dan Murphy <dmurphy@...com>,
        Lubomir Rintel <lkundrak@...sk>, devicetree@...r.kernel.org,
        linux-tegra@...r.kernel.org, linux-leds@...r.kernel.org,
        linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 2/6] power: supply: Add battery gauge driver for Acer
 Iconia Tab A500

Hi,

On Mon, Aug 24, 2020 at 09:55:14PM +0300, Dmitry Osipenko wrote:
> 24.08.2020 17:07, Sebastian Reichel пишет:
> >> +static int a500_battery_get_serial_number(struct a500_battery *bat,
> >> +					  union power_supply_propval *val)
> >> +{
> >> +	unsigned int i;
> >> +	s32 ret = 0;
> >> +
> >> +	if (bat->serial[0])
> >> +		goto done;
> >> +
> >> +	a500_ec_lock(bat->ec_chip);
> >> +	for (i = 0; i < BATTERY_SERIAL_LEN / 2; i++) {
> >> +		ret = a500_ec_read_locked(bat->ec_chip,
> >> +					  &ec_data[REG_SERIAL_NUMBER].cmd);
> >> +		if (ret < 0) {
> >> +			bat->serial[0] = '\0';
> >> +			break;
> >> +		}
> >> +
> >> +		bat->serial[i * 2 + 0] = (ret >> 0) & 0xff;
> >> +		bat->serial[i * 2 + 1] = (ret >> 8) & 0xff;
> >> +	}
> >> +	a500_ec_unlock(bat->ec_chip);
> >> +done:
> >> +	val->strval = bat->serial;
> >> +
> >> +	return ret;
> >> +}
> > 
> > If battery is swapped, this will keep the old serial.
> 
> Hello, Sebastian! The battery isn't hot-swappable on A500, but it also
> should be okay to always re-read the serialno. I'll consider removing
> the caching in the v2, thanks.

I assumed it would be hot-swappable because of a500_battery_get_presence().
If it's not hot-swappable, the caching is fine.

-- Sebastian

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