From: Mattijs Korpershoek <mkorpershoek@baylibre.com>
To: Quentin Schulz <foss+uboot@0leil.net>,
Jaehoon Chung <jh80.chung@samsung.com>,
Tom Rini <trini@konsulko.com>,
Kever Yang <kever.yang@rock-chips.com>
Cc: Simon Glass <sjg@chromium.org>,
u-boot@lists.denx.de, Quentin Schulz <quentin.schulz@cherry.de>
Subject: Re: [PATCH 3/3] regulator: rk8xx: clarify operator precedence
Date: Wed, 05 Jun 2024 13:20:26 +0200 [thread overview]
Message-ID: <87y17jhc05.fsf@baylibre.com> (raw)
In-Reply-To: <20240605-pmic-rk8xx-v1-3-2349fdf68aa0@cherry.de>
Hi Quentin,
Thank you for the patch.
On mer., juin 05, 2024 at 11:33, Quentin Schulz <foss+uboot@0leil.net> wrote:
> From: Quentin Schulz <quentin.schulz@cherry.de>
>
> My linter complains that the order isn't clear enough so let's put
> parentheses around the ternary condition to make it happy.
>
> Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> ---
> drivers/power/regulator/rk8xx.c | 26 +++++++++++++-------------
> 1 file changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/power/regulator/rk8xx.c b/drivers/power/regulator/rk8xx.c
> index bd5a37e718f..3125835bc07 100644
> --- a/drivers/power/regulator/rk8xx.c
> +++ b/drivers/power/regulator/rk8xx.c
> @@ -520,7 +520,7 @@ static int _buck_get_enable(struct udevice *pmic, int buck)
> if (ret < 0)
> return ret;
>
> - return ret & mask ? true : false;
> + return (ret & mask) ? true : false;
> }
>
> static int _buck_set_suspend_enable(struct udevice *pmic, int buck, bool enable)
> @@ -585,7 +585,7 @@ static int _buck_get_suspend_enable(struct udevice *pmic, int buck)
> val = pmic_reg_read(pmic, RK816_REG_DCDC_SLP_EN);
> if (val < 0)
> return val;
> - ret = val & mask ? 1 : 0;
> + ret = (val & mask) ? 1 : 0;
> break;
> case RK806_ID:
> {
> @@ -608,7 +608,7 @@ static int _buck_get_suspend_enable(struct udevice *pmic, int buck)
> val = pmic_reg_read(pmic, REG_SLEEP_SET_OFF1);
> if (val < 0)
> return val;
> - ret = val & mask ? 0 : 1;
> + ret = (val & mask) ? 0 : 1;
> break;
> case RK809_ID:
> case RK817_ID:
> @@ -620,7 +620,7 @@ static int _buck_get_suspend_enable(struct udevice *pmic, int buck)
> val = pmic_reg_read(pmic, RK817_POWER_SLP_EN(0));
> if (val < 0)
> return val;
> - ret = val & mask ? 1 : 0;
> + ret = (val & mask) ? 1 : 0;
> break;
> default:
> ret = -EINVAL;
> @@ -723,7 +723,7 @@ static int _ldo_get_enable(struct udevice *pmic, int ldo)
> if (ret < 0)
> return ret;
>
> - return ret & mask ? true : false;
> + return (ret & mask) ? true : false;
> }
>
> static int _nldo_get_enable(struct udevice *pmic, int nldo)
> @@ -980,7 +980,7 @@ static int _ldo_get_suspend_enable(struct udevice *pmic, int ldo)
> val = pmic_reg_read(pmic, RK816_REG_LDO_SLP_EN);
> if (val < 0)
> return val;
> - ret = val & mask ? 1 : 0;
> + ret = (val & mask) ? 1 : 0;
> break;
> case RK808_ID:
> case RK818_ID:
> @@ -988,7 +988,7 @@ static int _ldo_get_suspend_enable(struct udevice *pmic, int ldo)
> val = pmic_reg_read(pmic, REG_SLEEP_SET_OFF2);
> if (val < 0)
> return val;
> - ret = val & mask ? 0 : 1;
> + ret = (val & mask) ? 0 : 1;
> break;
> case RK809_ID:
> case RK817_ID:
> @@ -997,13 +997,13 @@ static int _ldo_get_suspend_enable(struct udevice *pmic, int ldo)
> val = pmic_reg_read(pmic, RK817_POWER_SLP_EN(0));
> if (val < 0)
> return val;
> - ret = val & mask ? 1 : 0;
> + ret = (val & mask) ? 1 : 0;
> } else {
> mask = 1 << ldo;
> val = pmic_reg_read(pmic, RK817_POWER_SLP_EN(1));
> if (val < 0)
> return val;
> - ret = val & mask ? 1 : 0;
> + ret = (val & mask) ? 1 : 0;
> }
> break;
> }
> @@ -1438,7 +1438,7 @@ static int switch_get_enable(struct udevice *dev)
> if (ret < 0)
> return ret;
>
> - return ret & mask ? true : false;
> + return (ret & mask) ? true : false;
> }
>
> static int switch_set_suspend_value(struct udevice *dev, int uvolt)
> @@ -1493,21 +1493,21 @@ static int switch_get_suspend_enable(struct udevice *dev)
> val = pmic_reg_read(dev->parent, REG_SLEEP_SET_OFF1);
> if (val < 0)
> return val;
> - ret = val & mask ? 0 : 1;
> + ret = (val & mask) ? 0 : 1;
> break;
> case RK809_ID:
> mask = 1 << (sw + 6);
> val = pmic_reg_read(dev->parent, RK817_POWER_SLP_EN(0));
> if (val < 0)
> return val;
> - ret = val & mask ? 1 : 0;
> + ret = (val & mask) ? 1 : 0;
> break;
> case RK818_ID:
> mask = 1 << 6;
> val = pmic_reg_read(dev->parent, REG_SLEEP_SET_OFF1);
> if (val < 0)
> return val;
> - ret = val & mask ? 0 : 1;
> + ret = (val & mask) ? 0 : 1;
> break;
> }
>
>
> --
> 2.45.1
next prev parent reply other threads:[~2024-06-05 11:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-05 9:33 [PATCH 0/3] rockchip: rk8xx: fix broken [np]ldo callbacks Quentin Schulz
2024-06-05 9:33 ` [PATCH 1/3] regulator: rk8xx: fix incorrect device used for _ldo_[sg]et_suspend_value Quentin Schulz
2024-06-06 6:45 ` Kever Yang
2024-06-06 15:04 ` Simon Glass
2024-06-05 9:33 ` [PATCH 2/3] regulator: rk8xx: pass pmic udevice instead of regulator to all internal functions Quentin Schulz
2024-06-06 6:45 ` Kever Yang
2024-06-06 15:04 ` Simon Glass
2024-06-05 9:33 ` [PATCH 3/3] regulator: rk8xx: clarify operator precedence Quentin Schulz
2024-06-05 11:20 ` Mattijs Korpershoek [this message]
2024-06-06 6:46 ` Kever Yang
2024-06-06 15:04 ` Simon Glass
2024-06-05 13:11 ` [PATCH 0/3] rockchip: rk8xx: fix broken [np]ldo callbacks Anand Moon
2024-06-05 16:00 ` Quentin Schulz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y17jhc05.fsf@baylibre.com \
--to=mkorpershoek@baylibre.com \
--cc=foss+uboot@0leil.net \
--cc=jh80.chung@samsung.com \
--cc=kever.yang@rock-chips.com \
--cc=quentin.schulz@cherry.de \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.