🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #2383

Re: [PATCH net-next v13 5/5] net: dsa: motorcomm: Add support for Motorcomm YT922x

#2383
From: Andrew Lunn
Date: Mon, 12 Oct 2026 14:47
38 lines
6791 bytes
>  static int yt921x_chip_detect(struct yt921x_priv *priv)
>  {
>  	struct device *dev = yt921x_priv_to_device(priv);
> @@ -3631,6 +3648,9 @@ static int yt921x_chip_detect(struct yt921x_priv *priv)
>  		return -ENODEV;
>  	}
>  
> +	if (!yt921x_needs_extmode_check(major))
> +		goto skip_extmode_check;
> +
>  	res = yt921x_reg_read(priv, YT921X_CHIP_MODE, &mode);
>  	if (res)
>  		return res;
> @@ -3670,6 +3690,14 @@ static int yt921x_chip_detect(struct yt921x_priv *priv)
>  
>  	priv->info = info;
>  
> +	return 0;
> +
> +skip_extmode_check:
> +	dev_info(dev,
> +		 "Motorcomm %s ethernet switch, chipid: 0x%x\n",
> +		 info->name, chipid);
> +	priv->info = info;
> +

This goto is a bit spaghetti like coding. Why not:

	if (!yt921x_needs_extmode_check(major))
		dev_info(dev,
			 "Motorcomm %s ethernet switch, chipid: 0x%x\n",
			  info->name, chipid);
		priv->info = info;

		return 0;

	Andrew
Technical Details
Message-ID: <69492752-8b6c-428b-80f4-a44f4d0855a2@lunn.ch>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-345048-linux-kernel-netdev=dewy.ru
References: <20261011025043.1859940-1-kyle.switch@motor-comm.com> <20261011025043.1859940-6-kyle.switch@motor-comm.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-345048-linux-kernel-netdev=dewy.ru
From: andrew@lunn.ch (Andrew Lunn)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v13 5/5] net: dsa: motorcomm: Add support for
 Motorcomm YT922x
Date: Mon, 12 Oct 2026 16:47:36 +0200
Organization: Usenet Network
Message-ID: <69492752-8b6c-428b-80f4-a44f4d0855a2@lunn.ch>
References: <20261011025043.1859940-1-kyle.switch@motor-comm.com>
 <20261011025043.1859940-6-kyle.switch@motor-comm.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="1802153"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:YFnAQ+c+MW/gY+s1SnHEL97V6eY= sha256:Te02yBesqK2HfUoTk74+1piuOGhuAkV9IF8AOJL3wm8=
	sha1:bil2+bzmVkoejeSf7vJYOIRVjiY= sha256:lq7IeGMgv7e0obrUX7tOILzGMkVIekm3g2mhMMcSa2Y=
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 1B78C10FC21; Mon, 12 Oct 2026 17:56:59 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -0.751
X-Spam-Status: No, score=-0.751 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, SPF_HELO_NONE=0.001, SPF_PASS=-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 Cx3u2POEiP5e;
	Mon, 12 Oct 2026 17:56:55 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-345048-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id C5BA210FBF6; Mon, 12 Oct 2026 17:56:45 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by tor.lore.kernel.org (Postfix) with ESMTP id 58A9726ACD; Mon, 12 Oct 2026 14:47:54 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id DE21F3E51F5;
	Mon, 12 Oct 2026 14:47:51 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="MddD1XM3"
X-Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5781248F827;
	Mon, 12 Oct 2026 14:47:50 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1791816471; cv=none; b=DT6b4pQAGyhCxgejt1T/R9Nea28a3nKaW8Kmnuy8WoIxdANgz29hUCZ2qTzS2p8zzEXuXI9jwchD1jlQjoW95At96cDr1qV3WlHrbdK+C0R1wZm4BBYIw72wCZYSL/Auus5yFO3X4HPR2z/VgxQPipdCUdmte1Gx5BWqOCPsyHY=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1791816471; c=relaxed/simple;
	bh=sRWQ24BvreigALTr4vhtdp8Z6cN5af/h0OA9Hsa1gQs=;
	h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
	 Content-Type:Content-Disposition:In-Reply-To; b=q4ZAuWGCbtrAoMMik1fD5wCBlCp8y0V1UlcROLFA8Eqpek5jRn2rnnb3rxwUOyDLBVsqOS5iA61H806xL2E6AEwws0epfsVBv+WDx6lK4rmZE17qDX13GdHQzpOI5cqnaIE5csXnV+MI6rHgDZvYPbET6Nimg9K8BTLB9hz6aJY=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=MddD1XM3; arc=none smtp.client-ip=156.67.10.101
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=2Dnk+taR5VE4FB6PnSfOv7+73NQ/Pd4ruC75qr8uuwY=; b=MddD1XM3HBY7+vM1QpRmqfBzzX
	yOgfxEsDiNtjZqU7gFFl61ZOn2uKxnay7Pyqbnd4dOqIMu82lbXkBk6wrQawO3ll9Xqw4PmZmiPbY
	3+WFEccrhDXG8ZZB9YA3tYG2M9vB9cT70IxZtDx+10L06BWnPYFOtiIM8hPnb2NZX+8k=;
X-Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2)
	(envelope-from <andrew@lunn.ch>)
	id 1xGHJQ-00ALOv-K5; Mon, 12 Oct 2026 16:47:36 +0200
X-Cc: olteanv@gmail.com, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, mmyangfl@gmail.com,
	horms@kernel.org, linux@armlinux.org.uk, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, ming.xu@motor-comm.com,
	xiaolin.xu@motor-comm.com, jianmin.wang@motor-comm.com,
	wei.zhang@gl-inet.com, sijia.huang@gl-inet.com
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-In-Reply-To: <20261011025043.1859940-6-kyle.switch@motor-comm.com>