aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/realtek/files-5.15/drivers/gpio
diff options
context:
space:
mode:
authorOlliver Schinagl <oliver@schinagl.nl>2022-08-30 21:25:25 +0200
committerSander Vanheule <sander@svanheule.net>2022-12-27 16:31:48 +0100
commit758c88b969639d0e6b684669d2e54dd1be3102f4 (patch)
treee7d26b19583851656d58903b8552daa4d4fe2077 /target/linux/realtek/files-5.15/drivers/gpio
parent2c40359c5c12621fa386efca3139ea523db6d39f (diff)
downloadupstream-758c88b969639d0e6b684669d2e54dd1be3102f4.tar.gz
upstream-758c88b969639d0e6b684669d2e54dd1be3102f4.tar.bz2
upstream-758c88b969639d0e6b684669d2e54dd1be3102f4.zip
realtek: Whitespace and codestyle cleanup
Fix some ugly whitepsaces and codestyle issues around the realtek sources. While this is by no means perfect, it catches what it caught. Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Diffstat (limited to 'target/linux/realtek/files-5.15/drivers/gpio')
-rw-r--r--target/linux/realtek/files-5.15/drivers/gpio/gpio-rtl8231.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/target/linux/realtek/files-5.15/drivers/gpio/gpio-rtl8231.c b/target/linux/realtek/files-5.15/drivers/gpio/gpio-rtl8231.c
index 368c4fa60f..0b0d039059 100644
--- a/target/linux/realtek/files-5.15/drivers/gpio/gpio-rtl8231.c
+++ b/target/linux/realtek/files-5.15/drivers/gpio/gpio-rtl8231.c
@@ -55,7 +55,7 @@ static u32 rtl8231_read(struct rtl8231_gpios *gpios, u32 reg)
if (n >= USEC_TIMEOUT)
return 0x80000000;
-
+
pr_debug("%s: %x, %x, %x\n", __func__, gpios->smi_bus_id,
reg, (t & 0xffff0000) >> 16);
@@ -127,6 +127,7 @@ static int rtl8231_pin_dir(struct rtl8231_gpios *gpios, u32 gpio, u32 dir)
rtl8231_write(gpios, pin_dir_addr, v);
gpios->reg_shadow[pin_dir_addr] = v;
gpios->reg_cached |= 1 << pin_dir_addr;
+
return 0;
}
@@ -150,6 +151,7 @@ static int rtl8231_pin_dir_get(struct rtl8231_gpios *gpios, u32 gpio, u32 *dir)
*dir = 1;
else
*dir = 0;
+
return 0;
}
@@ -166,6 +168,7 @@ static int rtl8231_pin_set(struct rtl8231_gpios *gpios, u32 gpio, u32 data)
rtl8231_write(gpios, RTL8231_GPIO_DATA(gpio), v);
gpios->reg_shadow[RTL8231_GPIO_DATA(gpio)] = v;
gpios->reg_cached |= 1 << RTL8231_GPIO_DATA(gpio);
+
return 0;
}
@@ -179,6 +182,7 @@ static int rtl8231_pin_get(struct rtl8231_gpios *gpios, u32 gpio, u16 *state)
}
*state = v & 0xffff;
+
return 0;
}
@@ -191,6 +195,7 @@ static int rtl8231_direction_input(struct gpio_chip *gc, unsigned int offset)
mutex_lock(&miim_lock);
err = rtl8231_pin_dir(gpios, offset, 1);
mutex_unlock(&miim_lock);
+
return err;
}
@@ -203,8 +208,10 @@ static int rtl8231_direction_output(struct gpio_chip *gc, unsigned int offset, i
mutex_lock(&miim_lock);
err = rtl8231_pin_dir(gpios, offset, 0);
mutex_unlock(&miim_lock);
+
if (!err)
err = rtl8231_pin_set(gpios, offset, value);
+
return err;
}
@@ -217,6 +224,7 @@ static int rtl8231_get_direction(struct gpio_chip *gc, unsigned int offset)
mutex_lock(&miim_lock);
rtl8231_pin_dir_get(gpios, offset, &v);
mutex_unlock(&miim_lock);
+
return v;
}
@@ -228,8 +236,10 @@ static int rtl8231_gpio_get(struct gpio_chip *gc, unsigned int offset)
mutex_lock(&miim_lock);
rtl8231_pin_get(gpios, offset, &state);
mutex_unlock(&miim_lock);
+
if (state & (1 << (offset % 16)))
return 1;
+
return 0;
}
@@ -337,8 +347,7 @@ static int rtl8231_gpio_probe(struct platform_device *pdev)
gpios->gc.get = rtl8231_gpio_get;
gpios->gc.get_direction = rtl8231_get_direction;
- err = devm_gpiochip_add_data(dev, &gpios->gc, gpios);
- return err;
+ return devm_gpiochip_add_data(dev, &gpios->gc, gpios);
}
static struct platform_driver rtl8231_gpio_driver = {