From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.171 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796135214; b=nQYVEzcJxe1rhXHxStUkIU7qQBVYKcQbv2aPdd8SrriP8/CUWBkGKGaW07Uz4CrKDuuU 1l++MVOOKsz4KzZ4/MGcXtwb7mWNjh0r9/I12+dM00YzDUeTIz3eWypUHiqJcDtIc8+zo 3Ti5LT7/CjrB7IL9bWGlZT8hWRDj2tmDx8p5inaCNgXwItkCQhiOVomHpyEZ0zT+9SPn1 0LqvWviJLV7ehb5ZbBuUA6ExEMzwyh58Z1w3+od2hNXk7Uz6NzrtXpVBBQ5ugk7oXWLaU GhINO55XjioiVODopuePenipo2XO1nuSVIA9iGGmZwQMC5Zn7cvKfNrsy15reKZY3cA== 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-Forwarded-Encrypted: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=4AJOw9qgOAlxEP4OV5lsyGzPus+fqFNUZyo42tY6+I9G5UKcCQvf11rIhXPTo/WdKM/m AY68OJ+EuEes0tG+3bjNDgxxtbcXz1AAhl8K1ljBrDg9LBY/qlNmMbznz/T2COZ8iiVmJ m8nfYfW9a8BS8dz5z3gdO71OFIEZd+J+YGpQu8NB5O07wLsRzNElVClr6WnU+wDAuQidt 0VEPkvP12YNfj3Jmg0ip0T1caKrFZ4FBBrO56+vtPMaY0faZ4Yefba7i4VdhPK3dpsaHc miIHZg3KDU4ZysEUZfl/6ciD3brrHJd/6evEfqggfzwHF/aE+vhBAjUOOQ4EZSp1eXA== 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.171 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (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 37619606A325 for ; Tue, 1 Dec 2026 14:26:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 37619606A325 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-f171.google.com with SMTP id d9443c01a7336-2f052ae3c86so64978885ad.1 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=tT4RjdbcK9ybjvAQaitM4BaJ6eIWfI+NxlajWRBMz2FrDC93BFr46BOBXPDP0KhOjb LawY7eQ4dqnjZWmFuxwjP+III71QB8i0N4HUj6V1ta6Y9qgtk/M21pAgOkCbtUSb9vV7 c8MXJtExClyrU5KuP0kXJ5TDZjsFnnjKfl8d53P5HfBYbgPE8mMpu9s0Va5CF2JMz+il sI6ntdsbG/xLh6Y+VuBVKAM8hICmXRGU8BVRC3+yNRxMkK3XrvEkvimGIz24yMOCssaw 2UStCRCDlA9/kjnyx5p346NcIQWERVE+JxuGuvYXM/LgUdvqSLpU4fVbubvy3/7th1Ub SwUg== X-Forwarded-Encrypted: i=1; AL+hErEhNXxNpi2dnm9BbkB9ha0YiIeIBjjDBB4CXZzH6e4l6MrFDbymf4QO0k0wjq/OUAtL0USPYPk=@vger.kernel.org X-Gm-Message-State: APuU4Z/sCcFsplKsIxBfbawtmz4g12qGwwyN0Zk2QljtoymW2lv5D8Z9 osxgBOyaRli+zBBhAkEHmKrau2OQVzOmVtYEcyHE1qZe/EgRH5qDbfrn X-Gm-Gg: AZFdTZc1mFgac9eti1HQV55DyDS/L7QtHMPrb5+Gc7NMSEadtSjVGjoJqnjlIx9ypfz FkaPfRWIo7ZH0XYJXlEh2zbCe2jRM7WVjth6i0vXO2ZUhts/nj+lyGADkjfaQC8kNHQvLzO5lj5 RT3BY7W4+6gQbaDlpc7p6YLKTgBGHKvNtMVP/nVSM+N7O6a6ITwv/4cpcfA6uONbBi5N48RVYz2 FRnVdRBhAM3M7wtnDvEjNpo4KUpG3h9pKPRcZEoEqCIgkr+DAHNjGF5hxUR8axfTsMZBVYQgHdT zEVSLMtsK1skWNG1mMqw4ssA4pNKUu5pO4hZU/YYIQGfAv/Bf/chP6qAn21H3ErTdRUFLaz5ZSP DrzD0ZLKQ/MF3lE3jlRS3l2XJ6nHchTVWLdXR0yEm7+JsEaUI39YmNAoQgMhqnDz4pTwO67xVut OZRIc3l8KvvTAZ4yMpUAv9AWfMsgYg+1wwOml4lHaCkx95sn3s/5nC9+Wrr+UIrifrHPeWad24/ kUKI/1V60sXUUVxztuBxtDRGp3RkAnqOGy7S45mrnlXJacQ2eAT5L8J1SScMaPFUMYcgyG3kVb3 Oh2qi1oQX2HyCbAFwFqjhUZA2m6D+JhRrcYgO549zBsl7gMtUZnJq27AxtsGBylYN8bFpBberA3 Jr1Opd2A= 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: stable@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