[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8f09bc42-b85d-446f-bd9d-77155060a4b8@baylibre.com>
Date: Mon, 26 Feb 2024 13:43:51 +0100
From: Julien Panis <jpanis@...libre.com>
To: Bhargav Raviprakash <bhargav.r@...s.com>, linux-kernel@...r.kernel.org
Cc: m.nirmaladevi@...s.com, lee@...nel.org, robh+dt@...nel.org,
krzysztof.kozlowski+dt@...aro.org, conor+dt@...nel.org,
devicetree@...r.kernel.org, arnd@...db.de, gregkh@...uxfoundation.org,
lgirdwood@...il.com, broonie@...nel.org, linus.walleij@...aro.org,
linux-gpio@...r.kernel.org, linux-arm-kernel@...ts.infradead.org, nm@...com,
vigneshr@...com, kristo@...nel.org
Subject: Re: [PATCH v2 08/14] misc: tps6594-pfsm: Add TI TPS65224 PMIC PFSM
On 2/23/24 10:36, Bhargav Raviprakash wrote:
> Add support for TPS65224 PFSM in the TPS6594 PFSM driver
> as they share significant functionality.
>
> Signed-off-by: Bhargav Raviprakash <bhargav.r@...s.com>
> ---
> drivers/misc/tps6594-pfsm.c | 55 +++++++++++++++++++++++++++----------
> 1 file changed, 40 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/misc/tps6594-pfsm.c b/drivers/misc/tps6594-pfsm.c
> index 88dcac814..4fa071093 100644
> --- a/drivers/misc/tps6594-pfsm.c
> +++ b/drivers/misc/tps6594-pfsm.c
> @@ -1,6 +1,6 @@
> // SPDX-License-Identifier: GPL-2.0
> /*
> - * PFSM (Pre-configurable Finite State Machine) driver for TI TPS6594/TPS6593/LP8764 PMICs
> + * PFSM (Pre-configurable Finite State Machine) driver for TI TPS65224/TPS6594/TPS6593/LP8764 PMICs
> *
> * Copyright (C) 2023 BayLibre Incorporated - https://www.baylibre.com/
> */
> @@ -34,15 +34,17 @@
>
> #define TPS6594_FILE_TO_PFSM(f) container_of((f)->private_data, struct tps6594_pfsm, miscdev)
>
> -/**
> +/*
Here it should be /** for the structure documentation, I think.
Please check in kernel doc.
[...]
> @@ -210,8 +230,12 @@ static long tps6594_pfsm_ioctl(struct file *f, unsigned int cmd, unsigned long a
> return ret;
>
> /* Modify NSLEEP1-2 bits */
> - ret = regmap_clear_bits(pfsm->regmap, TPS6594_REG_FSM_NSLEEP_TRIGGERS,
> - TPS6594_BIT_NSLEEP2B);
> + if (pfsm->chip_id == TPS65224)
> + ret = regmap_clear_bits(pfsm->regmap, TPS6594_REG_FSM_NSLEEP_TRIGGERS,
> + TPS6594_BIT_NSLEEP1B);
> + else
> + ret = regmap_clear_bits(pfsm->regmap, TPS6594_REG_FSM_NSLEEP_TRIGGERS,
> + TPS6594_BIT_NSLEEP2B);
Instead of this if/else, a ternary operator might do the trick here:
regmap_clear_bits(pfsm->regmap, TPS6594_REG_FSM_NSLEEP_TRIGGERS,
pfsm->chip_id == TPS65224 ? TPS6594_BIT_NSLEEP1B : TPS6594_BIT_NSLEEP2B)
Julien
Powered by blists - more mailing lists