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  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, 22 Oct 2018 00:17:51 +0200
From:   Sebastian Reichel <sre@...nel.org>
To:     Brian Masney <masneyb@...tation.org>
Cc:     andy.gross@...aro.org, robh+dt@...nel.org, mark.rutland@....com,
        david.brown@...aro.org, linux-pm@...r.kernel.org,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-arm-msm@...r.kernel.org, linux-soc@...r.kernel.org,
        jonathan@...ek.ca
Subject: Re: [PATCH RFC 2/5] power: supply: bq24190_charger: add support for
 bq24192 variant

Hi,

On Mon, Oct 01, 2018 at 01:30:02AM -0400, Brian Masney wrote:
> From: Jonathan Marek <jonathan@...ek.ca>
> 
> This patch adds support for the bq24192 variant to bq24190_charger.
> 
> Signed-off-by: Jonathan Marek <jonathan@...ek.ca>
> Signed-off-by: Brian Masney <masneyb@...tation.org>
> ---
>  drivers/power/supply/bq24190_charger.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/power/supply/bq24190_charger.c b/drivers/power/supply/bq24190_charger.c
> index b58df04d03b3..e3836145286d 100644
> --- a/drivers/power/supply/bq24190_charger.c
> +++ b/drivers/power/supply/bq24190_charger.c
> @@ -1638,7 +1638,8 @@ static int bq24190_hw_init(struct bq24190_dev_info *bdi)
>  		return ret;
>  
>  	if (v != BQ24190_REG_VPRS_PN_24190 &&
> -	    v != BQ24190_REG_VPRS_PN_24192I) {
> +		v != BQ24190_REG_VPRS_PN_24192 &&
> +		v != BQ24190_REG_VPRS_PN_24192I) {
>  		dev_err(bdi->dev, "Error unknown model: 0x%02x\n", v);
>  		return -ENODEV;
>  	}

This becomes too ugly. Do it like this instead:

switch(v) {
case BQ24190_REG_VPRS_PN_24190:
case BQ24190_REG_VPRS_PN_24192:
case BQ24190_REG_VPRS_PN_24192I:
    break;
default:
    dev_err(bdi->dev, "Error unknown model: 0x%02x\n", v);
    return -ENODEV;
}

-- Sebastian

> @@ -1931,6 +1932,7 @@ static const struct dev_pm_ops bq24190_pm_ops = {
>  
>  static const struct i2c_device_id bq24190_i2c_ids[] = {
>  	{ "bq24190" },
> +	{ "bq24192" },
>  	{ "bq24192i" },
>  	{ },
>  };
> @@ -1939,6 +1941,7 @@ MODULE_DEVICE_TABLE(i2c, bq24190_i2c_ids);
>  #ifdef CONFIG_OF
>  static const struct of_device_id bq24190_of_match[] = {
>  	{ .compatible = "ti,bq24190", },
> +	{ .compatible = "ti,bq24192", },
>  	{ .compatible = "ti,bq24192i", },
>  	{ },
>  };
> -- 
> 2.17.1
> 

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

Powered by blists - more mailing lists