Article View: linux.kernel.netdev
Article #16380Re: [PATCH net-next] net: dsa: motorcomm: Resync SMI slave after interrupted MDIO access
From: Andrew Lunn
Date: Sat, 14 Nov 2026 15:40
Date: Sat, 14 Nov 2026 15:40
30 lines
9025 bytes
9025 bytes
> static int yt921x_reg_mdio_read(void *context, u32 reg, u32 *valp)
> {
> struct yt921x_reg_mdio *mdio = context;
> @@ -108,6 +196,12 @@ static int yt921x_reg_mdio_read(void *context, u32 reg, u32 *valp)
> u32 val;
> int res;
>
> + if (!mdio->synced) {
> + res = yt921x_reg_mdio_resync(mdio);
> + if (res)
> + return res;
> + }
> +
> /* Hold the mdio bus lock to avoid (un)locking for 4 times */
> mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED);
>
> @@ -136,6 +230,9 @@ static int yt921x_reg_mdio_read(void *context, u32 reg, u32 *valp)
>
> end:
> mutex_unlock(&bus->mdio_lock);
> +
> + if (res)
> + mdio->synced = false;
Why defer the recovery to the next transaction? Why not do it now. And
if the recovery fails, you can report the transaction which actually
killed it, which might be useful for debugging.
Andrew
Technical Details
Message-ID:
<54eced73-d0ee-41da-9ff4-63aa88667d23@lunn.ch>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363348-linux-kernel-netdev=dewy.ruReferences:
<20261111163954.1132921-1-mmyangfl@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363348-linux-kernel-netdev=dewy.ru From: andrew@lunn.ch (Andrew Lunn) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next] net: dsa: motorcomm: Resync SMI slave after interrupted MDIO access Date: Sat, 14 Nov 2026 16:40:37 +0100 Organization: Usenet Network Message-ID: <54eced73-d0ee-41da-9ff4-63aa88667d23@lunn.ch> References: <20261111163954.1132921-1-mmyangfl@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="1602621"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:lUWBiEpP4RQ7aM19mKxfrK9TTBU= sha256:AibCUZTYsLFLl/y+R0lmaQtKlGSPFYtRkxqYVMVWr/U= sha1:w+n0WhLsCRw4pDEsd4BDA4cWAEw= sha256:9u5ZtlcpADiYevJZVPgzk/nRebpG2XlGdfNv7+0b6JQ= Content-Disposition: inline List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 1CF0E114860; Sat, 14 Nov 2026 18:41:13 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.15 X-Spam-Status: No, score=-3.15 tagged_above=-9999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key) header.d=lunn.ch X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4HjPtpkijW4h; Sat, 14 Nov 2026 18:41:02 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-363348-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=lunn.ch X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 9A57811483D; Sat, 14 Nov 2026 18:40:53 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id C4CB2367F7; Sat, 14 Nov 2026 15:40:50 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794670849; b=X49FR1/rqxATdJdDCMF+f3MhOpWX84Di3nQtkj3i29m/SCWkHPjDGW+fjY/OiESKvR1Z 1TN29RFD71SXTyhUhRwqz8NxWuQL70RpU4MfTMxibu+vrMRxmGAtjKWWXashcl+VcQvmt 65NMyiejTpul3mONnTiGhdAMllj3ktFwfhO/EIK3OUPa9TcseJk1kkiROhLYnCSGn5uNj B+Kwf0htRm0LFsw0oC7lDTqxJmvhnq9Ss+xpL+C0lITn3uigTOkLSvCvcrUOUL91phwK3 kY1iSxW+O6EX887IQ9NwtuLUhSdcYvVNM6JGmXKpcY4/hk6Iaqywd3veUsOYkrDSxFw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794670849; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:Date: From:To:Cc:Subject:Message-ID:References:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=Danho8kSiKQHq08Zb9vx8F6XBw/ja+vgqnHZ4RsTBHU=; b=Cf6S9iy93dxSPfFpPr3Nkc5TmMLAWXc+9SERwkBrQtkFTsdEczeNRb47RtXgArjdQ09P iN0H5LjYhnE1IeeG8crNvW362n5ZA7xRcirdywqSZOFsZ9U51ZRRGIdmuKcRn0RPunSkR 5C+7GfIjWNWAE0eaA26ud/CY4T/nW0Ug6YpX3EMg7KazTudSwE+AP0mgV85NuYUE3msMx EA81i8sJ7CCkP1cZdVlvobCp9D79tqANsGEJ8G/ZaPMVkq5kr1DZwS4/fQv1uDEkZlYH8 vM9PBmCd3hDVlhaAoXLgN4rUgm2OCJo3uhse+MSIOBKXlc0UpmvvUvNTad4M5z+Zy/g== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=FsGyj6PK; dmarc=pass header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9E662606A327; Sat, 14 Nov 2026 15:40:49 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=FsGyj6PK X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=156.67.10.101 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794670843; b=vi+MQ6yLPytyTx+91pLCdSVn4LPMZgoCQdR2pQnb94V4kaSUW9y3Ocs8rcjwBekpXQSi Umv9Ej7RX3R/AG0FGkRqkxhyBoz04SBD2zUCm5RWu8URcKWpwhJorOvVAVXLnQ88tW9BS w9qqlZadnQoGP7kctdTL6ZZ6+p2iltDjtUefbH0Vel5PiqTgxSHj6XDZqAf08sdtGoYW+ U6lu7kq7tuRgkhDeMlwYrCrjp3XgWJv1af4/yFI7qFokZ1eQJ7c1AAxeFZF2jNULJlHXN bJ/fs1s9g+K7KLPC8bGsOWoABN7c1tJgVg0J839fBIz1MFS5efLuFKsUEXOQeF48k7Q== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794670843; h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; bh=Danho8kSiKQHq08Zb9vx8F6XBw/ja+vgqnHZ4RsTBHU=; b=EUADrD4/ZotzP2aXTWX/oxJwFpR+Xa63BGD8N3z6Dr57qJUHMDvb7rhWk7r4wdqbtH2W ZgsgqpH1aXFb4e8xYc6/OYhXbC6JZYMI656wVXuQSSMJL9y22H1yRWdI7IMvDibmc4vya NpJLaLgfaLzKEfKmxSxIf7leFMbVKeNT5dutcfoU4LduuAqBw3b9Stg0AXSC5LRxqToDR QXNkEJfektlLZ+ZeRLzDDeI/kTbZ2Q2rq8/ZmPR9/GrnlgYKq2OjsuWI/52gT011/N0tf qIF4MgVpFSxN11DRDt5RhpUxM3RcpcOsi8GRmlVPOyRFk1nQpPDXDZuo112Fgx8QXug== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=FsGyj6PK; arc=none smtp.remote-ip=156.67.10.101 X-Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 78EE2606A323; Sat, 14 Nov 2026 15:40:43 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 78EE2606A323 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch X-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=Danho8kSiKQHq08Zb9vx8F6XBw/ja+vgqnHZ4RsTBHU=; b=FsGyj6PKCp+qr7NZ/hWhXOh+pl S0ClFLsTUqoeZ+HpcsSq3jx2jnTVJZhOx+NzdvIZ4e+vDmB/hFI6bGVNJ9prbSyrBgN470tX8v5oa zqqMaAEIvUp5NgW8Q/3gPoJWYMWBLoauOUHr0bGic9lK6a6cndSj0TQmwOUIOsd0dWec=; X-Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from <andrew@lunn.ch>) id 1xSFrp-00GVtl-H1; Sat, 14 Nov 2026 16:40:37 +0100 X-Cc: netdev@vger.kernel.org, Vladimir Oltean <olteanv@gmail.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, linux-kernel@vger.kernel.org X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <20261111163954.1132921-1-mmyangfl@gmail.com>