From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.169 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796135214; b=guYunomi5VAUeN4+kBPMRBw+zeeWlIK9equA1UVdK+73zkCf61SQ9+lt0IWbrfT8BquX EFDQsp1HsT41s+i+4nagNpyoKdn2krCo1eAnM4SJmxC3vmiLumeIMU3Q6wt3MnMKxLELs ws4WEAOcgEZBFnM8oszIfjZoW00vnxxKIqLplR+Zg2QHq88cqaPdanDSR3Wr1tJ3a/IFN vsT9etqVTn5hc7q1JltJxohKbfGxeI0zfOCrsNrFKmY6s6hW3TN0IwzAAZMDs2rQ6KcGi i8JESUGwb3/Ny0QfahxvKrH/AWPZ4lzmrDOe7mnhGMeZBsKuwRNYWSWHzJotgpWMYjg== 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=ZXZcHSi7LwPgvVfIKOZ5PlMCmY0KqPfvUCLxsYldYYezfPEwnaf35gTnEyS/2zxVkYDI 2laFpIULrW+SC8uzjhtQTtdSzaQwuWqpodyIOXCc1RW06TIZt2/p74v191TlGPjqougqL cisk2xqQC9NrWje79FNRl1BgtLm9UIGOM1c2FXRsrvSZ9sDOlM2E2wSl50E9EYsB/wJYw g24OslHx0H45Nu0JaZkRb22+ljv64g6ltj+kjJVkRn7RgTeA+B68I7614qFBIH5+vcMZd GA6vptuNnqur1mK+FCm0DoqdT+Usst85k2Qvs5AdLeB+yh8r12EA2WB8bT3YJ3NAE+Q== 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.169 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 2F246606A322 for ; Tue, 1 Dec 2026 14:26:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2F246606A322 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-f169.google.com with SMTP id d9443c01a7336-2f066274caeso59618125ad.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=fzYYViw0M4lgcq0U1ZjxIrYUzVr++e27oe4qS47s3XwHN8YSgxRNi+0CSN97nRc/AK EFV49UvCItlvH1UzPjE7cgqOtIq3mHboJ5htG600Htm/cQnDWvHF2wnS64IjWWRZkyVT GOVScEI1ufBHVq6f4Rfz8ryHcthJyNnu/FEqm0fbX4dMqvFECmhvYlji9HrpUBTc3UOi 0h4DsXGOB7I7c59rhv4egHtMWOckXcjpI734hJX8RjsMpABK8Wi1+6xuVCENIfJcGulY tGxDid0CsHFkfMCmVzDRB9PAxSkqvxo8PqcXsAAi3de/UcXMKSiSORlhKOpC0ARII1d1 xnEA== X-Forwarded-Encrypted: i=1; AL+hErEAemj/0wttsYizGqJUroUKgamgunbhYBimLUqOfm7htE564Llxq2xrpm5KRr/sprIPTYEXq6mRtBoync0=@vger.kernel.org X-Gm-Message-State: APuU4Z8C2fZzc2Y9KIR6/oXSgXaz+xL+4QfQF1FQZ8d9NQ4lZSxfvZFv ir4AmjCfCoPOLOydEUZbVIq7aA661W7hvGcaEIBoGMlee89af3TL9CmH X-Gm-Gg: AZFdTZdpt30LgkdfHvFp82qZSgtHOMKvXjIsfOfyz54gU0fCEgN3/Sqw0oU1YCdwyDQ qcXSIPWj2ZLLbG6WwkjTtAQxjuROj5AdE2ccIxo4nojI5ewa0iES1/iTNgrLbXeX/vY43O3jdve MiaFOC6M8x1bA5Dcgy5uOqTNPLw74f2ogufdrEGXE/3z5P+f4T/p8HoiMa2AEWZMtb8VR7+giz1 aGGT3LGZbVgdgbCBtdPOp2zgYUuoOxAK6GK07i4WK91GTnG7fE1z1okj8OkGd9x7qWJSVicOhvD RdXVPLRCMm7N5BMX+FmgVEPfSbCq6+pt1pWj6xJaPWsnqCK0ZEeX6MCbsuZZ3d6e41ESv2i768N QpOvjhSvlDWprczbAk6s3Ht+FrHOQreEKBMrIPS+8Jv4QXVU0bIcKk+WaH24kd5JAQaYMrKsbiE atc680nyrIyoJUA0XmCS0Vf4sodlI/3EYfiSpPsqsc4fThwyy8l10f6wLxE1rN+9PP1bjZ9vemk 0WT+SsdKQfmqj5XBMwkje/kjZozuOFxSpoVuBOH+3Ie+5xQTrl/h6Z59+oUakNQiDFuMVrZDN8A nk6MKsqKej/0Jg9hE6/jhZbbrHb4JGNqOtE12DhZtQd861LhfXa9NqFU8ciuI7HlULYjFLPdXLt 7rTahDBw= 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-kernel@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