🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #11813

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

#11813
From: Dmitry Torokhov
Date: Thu, 05 Nov 2026 17:05
64 lines
14480 bytes
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.

... 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: <auy2plYVi723Qt42@google.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-357515-linux-kernel-netdev=dewy.ru
References: <20261105-device-trust-core-v1-0-1e536825b4eb@nvidia.com> <20261105-device-trust-core-v1-2-1e536825b4eb@nvidia.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-357515-linux-kernel-netdev=dewy.ru
From: dmitry.torokhov@gmail.com (Dmitry Torokhov)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH 02/17] Input: serio - attach manual drivers through the
 driver core
Date: Thu, 5 Nov 2026 09:05:29 -0800
Organization: Usenet Network
Message-ID: <auy2plYVi723Qt42@google.com>
References: <20261105-device-trust-core-v1-0-1e536825b4eb@nvidia.com>
 <20261105-device-trust-core-v1-2-1e536825b4eb@nvidia.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="3687017"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:CMOlO9G1/28CEN4OXIWrdXFOmhM= sha256:hfusHR2lVhtFIQMvfq08B+5a/KnPatfixNNQ6j7FLBU=
	sha1:z61oKcLzTM0fv+0E8ehAklFfdZg= sha256:3ul4k6i2QVBjEUyvwd/87O5OEINuwszwyv/eeeMLhtY=
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 C0212113031; Thu,  5 Nov 2026 20:11:52 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.149
X-Spam-Status: No, score=-3.149 tagged_above=-9999 required=6.31
	tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001,
	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]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.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 zGlR91zim1mo;
	Thu,  5 Nov 2026 20:11:49 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-357515-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 8A151112ED8; Thu,  5 Nov 2026 20:11:41 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id 3E60B615E29; Thu,  5 Nov 2026 17:05:59 +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=1793898337;
	b=GlPSTNfL78zflk22ADkf9Izot7lK8uIeNogRnhXnIFR6u/KZ+NFbhHvTQxZ/iqMArlrG
	 wCV/StAa52yYXOAyltmvP6iBI19CiP7GhVY10jvVmgCYRx58BqGB4wtVl9SSqRlxsedRs
	 fmnucrUF+HFtexyA/u7jU13ltq1ThtHLeLHuegMf8IiNxIssM5S2bOh89RjSH37Ng7rRc
	 tr+WH2Jr3WbT8g0Dwivvqa9/4QF7wMkEU8FEscH2/lZTtB4UzAhoR9Yvz86ZvaEoIVUsJ
	 +MwTe/GvB5P2ew/m4wR3XFoZgMazX86VfFi7YjF1Er7jXiwm6h6TtLBmOTi251dKnMQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793898337;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
	 X-Gm-Gg:X-Received: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=t7Mrcemi56BF5iayGoRjCtdHcIwbWskinGPPufbe/aA=;
	b=kYJpk8mjrPXOoO1HFfLxqSwtKC16Egr1vDBgpFm4ojTqG74xqZQGMHxgmxsDwGue9R52
	 gg+pPJcI/I0M8lwFNYAU2WXgM4cDdmsfN6D53r30LD4DNC/c2+Cy+vuAg3MEWyB3aUv6J
	 qVh1/5kbfJ6PpzgcvXPjt7el5iz3WydpnCUSwtVMwhdufdMrUMEyEzf0S/3vigG48Djqp
	 EKVhPk2/Zfj7jc15GjHF83/ggbOAZugwXab/DuQGrdkM3EUp2BaQFu+585bAS4Kuj8/Pe
	 vJBrtwXcEAvf4wgB4UR7DI2lEnowNXNRBa+Ie20rC7zLQgbT07J1c0qBkki5OeK+vUg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=ezhGUhXo;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	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 67A9D606D83A;
	Thu,  5 Nov 2026 17:05:37 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=ezhGUhXo
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.180
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793898336;
	b=Ckizqi/70h6qfQSXVuIzwBllssOdz0+ZQle93hHhyxn6Ee99PrLo14zhUzNA2AXjM/Lo
	 2wxsAs4wR+qtlRlm0zPi56A47EVaFidKQ3R8Nf6nplAzB/HYVT3SlZUCgM8DwUX0kZUI6
	 3hI5DjkymldwXmZLMhb1xFd+XjUHyp2Hj7cZg2/DOujT/X+YZHMiwPXHQRa8rGjXjQAxY
	 8TAJKSqZLlrUkEpujHTFwdmge1+PQ4vwaBFUxR3z75zXGOp5akCHq/eSuC6V5H/aJ7HHY
	 EzCLByNFRGKyjbtfHL4lsvKh8Kswaas7WMtoHTgW3rhGrFaB/WT+Yhqp/4ZynuasFsQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793898336;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
	 Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
	 Content-Type:Content-Disposition:In-Reply-To;
	bh=t7Mrcemi56BF5iayGoRjCtdHcIwbWskinGPPufbe/aA=;
	b=I3vbVATNXTd4jKfNy4cpgyTq/Fcw9ZyvmEKBFD2gQ6ZRdmkh9bA6jVaCtqeGx492Qw/R
	 CPT0LwlCR/Hl+lfdj6qVjEEMgaiwPujEQJvMGZ8vbuvxD9O3zWXVjE3FSIL/VHOfQBH6S
	 6CTgmICNI7M3Gzw9Vz3ulyqigOZz2cQFETxw6JxgimW3ox1cUZxsXM2B/fX/xbxAz+VSv
	 0zZUQzMVd5YpkH4KGRRjHkhy6/20R7RlKS/sdo7iQsnOlZqUEt5Eh0JzHeGaYq8x/vazS
	 uT01yiGT/raMpLsEASn9LopfiQ8WmhzBato2Cw5CG7ma5/P0zbRG8tStSVE9jQlvDMw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=ezhGUhXo;
	arc=none smtp.remote-ip=74.125.82.180
