From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.182 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796135214; b=EhYUoBETXxQLC8IkzR835M28E1AGzg+TeQfW/45MeD5teCkIqKK3m8vZ0GzWju23EgLe xrcmySm1qg2O1Fip3qLy5SES7rh+yosSBlcvD19Es5D4ZJS6+Mi8fEia9BjKz6Rl7VmVR VZ29CxlAfDbEgzaWbt0jQ2yYVwU91CiJkWph6wavqW+PcQVbmSV8kfUNxXoIRkshaE362 HEemN6+xTrweqK7ArjIGZFqzSKyJ+xc/dm7V6d20RORjKkDmNtevYDoGXuCJy73F751KI VEll4nUizmgwR9hqOQPr18KzAOmlvWBX59vx+dj0CsUTREquYCOvGkY9tiiwlgI9ipg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796135214; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=kKjGoRe8783RZcxDXS0vi7Y//S1bUzPUhpR9FzO97GA=; b=YjgC2apR7/U9CWDAq7oV5pS6H/G7s/eTSQ8gXMupLVoFmA/E7WXH0wJAcoW++SaOUori RHZtnpxdfDFlvQQY/nMk3PcjhcvOtwFgEjR/IVGhJHOmv0JuhjEoFYh5oi8E8eS4n45go jRdZJu0fyz8Z1qEHGA7WUYGvR0guLyXphfz78y4ssSw4DHTVYVrR4EAuayIf+iBB9bgFb mMvi09XDCHY4kHum1U90bgEJ93bcFwSfad1EYf5b9g0NaHFs9EZK0M2LXNIhLBqMfs6xG YWhrpqbBRplPDA5gTjUTUDkQLuznM2aymkMeqWdZ1ASFebWKrc6DfZ4O0HeL2Ygosvw== 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=V1HPOfF6; arc=none smtp.remote-ip=209.85.214.182 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (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 3ED84606A329 for ; Tue, 1 Dec 2026 14:26:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3ED84606A329 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=V1HPOfF6 Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-2f066274caeso59618115ad.2 for ; Tue, 01 Dec 2026 06:26:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796135213; x=1796740013; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=kKjGoRe8783RZcxDXS0vi7Y//S1bUzPUhpR9FzO97GA=; b=V1HPOfF6p6hNO4vFXzCdSOT1kJ+x73pFlDPupNZQOramEKTCKYqktdm2OIH0Nzj1nC UtvdSXllyEA21I1EJjXIlDDaVu5yGPVq9kWj0cO3JhagqKAfmU0EN344nQix6V1ybbvA SS/jgc7/7XK7Hr4YZlmaMmIVW9BcFl4kp2Wh6/VaSl03f/x9fuqNUhO4xSkRQBWuVR4o ybYtVKXTPDGafzK2vo9hVt9XO1xrM8il9tO3OeXmJL7DnzpDEMDePyMyx9cxKsB8rSXx J1JXoeqj1OnFESxWXUbi9v+pnQC/3ZhgXCg5rRDicwDB+D/QJc5Ov1qkGxnm3elVdsQq tkWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796135213; x=1796740013; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=kKjGoRe8783RZcxDXS0vi7Y//S1bUzPUhpR9FzO97GA=; b=OCtWmWq+aQm3IkOCfDIKka2Wdq8MTTqI6MG2g1lI3SdesNFWb2Lr13eMVdRclp6pvc rA/kVp+EH6K4fvEsEP3SeSVhvhZMQj7YMWyxMNVtpWuG5u7wzI788zPa+s/2KKlIDq48 v91g6LMt4HGj2NsBohSfTjoxKCsF4nuFkcYDa0/LJ7gFW7MSlTupQVM9vjDkPwv14Dpm lNZaAe/LCImXNhJb6rHnTDpvVORNprVJgVNtYSKbz+5S9mxZGx0Usw7YfL7fnyRVHptR nsk+kdbjKjtVIyzqASAyZDxXOlja3emYcd2t5SxviAVyN2UD09djPADmk6c2T0En6j2O Qzvw== X-Gm-Message-State: APuU4Z/2m+BdFYQ3uYLD8YpVLl0QVpm9mBC6CeJ2F6XKXaeBtp9oy97i sX8xhcOOYuihGXboijkEVrX49tuLmzw10ZtfZNDUHWuiBW0TMzlZ+PSu X-Gm-Gg: AZFdTZdExwOvUeM3tfSPrvC3hbgNh38ihnN6dclMUXN0jB9aEixFWdCbCq4Q1/U8oNC Bst1J8PFDXN/aTj7xzxVgodrTm5W7+7Tgsjrv8lJB7xzsWfdqejhZD3VKIbPDDXV8poVTSqRO5m Ajxfpr+I60XKBT2pG5fpHdoW3spSk/WSfI7InfJB4v2u6kIT9LZbswGeuYalkpmLKgOJsCcdZnO 2JpLtWQGt4F0jR2i5AIbJ2Vu2T+rtLfdxwrQIUaIdvBKnjoIH1qMXb4B+MI+K6uwFsTYffGVva5 kQXjD7X3wAP0mdWOTJzH7z+inNm/uSqDvCtAkXA+YTA6yi2PptaBhjAgYUHzccyin5od8lFBbGK oSJhlG5bJ6WwAPQcuesnc6jcruSf549rFLsjVWIMqNFs0C4vhq74WgtK9bV8YEB6yjRtbgQxm/d KYh9SrdAFDnyp7uIfJgnwrC0CiYZ8wxsaPumLB0e/nCNjyYpFaQVRhbGNZ7+XhGr1ZDwC7+g6I3 yEWQqpjbNUUK7DXqlWyzPw+4yJs9a2Q/6EglkVQ12t8QZJOYi+ZJuR4qdUeXbxnFUEEn8fccUSA 2RE06MtQeiQ0DoNM9TfX3sX6/PoFHGsEO7vjFX3xmdkwwmDZ8K61KVqRBVItYotyjEvmgPD9kNc aUAkPvbQ= X-Received: by 2002:a17:903:3d06:b0:2db:733c:fd1f with SMTP id d9443c01a7336-2f03ef3d448mr374100385ad.8.1796135212954; Tue, 01 Dec 2026 06:26:52 -0800 (PST) Received: from DESKTOP-TPPBPA1 (36-226-254-86.dynamic-ip.hinet.net. [36.226.254.86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2f03ee84294sm182992765ad.9.2026.12.01.06.26.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 06:26:52 -0800 (PST) From: Lin Tzu Yang To: Linus Walleij , Bartosz Golaszewski Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH] gpio: virtuser: report the right dev_name before the device is live Date: Tue, 1 Dec 2026 22:26:49 +0800 Message-ID: <20261201142649.900883-1-rongh7426@gmail.com> X-Mailer: git-send-email 2.51.1.windows.1 X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Until the consumer is enabled, dev_name_show() prints the name the platform device is going to get, but it uses the gpio-sim prefix: "gpio-sim.N". The device is registered as "gpio-virtuser.N", which is also what the lookup table built for it uses, and that is what dev_name shows once the consumer is live. The wrong name can also belong to a real device: with one gpio-sim chip and one consumer, dev_name of the disabled consumer reads "gpio-sim.0", the name of the simulated chip. Print "gpio-virtuser.N" instead. Fixes: 91581c4b3f29 ("gpio: virtuser: new virtual testing driver for the GPIO API") Cc: stable@vger.kernel.org Signed-off-by: Lin Tzu Yang --- Found while writing a selftest for gpio-virtuser, which I will send separately for gpio/for-next. In a QEMU/KVM arm64 guest with one gpio-sim chip, dev_name read "gpio-sim.0" before enabling and after disabling the consumer, and "gpio-virtuser.0" while it was live. With this patch it reads "gpio-virtuser.0" in all three states, and the platform device of that name exists once the consumer is live. Tested on configfs-next 2e0fad9d2eae, where this file is the same apart from the key show fix I sent earlier today; the patch is against gpio/for-current. This patch was written with the help of an AI coding assistant (Claude). I ran the tests above and reviewed the change. drivers/gpio/gpio-virtuser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-virtuser.c b/drivers/gpio/gpio-virtuser.c index 5bf5d891c4..5d000aff98 100644 --- a/drivers/gpio/gpio-virtuser.c +++ b/drivers/gpio/gpio-virtuser.c @@ -1375,7 +1375,7 @@ gpio_virtuser_device_config_dev_name_show(struct config_item *item, if (pdev) return sprintf(page, "%s\n", dev_name(&pdev->dev)); - return sprintf(page, "gpio-sim.%d\n", dev->id); + return sprintf(page, "gpio-virtuser.%d\n", dev->id); } CONFIGFS_ATTR_RO(gpio_virtuser_device_config_, dev_name); -- 2.47.3