🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #2716

Re: [PATCH v2 6/6] serial: 8250: make port operations work on struct uart_8250_port

#2716
From: Andy Shevchenko
Date: Tue, 13 Oct 2026 10:00
77 lines
11216 bytes
On Tue, Oct 13, 2026 at 11:39:00AM +0200, Jiri Slaby wrote:
> On 13. 10. 26, 11:09, Andy Shevchenko wrote:
> > On Tue, Oct 13, 2026 at 09:53:26AM +0200, Jiri Slaby wrote:
> > > On 13. 10. 26, 9:33, Andy Shevchenko wrote:
> > > > On Tue, Oct 13, 2026 at 08:48:51AM +0200, Jiri Slaby (SUSE) wrote:

...

> > > > > -	rc = serial8250_register_8250_port(&port);
> > > > > -	if (rc < 0)
> > > > > +	struct uart_8250_port *uport = serial8250_register_8250_port(&port);
> > > > > +	if (IS_ERR(uport)) {
> > > > > +		rc = PTR_ERR(uport);
> > > > >    		goto err_sysfs_remove;
> > > > > +	}
> > > 
> > > > Also do not define
> > > > variables in the middle of the code (it's only allowed for auto cleanup
> > > > variables and for-loop iterators).
> > > 
> > > Why, actually?
> > 
> > Because it's the style.
> 
> There is no hard style though. It varies across subsystems.

The keyword is *slightly*. I do not see much of deviation in style in the
subsystem maintainer-XXX.rst. Do you?

> > Linus also told it many times
> 
> Which is neither an argument. Linus is wrong at times ("Link:" use as an
> example).

Link is different, it wasn't about the code. So, for coding style we have stricter
rules.

> All in all, I do not insist on this at all. It's easier to read and follow
> the code for me. Not necessarily the case for others...

> > > First, it is used in the kernel quite a few times already
> > > [1]. Second, while it is sort of c++ism (and I like to use modern c++), it
> > > makes the life of the variable a lot more obvious.
> > > 
> > > [1] eg. see output of: rg -U -C 5 '}\n+\s+struct .*\*.*=' drivers/
> > 
> > (you made me to install something I haven't heard about, it's better to use
> >   `git grep` though)
> 
> rg is order of magnitude faster (searches in parallel). More importantly in
> this case, supports multiline matches. (And respects .git ignores.)

Isn't `git grep` fast enough due to looking into index and not into the files?
`rg` may not look at the Git index, right? So I may not to use an arbitrary
hash without checking it out first.

> > Note excluded __free() if I get regexp correctly
> > 
> > $ rg -U -l '}\n+\s+struct .*\*[^)]*=' drivers/ | less
> > drivers/ufs/host/ufs-qcom.c
> ...
> > drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> > 
> > So, less than dozen of drivers doing wrong is not an argument, try something
> > better. But thanks, I will check and address this in some of the above.
> 
> Well, it's only an example of a declaration after a previous opening brace
> "{" -- this one turned out to be easy to search for. There is a lot of more,
> of course. kernel/ included.

Please, provide a better search line, I will look at that. For now it's just
a hypothetical assumption, I am afraid.

-- 
With Best Regards,
Andy Shevchenko
Technical Details
Message-ID: <as4BML-VUC9xUgOf@ashevche-desk.local>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-345529-linux-kernel-netdev=dewy.ru
References: <cover.1791873876.git.jirislaby@kernel.org> <c59fa203f325e0fe7601ea0fbc0d222c8b37f9eb.1791873876.git.jirislaby@kernel.org> <as3etnbZatn4sbfx@ashevche-desk.local> <c6b08f53-b5ee-44c8-93d1-54fdf5994ed2@kernel.org> <as31PsESOgLUhMB6@ashevche-desk.local> <b404f3d7-1b2d-418a-8634-72c61ce33f8b@kernel.org>

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-345529-linux-kernel-netdev=dewy.ru
From: andriy.shevchenko@linux.intel.com (Andy Shevchenko)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH v2 6/6] serial: 8250: make port operations work on struct
 uart_8250_port
Date: Tue, 13 Oct 2026 13:00:16 +0300
Organization: Usenet Network
Message-ID: <as4BML-VUC9xUgOf@ashevche-desk.local>
References: <cover.1791873876.git.jirislaby@kernel.org>
 <c59fa203f325e0fe7601ea0fbc0d222c8b37f9eb.1791873876.git.jirislaby@kernel.org>
 <as3etnbZatn4sbfx@ashevche-desk.local>
 <c6b08f53-b5ee-44c8-93d1-54fdf5994ed2@kernel.org>
 <as31PsESOgLUhMB6@ashevche-desk.local>
 <b404f3d7-1b2d-418a-8634-72c61ce33f8b@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="2021583"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:eJfx4SzkdtJbzv8waZ/NXdciQmY= sha256:CJ41Hl2nqSo3hQIHzXm2I3Nak77cj2H9/aVAClasFSo=
	sha1:p6LmUYTv3zuLPM95UjPy8tubhe4= sha256:hdWlNyxxsy8fc9EzwbRIjJ6rVRwq8yLAD+oaTkt32yY=
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 E5FBA10FDF0; Tue, 13 Oct 2026 13:11:04 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.29
X-Spam-Status: No, score=-3.29 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.24, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	HEADER_FROM_DIFFERENT_DOMAINS=0.25, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=intel.com
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 afbS8xuMgUaL;
	Tue, 13 Oct 2026 13:11:01 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-345529-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=linux.intel.com
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 7ECF910FDED; Tue, 13 Oct 2026 13:10:53 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by sto.lore.kernel.org (Postfix) with ESMTP id D1A51607495; Tue, 13 Oct 2026 10:05:11 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 533FD4B44BE;
	Tue, 13 Oct 2026 10:00:33 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="czeWkbSM"