X-Received: from mail-dy1-f180.google.com (mail-dy1-f180.google.com [74.125.82.180])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8709E606D802
	for <netdev@vger.kernel.org>; Thu,  5 Nov 2026 17:05:35 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8709E606D802
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-dy1-f180.google.com with SMTP id 5a478bee46e88-3645f0f3fcdso3516057eec.0
        for <netdev@vger.kernel.org>; Thu, 05 Nov 2026 09:05:35 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1793898335; x=1794503135; darn=vger.kernel.org;
        h=in-reply-to:content-disposition:content-type:mime-version
         :references:message-id:subject:cc:to:from:date:from:to:cc:subject
         :date:message-id:reply-to:content-type;
        bh=t7Mrcemi56BF5iayGoRjCtdHcIwbWskinGPPufbe/aA=;
        b=ezhGUhXoIUl09y6+rx0VThMrADfNJzLtbjELvheIq2XUjEVn+F/n+Ri2C53TV9L6Aq
         JdGhkEmCnwmkPVTv0OB6x5RGwGBQJHUjt1KyKJv1eSBurgKo52RA3J8/QRIyxJZsDOQU
         n7s5HLJdofzUUsrlUP5HhN1OEHjO1pTWgNUtwsTp5+pkRYp1fI+C+uqlY+LxQRirvNrb
         Ex3MFhTRMHWMTtME2TIEuo7EsT/3ZplABIXud7NOWlPeo0lDAdVbld/IOwaCZ8vfz4uj
         z22wAGLVFJBUWinFMtheNWfoQbFjMbEjptQEjYgl4R/mPdYwQwSpcnETlWlj/Aj3CrCr
         m0dQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1793898335; x=1794503135;
        h=in-reply-to:content-disposition:content-type:mime-version
         :references:message-id:subject:cc:to:from:date:x-gm-gg
         :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=t7Mrcemi56BF5iayGoRjCtdHcIwbWskinGPPufbe/aA=;
        b=Wr2YIIRm1ojz+aRkTHvXNz86kx2e96wzYA3MCUQ6sO2iGD5RrbH2WSb3c/zEctula4
         N/j9vEHiRpckt29xVHPQ21wkMGdAtYsEzUGG09pIeF5hCKHjJJOdaYioByKKTr9mDu9r
         3/DG6PMhlz6hTXc/Z3w9G25BgYM2arh2wNoHCjJI0aKWg0dVuIhGjsttdGtX7Rkl9389
         OJsrKxZ8f9Z+Hto/THr/CxL4E2as/cdiGaT4O+aZhSjf3wM26hnb7Pqq2+T/0ot2t9Hu
         RQbG9jViFQdy1cBGdwPXYLFc08Q9BNXILrGAgVKVc6MXNMfBZES+F4uloh2jRGPoaVGH
         MmIw==
