From: INAGAKI Hiroshi Date: Tue, 29 Mar 2022 10:29:34 +0000 (+0900) Subject: realtek: separate lock of RTL8231 from phy driver X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=9b53a29a58d8cc271a22a207b050e788a6a5573e;p=openwrt%2Fstaging%2Fwigyori.git 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 --- 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;