X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21])
	(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 D10C33A545E;
	Tue, 13 Oct 2026 10:00:31 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1791885633; cv=none; b=clYykD5zaagESxK4OHbo8tqbspmonjeKBLVLMpAEnx1H4JpL5yXMrKy5Y+eJIYPv4qPCq6efN2QSQ2cDg3SWtvCwYMoD64wqvWWmR5blnwB3tlbfwAL6LTXEtxphsa1JyicvGWVQyZmWPzIBoy2FuiDEMNMHxiHBI0icHKx52Bo=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1791885633; c=relaxed/simple;
	bh=fTGeNaBIaLCVqoO0T9Dn+Yn3xOiEnsjDiubugzTxCX0=;
	h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
	 Content-Type:Content-Disposition:In-Reply-To; b=hGeSqJEy3awX4254dpoSGtPuKhZtsFJK+qwvUqkb87G53mJ4OLfBf2n1+Pp2jLPPmnOW2+qkpSR2bRn5mL/zcCNK8vr1jWLB5dEPa5P69fkRBEfh6ql/VodwUGl93yPyhr1YdXxHOIsPyxmgLfFYj2WcHDwqjTJx6P5LMNWpTWs=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=czeWkbSM; arc=none smtp.client-ip=198.175.65.21
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
  d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
  t=1791885632; x=1823421632;
  h=date:from:to:cc:subject:message-id:references:
   mime-version:in-reply-to;
  bh=fTGeNaBIaLCVqoO0T9Dn+Yn3xOiEnsjDiubugzTxCX0=;
  b=czeWkbSMOrILaEZukdso7oc4Osq3G8nOywlRtyp1xE78+PFbLNouEjx9
   3cgyLlt99hZBN9AF70ZZLLwC7cO/4/r651D0gNLaVe7SScVIQ2rM/0eYl
   JLmVLtJaLMgSnxbgia8jWvRN77zBFM2LAJ47gmC33NwqdzuH+8+FghQUw
   lDXPik3hXJO8JToeJxahdB9HpdW8gJtu4eyhglVJE1xjCHnYYsteAUK9S
   GHmz6FUuu89BkNp4ch1eZA2WDhIwMfQyxVZmc9BZf5WQXXqxXK32xPdZj
   3915D2gJKwU6wtQ2SKfu2Yd1sDslxKumYomuY68RlLkbLMimheCh+ak9I
   Q==;
X-CSE-ConnectionGUID: PHvepvYzRz+erCip8MJKGA==
X-CSE-MsgGUID: ww1TPNf0RQK4THe+Ctqtuw==
X-IronPort-AV: E=McAfee;i="6800,10657,11933"; a="700894"
X-IronPort-AV: E=Sophos;i="6.27,155,1787036400"; 
   d="scan'208";a="700894"
X-Received: from orviesa006.jf.intel.com ([10.64.159.146])
  by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2026 03:00:31 -0700
X-CSE-ConnectionGUID: 1iNYISSoTuuhs5glB6ekBw==
X-CSE-MsgGUID: SGL4lvnmTw63CNrOzbER/w==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="6.27,155,1787036400"; 
   d="scan'208";a="1174167"
X-Received: from ncintean-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.245.48])
  by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2026 03:00:18 -0700
X-Cc: gregkh@linuxfoundation.org, linux-serial@vger.kernel.org,
	Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>,
	Vadim Fedorenko <vadim.fedorenko@linux.dev>,
	Richard Cochran <richardcochran@gmail.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Joel Stanley <joel@jms.id.au>,
	Andrew Jeffery <andrew@codeconstruct.com.au>,
	Ryan Chen <ryan_chen@aspeedtech.com>,
	Billy Tsai <billy_tsai@aspeedtech.com>,
	Florian Fainelli <florian.fainelli@broadcom.com>,
	Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>,
	Ray Jui <ray.jui@broadcom.com>,
	Scott Branden <scott.branden@broadcom.com>,
	Al Cooper <alcooperx@gmail.com>,
	Paul Cercueil <paul@crapouillou.net>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>,
	Chaitanya Vadrevu <chaitanya.vadrevu@emerson.com>,
	"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
	Helge Deller <deller@gmx.de>,
	Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com>,
	Thierry Reding <thierry.reding@kernel.org>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Kunihiko Hayashi <hayashi.kunihiko@socionext.com>,
	Masami Hiramatsu <mhiramat@kernel.org>, Kees Cook <kees@kernel.org>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
	Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>,
	netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-aspeed@lists.ozlabs.org, linux-rpi-kernel@lists.infradead.org,
	linux-mips@vger.kernel.org, linux-mediatek@lists.infradead.org,
	linux-parisc@vger.kernel.org, linux-tegra@vger.kernel.org,
	linux-hardening@vger.kernel.org
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: <b404f3d7-1b2d-418a-8634-72c61ce33f8b@kernel.org>
X-Organization: Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6
 krs, Bertel Jungin Aukio 5, 02600 Espoo