mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-21 22:47:56 +00:00
62 lines
1.9 KiB
Diff
62 lines
1.9 KiB
Diff
|
From 4210ef801a248223a0ea5f47b5446081b4925e10 Mon Sep 17 00:00:00 2001
|
||
|
From: Andy Shevchenko <andy.shevchenko@gmail.com>
|
||
|
Date: Fri, 29 Mar 2024 12:55:20 +0200
|
||
|
Subject: [PATCH] pinctrl: aw9523: Get rid of redundant ' & U8_MAX' pieces
|
||
|
|
||
|
When the variable is declared as u8, no need to perform ' & U8_MAX'
|
||
|
as it's implied anyway.
|
||
|
|
||
|
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
|
||
|
Message-ID: <20240329105634.712457-7-andy.shevchenko@gmail.com>
|
||
|
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||
|
---
|
||
|
drivers/pinctrl/pinctrl-aw9523.c | 14 +++++++-------
|
||
|
1 file changed, 7 insertions(+), 7 deletions(-)
|
||
|
|
||
|
--- a/drivers/pinctrl/pinctrl-aw9523.c
|
||
|
+++ b/drivers/pinctrl/pinctrl-aw9523.c
|
||
|
@@ -603,7 +603,7 @@ static int aw9523_gpio_get_multiple(stru
|
||
|
mutex_lock(&awi->i2c_lock);
|
||
|
|
||
|
/* Port 0 (gpio 0-7) */
|
||
|
- m = *mask & U8_MAX;
|
||
|
+ m = *mask;
|
||
|
if (m) {
|
||
|
ret = _aw9523_gpio_get_multiple(awi, 0, &state, m);
|
||
|
if (ret)
|
||
|
@@ -612,7 +612,7 @@ static int aw9523_gpio_get_multiple(stru
|
||
|
*bits = state;
|
||
|
|
||
|
/* Port 1 (gpio 8-15) */
|
||
|
- m = (*mask >> 8) & U8_MAX;
|
||
|
+ m = *mask >> 8;
|
||
|
if (m) {
|
||
|
ret = _aw9523_gpio_get_multiple(awi, AW9523_PINS_PER_PORT,
|
||
|
&state, m);
|
||
|
@@ -635,20 +635,20 @@ static void aw9523_gpio_set_multiple(str
|
||
|
unsigned int reg;
|
||
|
int ret;
|
||
|
|
||
|
- mask_lo = *mask & U8_MAX;
|
||
|
- mask_hi = (*mask >> 8) & U8_MAX;
|
||
|
+ mask_lo = *mask;
|
||
|
+ mask_hi = *mask >> 8;
|
||
|
+ bits_lo = *bits;
|
||
|
+ bits_hi = *bits >> 8;
|
||
|
+
|
||
|
mutex_lock(&awi->i2c_lock);
|
||
|
if (mask_hi) {
|
||
|
reg = AW9523_REG_OUT_STATE(AW9523_PINS_PER_PORT);
|
||
|
- bits_hi = (*bits >> 8) & U8_MAX;
|
||
|
-
|
||
|
ret = regmap_write_bits(awi->regmap, reg, mask_hi, bits_hi);
|
||
|
if (ret)
|
||
|
dev_warn(awi->dev, "Cannot write port1 out level\n");
|
||
|
}
|
||
|
if (mask_lo) {
|
||
|
reg = AW9523_REG_OUT_STATE(0);
|
||
|
- bits_lo = *bits & U8_MAX;
|
||
|
ret = regmap_write_bits(awi->regmap, reg, mask_lo, bits_lo);
|
||
|
if (ret)
|
||
|
dev_warn(awi->dev, "Cannot write port0 out level\n");
|