🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #11852

Re: [PATCH 02/17] Input: serio - attach manual drivers through the driver core

#11852
From: Leon Romanovsky
Date: Thu, 05 Nov 2026 19:19
72 lines
11563 bytes
On Thu, Nov 05, 2026 at 09:05:29AM -0800, Dmitry Torokhov wrote:
> On Thu, Nov 05, 2026 at 01:42:15PM +0200, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@nvidia.com>
> > 
> > Manual serio binding connects a driver before driver core can admit the
> > device. A rejected binding therefore arrives after functional setup.
> > 
> > Keep the port ID check and use device_driver_attach() for the existing bus
> > probe path. Driver core then serializes admission and handles probe failure
> > before publishing the binding.
> > 
> > Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> > ---
> >  drivers/input/serio/serio.c | 24 +++---------------------
> >  1 file changed, 3 insertions(+), 21 deletions(-)
> > 
> > diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
> > index 54dd26249b027..604440244c1ca 100644
> > --- a/drivers/input/serio/serio.c
> > +++ b/drivers/input/serio/serio.c
> > @@ -81,28 +81,10 @@ static int serio_match_port(const struct serio_device_id *ids, struct serio *ser
> >  
> >  static int serio_bind_driver(struct serio *serio, struct serio_driver *drv)
> >  {
> > -	int error;
> > -
> > -	if (serio_match_port(drv->id_table, serio)) {
> > -
> > -		serio->dev.driver = &drv->driver;
> > -		if (serio_connect_driver(serio, drv)) {
> > -			serio->dev.driver = NULL;
> > -			return -ENODEV;
> > -		}
> > +	if (!serio_match_port(drv->id_table, serio))
> > +		return 0;
> >  
> > -		error = device_bind_driver(&serio->dev);
> > -		if (error) {
> > -			dev_warn(&serio->dev,
> > -				 "device_bind_driver() failed for %s (%s) and %s, error: %d\n",
> > -				 serio->phys, serio->name,
> > -				 drv->description, error);
> > -			serio_disconnect_driver(serio);
> > -			serio->dev.driver = NULL;
> > -			return error;
> > -		}
> > -	}
> > -	return 0;
> > +	return device_driver_attach(&drv->driver, &serio->dev);
> 
> I am not sure how safe it is, serio (and gameport) have pretty elaborate
> structure and locking rules because they can recurse into themselves (to
> support case of Synaptics touch-pads with pass-through PS/2 ports).
> 
> But this call is for user-initiated probing anyways, I am not sure if it
> even needs "trust" handling.

This patch does not change the locking; the lock was already held on paths such
as the rescan path. This change makes that explicit.

Thanks

> 
> ... And I even thinking if we really need to keep these custom
> attributes or if I can rip them out in the future ...
> 
> Thanks.
> 
> -- 
> Dmitry
> 
Technical Details
Message-ID: <20261105191940.GI8298@unreal>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-357555-linux-kernel-netdev=dewy.ru
References: <20261105-device-trust-core-v1-0-1e536825b4eb@nvidia.com> <20261105-device-trust-core-v1-2-1e536825b4eb@nvidia.com> <auy2plYVi723Qt42@google.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-357555-linux-kernel-netdev=dewy.ru
From: leon@kernel.org (Leon Romanovsky)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH 02/17] Input: serio - attach manual drivers through the
 driver core
Date: Thu, 5 Nov 2026 21:19:40 +0200
Organization: Usenet Network
Message-ID: <20261105191940.GI8298@unreal>
References: <20261105-device-trust-core-v1-0-1e536825b4eb@nvidia.com>
 <20261105-device-trust-core-v1-2-1e536825b4eb@nvidia.com>
 <auy2plYVi723Qt42@google.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="3710019"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:wPfc0OsIV3wVvbUITLDw+sTVpBI= sha256:WlACWC+wyi8d/y8CT9V36qMK62XThArpDzYQN3mU+yQ=
	sha1:/t9dbXpQ0/HTISpEUYIZVwYcYi4= sha256:IrAhvffgmog+6jn+lr8y4bqsa/8Lv9xCsWYwqulKpRk=
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 124E5113069; Thu,  5 Nov 2026 22:26:08 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.301
X-Spam-Status: No, score=-2.301 tagged_above=-9999 required=6.31
	tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001,
	DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	DKIM_VALID_EF=-0.1, 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=kernel.org
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 2jNNuX68Z-gm;
	Thu,  5 Nov 2026 22:26:04 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-357555-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 2972F112D96; Thu,  5 Nov 2026 22:25:55 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 1CE912C63C; Thu,  5 Nov 2026 19:19:58 +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=1793906393;
	b=qew3VYlv+VOmqyndpWoH6jylBfWw2HEMB5/Lk9EZRqbf5+1OkLTHaKljy2deuErD4mh2
	 eZjGiBz0tHn0KN4CSdunS6BeUexuP7JEo83LlNss9LhAhk4r4xEVv63IU8r4MLn0Ttact
	 mxEn5HmNEMxBk3TQ6YF1tHrXRBSNBZSypwzSXNreyFIXC0sRMKp7/SKQ5YmJfAqrALURG
	 oyS8WY4ReMOoeDHz6O9QSDIG8M3Uh5RTsw9OA6tDG9d/OymIeOUUvf3L2sxAzBliyR/d8
	 4sjsdkE08N0yUlwbsT4fYUNCA/TjJKEO+ZqActC/RlhaqnVwqsxEPeVdX3U20BGPCwQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793906393;
	h=X-Original-To:Received:Received:DKIM-Signature: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=z/2gVRqDIy8aB19su2IOPKcJY2mNZmdhA03swHLZjYQ=;
	b=OxKtZq82ewawBT4d7xEs7va7XjAZApxcHpORCauBkZj0tNNQ8taETQ6msSpk60sUkerg
	 RNrOiTcZrQjRxHhcv9Vjh4Wo6JAYbAvMzmDdkJOZaozTrDMXNwZD297h/SnxfN5tx1h34
	 q0pghdxzpFxhTB4UwaqyOCRygjVj1LRLJGC/zJ8ae88bIGIsmI831x1WFVZkzHf9nf6/6
	 P6QCRwS/MjNL/KgRjgXLBGTLza8+0HgLZrNbtXy1/FrjdHjyO0OC5GqOk+I9o4IqqWdHm
	 gyYkIYjlmyQOdol+viAPnlBLsvoqVfIaByU4p84Uq7uogPSfnGX1dHdf7EeZlPUY+Mg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=jkEVYl84;
	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 B7DEF606D80C;
	Thu,  5 Nov 2026 19:19:53 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=jkEVYl84
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793906383;
	b=rqEjoeBpdmISyp+f1AV0ZuCgI1OUW60VVGykwFVLItSoyQ4kz15Qdt7muA6P1Jags5Jn
	 LHoLShzB7961HdEhPlXUpqytGMb7ZvKuSIeSTRw06RBNf/ZStKDhI+ts3ECW2PQWDoc4A
	 t0OHYhHiQzXcV0zDjsAtOoZ6GeTR+CXlhQzFzCWm5AMTEDU5rQghCHHAneiwDfSw7XCYl
	 fBd9O/ZqdLY6CQ6HuWOpu4FHK82vkKAbEYW6y6HujtjzTLYZ55ISuCdDj4sKr7gL5YPqF
	 CKyd6J0/LxlutgWPyXNiiuJF6GCQhIHmOHObciNtZWQLBuMhs8JIIHrU7Isec1rz7sQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793906383;
	h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID:
	 References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=z/2gVRqDIy8aB19su2IOPKcJY2mNZmdhA03swHLZjYQ=;
	b=cXnInZHsCibHY3+JyEDByQvS/OXbWrYvtEvEz5qD0r8kRfLFuBU2xcJH2UcQmWhnlbyv
	 LxOf9zzSO1g/Q8/Yy+FiBneRB96EC5ljU5eZRNeD+YOVs35x/b6g0m8CHIOxNafAdrwiv
	 QEz8N/cdKRpqckOPJavL8OekG6uA2p3zOBpa3SaOlNKd9fdNTHgLCaMA8Vh1of/SMpgNZ
	 h2DfgREj0kryqZplYBWTeIMynYUgg6qjLqxrTh0xm+JOIK+Y25W4Y27ZGItEDseO/0CWw
	 5IF8Ce1+kbgwAFoN8qz8h2NB+aojEIpv9R6jCIhZaUZLQpylKUiPUZif2+Z5aKf/XjA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=jkEVYl84;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 98297606A31B;
	Thu,  5 Nov 2026 19:19:43 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60E871F000C1;
	Thu,  5 Nov 2026 19:19:42 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1793906383;
	bh=z/2gVRqDIy8aB19su2IOPKcJY2mNZmdhA03swHLZjYQ=;
	h=Date:From:To:Cc:Subject:References:In-Reply-To;
	b=jkEVYl845iO1BRjDNjs7l3aLV0DOTx2Xh4dkDtjEQRAG/szywJJ5iA7F7EBeoCv3/
	 Xr/XPb+CiVQa81KxX4rWfb+Ey7BCQrq8ZgEJKW4tmKtvqc9XOhUvqI6GMjdGyv5wa/
	 fFT42EqhuLoCYvx7kmlRnDtoWkdemyj50Ko8jo+RL8euRPtleHPXYSTL2guiYPygpR
	 LmQAT9/JCG5RJdfVN5vfVW2kDcNKd8AzICxKZa2tpcTEwInZ2buqjtKKyH4CQ2de5i
	 NVLEPe8RHtRdddRsaEMdYbNggz8TadkiapRYLGxK2b9KrUeCLhPUE/vb3Yg0OCtBC2
	 7ZypycQhGTlGQ==
X-Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>, Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Johannes Berg <johannes@sipsolutions.net>,
	Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	"Joerg Roedel (AMD)" <joro@8bytes.org>,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
	Vasant Hegde <vasant.hegde@amd.com>, Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Lu Baolu <baolu.lu@linux.intel.com>,
	Johan Hovold <johan@kernel.org>, Eric Dumazet <edumazet@kernel.org>,
	Marcel Holtmann <marcel@holtmann.org>,
	Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
	Nipun Gupta <nipun.gupta@amd.com>,
	Nikhil Agarwal <nikhil.agarwal@amd.com>,
	Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@amd.com>,
	linux-kernel@vger.kernel.org, driver-core@lists.linux.dev,
	linux-input@vger.kernel.org, netdev@vger.kernel.org,
	linux-wireless@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-bluetooth@vger.kernel.org, linux-acpi@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-pci@vger.kernel.org,
	iommu@lists.linux.dev, Jason Gunthorpe <jgg@ziepe.ca>
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: <auy2plYVi723Qt42@google.com>