X-Forwarded-Encrypted: i=1; AKwUvBx1TRJTI8jlEAdM7PgVeBGYXrUdeAWOifbq3kms2klIgrj1RtyYkccDF96oOk6emy5lGdcFvlo=@vger.kernel.org
X-Gm-Message-State: APuU4Z9nBT7tcyS7f3lkZDH4X7CqBBJF83HvMBMeRM/4UwRJOhOkrg0+
	wD/BCPzXZbfk4aekG0jGqW3Fs0577EaT2Kdz0MNoCS4exyW8mOKBrAyD
X-Gm-Gg: AYBFou2zTvDKrzRgbz/lBEsoBm67PC/I9whZQb/a3EsiAbHKDDf94BP/vQThnRWhSLQ
	kgJTN+Us30bmj221An1yzXR80oBqSSSdycXfWw37+DE2BDQgeX8kZy3rYeVyRinvoBMAvVLx/yj
	cBbtgbf0K+vqFBwkKHRCDU+1kjDUPgZXeHSLoSSiThCaSWA5guZidj9N4PT+VG4fetIYBhrGA6D
	OLpZwrhWsFJuEyeByzMW+Hzm0FIsyr/HaUfxOU55PHQuk6iqTbhhAvZwOX56DCquITiyF1uWWur
	E45pGWpQ/zCEXNHNgtupN3EUZtdcDeUIzM+g5/HzTXwb/fov2+6gjq1Nl5WdCiRZ7o720APlU3h
	9D63VZyoJOraH40AhUxeNEoktETq4j5GuzaQb5U1G5zyOia2syhwWWuTU2Htw/q7IksqnQNsTAk
	4WNrj2CVLhrZGvRO8bFuuIg+57BUKpNaCLE8SYflYGwD2wjFIbLJO10icMxitwBOp4uXyHlQs6R
	/KEx2Db0fOPQCLLKIpmVpMdgx1j9UTMPCno/42lI6MRZlwFid0yyN1GBotb/RcXnZHMyMJhIi1l
	OpKL7/sAhWEcYzUJMX0L803X1LGdGBjccyvzEQuQf+yopaQtW3f6LOfMuCGxzD78NvH52muQhpt
	suhfqnUnF5LLZiWY=
X-Received: by 2002:a05:7300:fa0d:b0:36d:7feb:8bd3 with SMTP id 5a478bee46e88-36d7feb8e1amr5835338eec.11.1793898334471;
        Thu, 05 Nov 2026 09:05:34 -0800 (PST)
X-Received: from google.com ([2a00:79e0:2ebe:8:c8f4:b7d9:252f:4483])
        by smtp.gmail.com with ESMTPSA id 5a478bee46e88-36ca3989670sm23943795eec.25.2026.11.05.09.05.31
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Thu, 05 Nov 2026 09:05:33 -0800 (PST)
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: <20261105-device-trust-core-v1-2-1e536825b4eb@nvidia.com>