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]
Message-ID: <4FF1C666.40106@metafoo.de>
Date:	Mon, 02 Jul 2012 18:03:50 +0200
From:	Lars-Peter Clausen <lars@...afoo.de>
To:	Saranya Gopal <saranya.gopal@...el.com>
CC:	cbou@...l.ru, dwmw2@...radead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCHv3] bq27x00_battery: Add support for BQ27425 chip

On 06/30/2012 06:56 PM, Saranya Gopal wrote:
> This patch adds support for BQ27425 (TI) chip. This chip is same as
> BQ27500 with few registers removed and register address map changed.
> The data sheet for this chip is publicly available at
>  http://www.ti.com/product/bq27425-g1
> 
> Changes since v2:
>         Remove register address definitions of bq27425 and
>           use register address offset instead.
>         Add a small helper function to decide if the chip version
>           is higher than bq27200 to make it less noisy
>           to add another chip with similar register layout.
> 
> Signed-off-by: Saranya Gopal <saranya.gopal@...el.com>

Looks good to me.

Reviewed-by: Lars-Peter Clausen <lars@...afoo.de>

Two minor suggestions though:

>[...]
>  
>  #include <linux/module.h>
> @@ -67,6 +68,10 @@
>  #define BQ27500_FLAG_SOC1		BIT(2) /* State-of-Charge threshold 1 */
>  #define BQ27500_FLAG_FC			BIT(9)
>  
> +/* bq27425 register addresses are same as bq27x00 addresses minus 4 */
> +#define BQ27425_REG_OFFSET		0x04
> +#define BQ27425_REG_SOC			0x1C
> +

I'd have added the offset to REG_SOC here, ...

> @@ -150,6 +183,9 @@ static int bq27x00_battery_read_rsoc(struct
bq27x00_device_info *di)
>
>  	if (di->chip == BQ27500)
>  		rsoc = bq27x00_read(di, BQ27500_REG_SOC, false);
> +	else if (di->chip == BQ27425)
> +		rsoc = bq27x00_read(di, BQ27425_REG_SOC+BQ27425_REG_OFFSET,
> +								false);

... instead of here.

>  /*
> + * Higher versions of the chip like BQ27425 and BQ27500
> + * differ from BQ27000 and BQ27200 in calculation of certain
> + * parameters. Hence we need to check for the chip type.
> + */
> +static bool is_chip_version_higher(struct bq27x00_device_info *di)

Maybe a prefix for the function is not such a bad idea, e.g. bq27xxx_...

> +{
> +	if (di->chip == BQ27425 || di->chip == BQ27500)
> +		return true;
> +	return false;
> +}
> +
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