[openwrt/openwrt] realtek: separate lock of RTL8231 from phy driver

LEDE Commits lede-commits at lists.infradead.org
Sat Oct 8 03:05:23 PDT 2022


svanheule pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/9b53a29a58d8cc271a22a207b050e788a6a5573e

commit 9b53a29a58d8cc271a22a207b050e788a6a5573e
Author: INAGAKI Hiroshi <musashino.open at gmail.com>
AuthorDate: Tue Mar 29 19:29:34 2022 +0900

    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 at gmail.com>
---
 .../realtek/files-5.10/drivers/gpio/gpio-rtl8231.c    | 19 ++++++++++---------
 1 file 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;




More information about the lede-commits mailing list