From patchwork Thu Oct 6 20:56:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sander Vanheule X-Patchwork-Id: 1687189 X-Patchwork-Delegate: sander@svanheule.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=uuoO2+D8; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=svanheule.net header.i=@svanheule.net header.a=rsa-sha256 header.s=mail1707 header.b=QfOUxC1F; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Mk3k271cqz23jg for ; Fri, 7 Oct 2022 08:00:26 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gVThrZrA00hgvbuCDnxN+6iDDYwAW++4epGtkzB4y20=; b=uuoO2+D8u4eW4F XKZlkeGI1VwS5WacNITYD/Fx78ABylLiEC5SDF8+MEKChSRik3rfTDOmzs5dL91P7VkWSRMFXMG/v LiSTAa0bRWyBJ8doIxAElA6wTUFs9/LXSK4KQFpR10QAKnUUy1jsSfqDc/6y/cfOga+ogK7fLaCkz aqPjEvAnTKssTyfBVNxQgN2fCeXSvcLQokvq92p26EgMoTkXZeLmU4OvEsA7iMQObtYHLGW/Xl1O+ RDGnG4E99Rt+m6Xrs7h1X24kHPIVs3jHINEXHws/lfhjkP5rzcYbW1R+TV/bNfv0NNq0VKn34frFu 5T8i7OEIRzWj0qk5RCkA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ogXvb-005B4K-Hn; Thu, 06 Oct 2022 20:57:11 +0000 Received: from polaris.svanheule.net ([2a00:c98:2060:a004:1::200]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ogXvC-005Aox-EF for openwrt-devel@lists.openwrt.org; Thu, 06 Oct 2022 20:56:54 +0000 Received: from terra.. (247.72-129-109.adsl-dyn.isp.belgacom.be [109.129.72.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: sander@svanheule.net) by polaris.svanheule.net (Postfix) with ESMTPSA id E6D5F32CD24; Thu, 6 Oct 2022 22:56:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svanheule.net; s=mail1707; t=1665089799; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rkSVcFoFDHGC+5rrSRjf3zc3vIAmukiUBF9YE7P57Ts=; b=QfOUxC1FX6gcqT09FTz93ht6FyzYUmfQdPXCO7RHimc6mwd10u2WRX5t4l40M0NTqo6Aub scPcIXX/waChcllmXc8V5tNe6SScZwDUJUHLSPR0CYp8ThXAcSOn6TpqlRyyhMOKnWBlRu 0PiyeGxqoApVWxgdDsrL2dugf/I/XzR9jo7vxX3Nzrf0frna/iX+0YfvrJwbSEKRsC/HEJ flQOTMzoN8xvpFIW82GhdrNoybEiKG/NmEewTPIei0n6ez6xckvSyy61LDz4jxz3WDjXz6 qWpAIvr/lqFyRvNHxhJXyRxvHaIP2nurMNT1g1cFQAiTfyj/k7cY0L3j5TcxzQ== From: Sander Vanheule To: openwrt-devel@lists.openwrt.org Cc: Sander Vanheule , INAGAKI Hiroshi Subject: [PATCH 1/8] realtek: separate lock of RTL8231 from phy driver Date: Thu, 6 Oct 2022 22:56:26 +0200 Message-Id: <5166139771aabbf3f1dedf27eb4cfd5ef2ca05a3.1665089731.git.sander@svanheule.net> X-Mailer: git-send-email 2.37.3 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221006_135652_813605_41A4D387 X-CRM114-Status: UNSURE ( 8.52 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.5 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: INAGAKI Hiroshi 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 --- .../files-5.10/drivers/gpio/gpio-rtl8231.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) Content analysis details: (-2.5 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [2a00:c98:2060:a004:1:0:0:200 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: INAGAKI Hiroshi 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 --- .../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 7a1d6aa136ad..368c4fa60fb9 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;