aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/realtek/files-5.10
diff options
context:
space:
mode:
authorINAGAKI Hiroshi <musashino.open@gmail.com>2022-03-29 19:29:34 +0900
committerSander Vanheule <sander@svanheule.net>2022-10-08 11:05:02 +0200
commit9b53a29a58d8cc271a22a207b050e788a6a5573e (patch)
treef749ae4da0df02181e231b8f960cd9d58a0677d1 /target/linux/realtek/files-5.10
parent7d6032f310058d7e9b96d7e1dc4d49c8232beff7 (diff)
downloadupstream-9b53a29a58d8cc271a22a207b050e788a6a5573e.tar.gz
upstream-9b53a29a58d8cc271a22a207b050e788a6a5573e.tar.bz2
upstream-9b53a29a58d8cc271a22a207b050e788a6a5573e.zip
realtek: separate lock of RTL8231 from phy driver
RTL8231 and ethernet phys are not on the same bus, so separate the lock to each own to cut off the unnecessary dependency. Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
Diffstat (limited to 'target/linux/realtek/files-5.10')
-rw-r--r--target/linux/realtek/files-5.10/drivers/gpio/gpio-rtl8231.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/target/linux/realtek/files-5.10/drivers/gpio/gpio-rtl8231.c b/target/linux/realtek/files-5.10/drivers/gpio/gpio-rtl8231.c
index 7a1d6aa136..368c4fa60f 100644
--- a/target/linux/realtek/files-5.10/drivers/gpio/gpio-rtl8231.c
+++ b/target/linux/realtek/files-5.10/drivers/gpio/gpio-rtl8231.c
@@ -29,9 +29,10 @@ struct rtl8231_gpios {
int ext_gpio_indrt_access;
};
-extern struct mutex smi_lock;
extern struct rtl83xx_soc_info soc_info;
+DEFINE_MUTEX(miim_lock);
+
static u32 rtl8231_read(struct rtl8231_gpios *gpios, u32 reg)
{
u32 t = 0, n = 0;
@@ -187,9 +188,9 @@ static int rtl8231_direction_input(struct gpio_chip *gc, unsigned int offset)
struct rtl8231_gpios *gpios = gpiochip_get_data(gc);
pr_debug("%s: %d\n", __func__, offset);
- mutex_lock(&smi_lock);
+ mutex_lock(&miim_lock);
err = rtl8231_pin_dir(gpios, offset, 1);
- mutex_unlock(&smi_lock);
+ mutex_unlock(&miim_lock);
return err;
}
@@ -199,9 +200,9 @@ static int rtl8231_direction_output(struct gpio_chip *gc, unsigned int offset, i
struct rtl8231_gpios *gpios = gpiochip_get_data(gc);
pr_debug("%s: %d\n", __func__, offset);
- mutex_lock(&smi_lock);
+ mutex_lock(&miim_lock);
err = rtl8231_pin_dir(gpios, offset, 0);
- mutex_unlock(&smi_lock);
+ mutex_unlock(&miim_lock);
if (!err)
err = rtl8231_pin_set(gpios, offset, value);
return err;
@@ -213,9 +214,9 @@ static int rtl8231_get_direction(struct gpio_chip *gc, unsigned int offset)
struct rtl8231_gpios *gpios = gpiochip_get_data(gc);
pr_debug("%s: %d\n", __func__, offset);
- mutex_lock(&smi_lock);
+ mutex_lock(&miim_lock);
rtl8231_pin_dir_get(gpios, offset, &v);
- mutex_unlock(&smi_lock);
+ mutex_unlock(&miim_lock);
return v;
}
@@ -224,9 +225,9 @@ static int rtl8231_gpio_get(struct gpio_chip *gc, unsigned int offset)
u16 state = 0;
struct rtl8231_gpios *gpios = gpiochip_get_data(gc);
- mutex_lock(&smi_lock);
+ mutex_lock(&miim_lock);
rtl8231_pin_get(gpios, offset, &state);
- mutex_unlock(&smi_lock);
+ mutex_unlock(&miim_lock);
if (state & (1 << (offset % 16)))
return 1;
return 0;