From nobody Thu Apr 2 14:08:21 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 647AB341648 for ; Tue, 10 Feb 2026 09:48:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770716905; cv=none; b=NEtwcEEdULVAIy5Y9xnR3ZUCgSif+ZQkfOs0kKl3wuqeyFBi5rRkUfqLVhPpwy7nYHXxA7beoRbhyUR19flTVZAhrCmVZNuV/AfRnd+mBrgMrNGIDERJ7VnMMOtd9Y0GUdWNePq65ZxjFg7AMtVOzGTJMoVCr/b5yhDuaAsNDG4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770716905; c=relaxed/simple; bh=e3dSQfqVhgsxxhUTvmPgK+yGjRC63OjJTvyIHJC7OgE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=tS2rVL0TGw2E9qlL0j2UkcWNRb83cFcx3OR/oh6g9b+Q5JxfiM1fzWp8BjpglAdKkFTigbQsSqYqpYp5RU3FGk6+rkgq+l8xLi3DcYBzhOzk31MTVtiBbtLl9a7dHtRuP76wEiEXXQWjo2qtcSUIxTfHe3hytNdfCfsl5x6PIak= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=HoOC4VIG; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=kHbhihe+; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="HoOC4VIG"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="kHbhihe+" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 61A3iHOR1940288 for ; Tue, 10 Feb 2026 09:48:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:message-id:mime-version :subject:to; s=qcppdkim1; bh=w/GzpqhughA55/Qv9bqwmc49R9hRD/5gwHY ISOiMX3Y=; b=HoOC4VIG7awe+AB/6dgXMBZjhYWM+m4P+GcVgAIq8Iowgtv/C3b 0i4QsMl0yjqf1GMkOttxvv5Z8bmB8eQbPMhwj8O2BsMIGnP1pJsIPfKBc3VN8QIn Cs5kqQ5AhqtN2cMBpl/rozRh0Dh7w3oOzazlMxmYqvL4hLPg5lOMW34jqYef2F4Y ssLupxdq38ueRzj3u4WqSMya4UxTepXZ77yI9gDV93UNr3R4jL1PDw/CA2FKadq/ 6ee70YOxRufc1wnNtkaaMvpXLesPJsoBUOVmLuQzsEOMtEjgwGQ3fQ0vL8gMGfqW QkQz+gcDuS8ZoQz4atd8Qchr0fnrlvhM5ww== Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4c7w1js2x2-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 10 Feb 2026 09:48:23 +0000 (GMT) Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-8c71500f274so70707985a.1 for ; Tue, 10 Feb 2026 01:48:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1770716903; x=1771321703; 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; bh=w/GzpqhughA55/Qv9bqwmc49R9hRD/5gwHYISOiMX3Y=; b=kHbhihe+AUlT+NasCiSThl33Ivj3xhA+FLVw13aH2zrnyOULTOEGz0f5GgsF50w64N 8qCmJ7+AA/e60GwuF2mb7WNS7na3bX9/CKJYmzP7dowBNUlRtT+8BLneiVv9iVJCzH/Y gieHUIwoS6hwDlbFiOVq7dd4UVLUUDli9EXI66anKpfqcTPplInJ2lKtXxqjH4jcRBtK dkElBWemTPXmdevpRMEHhfwJtzh4AuwadxIwGSxpfWbvMbFuR9bKFKEdi1jzxzRuRr7V Q2vbGabQJGDG9FBvurgVswxqi6SiYwiCo4u4x4/i138joP5Ft9TBZ0aur/y7rPdU3KoW dOkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770716903; x=1771321703; 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; bh=w/GzpqhughA55/Qv9bqwmc49R9hRD/5gwHYISOiMX3Y=; b=hFYzhD/xWVd3uZIzb65/3rjNAqRNgoMQb/tnm15nWbArqZeM6BRBcHM+0nuV7AexqU lXNsRG13gUuXS78GSA0dkpxDTm+CJRXMHiANcKVVZK7O1snyJ4iI0WXKMmtl616Axg35 ZJTG6/hwO9TMZYfe4lv3GOXs1lQiEVAcIvzJtz/RXjDeHB+8xaaATznFwgl/KXVUPcTP srAf8zv3/+joMiw/w00rhSZGNE2cJ6murRsw1/85DRsSQIKADXsOyO7Q0XBy0DLek9Qw hrWhQB0j9lVHtaZoQLT50y1IPdzmVQYr2xARqbIocQTKhzfQrYNYeRwfp2EktUMRAgMy nh7Q== X-Forwarded-Encrypted: i=1; AJvYcCWw1hnv/EcCKgCatJv9KvaIgO5PXBlX5Ms8d2MjT2p2et/gdBjILJW/gE61QyqKaMlwT+cbG4LUd1I2I1Y=@vger.kernel.org X-Gm-Message-State: AOJu0YziF4AaCNn3SQGev+lb1UUM+xnjHYSOfYciO5vqgVSUhrSYqi0H dSzAr3rYhVWWSrgCX0/5jr6vnUaF9iFWuA8HE9P2i12VVulLIHoaL/wNWdTj3QNdRiBfuoksKpC nEDtCx7Y9PVi+x38nerBTqFXYwfQO3FcMKoxyRW5RZKbAkVwXqvSiVLYzwzo99AhZ44U= X-Gm-Gg: AZuq6aKWGASodaiBkrB7pvMi7zdi0Ca0Uaf+8xxdRipo1tPz1Zm6n1CQ14FjtwO4AJq XkvsgOG2Rcs9UBIwXIR9TZBRpg6n5pLlCXYosu5E/bCnnIWZeqmeurJIaX1GC8aFeYsZD2BQsDz hQWSpWQoGkAOS1XSwuILQIEX4meOSwB3baSEIeOC7fFFXxV4aCFC1B+U0n3ZavW7QJOGisVRtGE a1vDsSjKCDchiom40py2h3o1sdqN2d/P/zOQms3Z0G/1f36L9BlRXF++vsfLeGOoP4Oqcj18/TZ Gx1/uU0mB4CH0v08vS6/iJwQDo4kT4rspE7SttLJiIoC6zdnHXF9jWULaxuEIFLJ2HSQVCDEsYT B6dk82wjhJeabgDsDy06KCm5uN58FPyksMHJ4HIPGd4N0IH4av7U= X-Received: by 2002:a05:620a:45a0:b0:8c6:a28d:b1e9 with SMTP id af79cd13be357-8caf17e757emr1814101585a.84.1770716902620; Tue, 10 Feb 2026 01:48:22 -0800 (PST) X-Received: by 2002:a05:620a:45a0:b0:8c6:a28d:b1e9 with SMTP id af79cd13be357-8caf17e757emr1814099785a.84.1770716902159; Tue, 10 Feb 2026 01:48:22 -0800 (PST) Received: from brgl-qcom.home ([2a01:cb1d:dc:7e00:1964:f977:ccfd:e173]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4376bd5a074sm15492135f8f.11.2026.02.10.01.48.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Feb 2026 01:48:21 -0800 (PST) From: Bartosz Golaszewski To: Linus Walleij , Bartosz Golaszewski , Andy Shevchenko , Greg Kroah-Hartman , Dmitry Torokhov , Arnd Bergmann , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, Bartosz Golaszewski , stable@vger.kernel.org Subject: [PATCH] gpio: swnode: restore the swnode-name-against-chip-label matching Date: Tue, 10 Feb 2026 10:48:06 +0100 Message-ID: <20260210094806.38146-1-bartosz.golaszewski@oss.qualcomm.com> X-Mailer: git-send-email 2.47.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: pwM2kIKz2PQ6uDxRTGY-gvSC1lMWSJjM X-Proofpoint-ORIG-GUID: pwM2kIKz2PQ6uDxRTGY-gvSC1lMWSJjM X-Authority-Analysis: v=2.4 cv=YrIChoYX c=1 sm=1 tr=0 ts=698afee7 cx=c_pps a=hnmNkyzTK/kJ09Xio7VxxA==:117 a=xqWC_Br6kY4A:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=Mpw57Om8IfrbqaoTuvik:22 a=GgsMoib0sEa3-_RKJdDe:22 a=VwQbUJbxAAAA:8 a=QyXUC8HyAAAA:8 a=EUspDBNiAAAA:8 a=4y_y0rSijc1pqmNUuoMA:9 a=PEH46H7Ffwr30OY-TuGO:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjEwMDA4MSBTYWx0ZWRfX/cvpAWiDPHBl ELKi3+uFgN0dK4RLm9wFFrSvSLnxBbmkkbP2fmnTsOCZjD6gzPw5P5yq2UHUOWROF7YMayDKiGI 4XfaNSxBurtCJ7HY3nnfssbhy5+INdrV7ps4XsNLRedyrwmU4Me7NN+6pyD9UF6hgLiLc1Lhjkm /oo3R4GrpobUKVy7co3EcvphFasFbu+7cEGXhQEXpn+PhdIXu2SKHcRblTZPqRvEoQ5ymFaKDJJ 9PP4zMC4nj8O00py6Bt/q+Iz43tYObJXCg7Y8z/QgmFzXa6qt/YT0iXWEFMxIPdgKyqpQepa7W7 wTPb4A1R4TVSdWLgdhZlHkGIjty3IdwZfB3py9CeoMKpqhisjgB1VBofPxIVo5titVyH1C7ie2a dNvh6GoDa2FQ8U383Fc54mAQ1gduYBJpfwwECIJf8468IJ1CS/6F7wOGAkMNXJ6PssS8fuEQDl+ 4lqzdwd2HqeyqRbc7gw== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-09_01,2026-02-09_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 bulkscore=0 adultscore=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 priorityscore=1501 phishscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602100081 Content-Type: text/plain; charset="utf-8" Using the remote firmware node for software node lookup is the right thing to do. The GPIO controller we want to resolve should have the software node we scooped out of the reference attached to it. However, there are existing users who abuse the software node API by creating dummy swnodes whose name is set to the expected label string of the GPIO controller whose pins they want to control and use them in their local swnode references as GPIO properties. This used to work when we compared the software node's name to the chip's label. When we switched to using a real fwnode lookup, these users broke down because the firmware nodes in question were never attached to the controllers they were looking for. Restore the label matching as a fallback to fix the broken users but add a big FIXME urging for a better solution. Link: https://lore.kernel.org/all/aYmV5Axyfo76D19T@smile.fi.intel.com/ Cc: stable@vger.kernel.org # v6.18, v6.19 Fixes: 216c12047571 ("gpio: swnode: allow referencing GPIO chips by firmwar= e nodes") Signed-off-by: Bartosz Golaszewski Acked-by: Andy Shevchenko --- drivers/gpio/gpiolib-swnode.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/gpio/gpiolib-swnode.c b/drivers/gpio/gpiolib-swnode.c index 21478b45c127d..c88313b0026b9 100644 --- a/drivers/gpio/gpiolib-swnode.c +++ b/drivers/gpio/gpiolib-swnode.c @@ -42,6 +42,25 @@ static struct gpio_device *swnode_get_gpio_device(struct= fwnode_handle *fwnode) =20 fwnode_lookup: gdev =3D gpio_device_find_by_fwnode(fwnode); + if (!gdev) + /* + * FIXME: We shouldn't need to compare the GPIO controller's + * label against the software node that is supposedly attached + * to it. However there are currently GPIO users that - knowing + * the expected label of the GPIO chip whose pins they want to + * control - set up dummy software nodes named after those GPIO + * controllers, which aren't actually attached to them. In this + * case gpio_device_find_by_fwnode() will fail as no device on + * the GPIO bus is actually associated with the fwnode we're + * looking for. + * + * As a fallback: continue checking the label if we have no + * match. However, the situation described above is an abuse + * of the software node API and should be phased out and the + * following line - eventually removed. + */ + gdev =3D gpio_device_find_by_label(gdev_node->name); + return gdev ?: ERR_PTR(-EPROBE_DEFER); } =20 --=20 2.47.3