From nobody Fri Dec 19 12:45:19 2025 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 020C82DAFDB for ; Wed, 5 Nov 2025 08:47:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762332476; cv=none; b=X5chtTjM8OcIB1Gi1gSdqh6pMNp3+Dz503j8NBa1BA8IxCW/cDG+/raESqf5EE67rAbMsAM/qLKygT8k2jRyzOsHkElOCUnNnwLvd96sJJd08N3B35KutauK2QjMUxQ1tXvpNKwO/MH+PWJM0oOchjRo0XbPubIHmNWtbwiIkCU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762332476; c=relaxed/simple; bh=r9cDw/aJYsPjA+g3Iqusl0ZJO5kkF5Y1AkYeG2Ln6YI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NGfX9OaHkr3uWA3OnnbK7ueUY84HeH21HyOwoyJKbWJQGi2Ysu0yf7lD/+7KMPFuUCHHJkeR6HqGr2umySqompRKMwQhQtWcIjb3JoWur0ErrbVGJ2OrVdH4WeQMT83qnxkpaAUhz5hD3B0FWikqh/orROsV6p1x15UgrfXtfzM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=mgyiBinW; arc=none smtp.client-ip=209.85.221.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="mgyiBinW" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-421851bca51so5376473f8f.1 for ; Wed, 05 Nov 2025 00:47:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1762332473; x=1762937273; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=fTmt0EBBpoH00wEC41/FLfqCbZ/Fh2wyVTiBtA0d/dY=; b=mgyiBinWBB0fSgC+g88kkirgvo+BWvUhFAsealfBiCIW/m5cpu2dcXcf3Dtql20nMi C+7NKsZsMnOFEazCy1qkw6zLpWITchj7yYMudq7imSMsuc2gJKYXCLm0bYpaijJIHHUu lEPQujvCwK57wbXu86MZT8tLN1tUIRwI/Of25R/GNBeUIrGN0oC0W/33fVyuTLiov/Lz 4fa14DtzFrKy5Ha2CGW66nuays+qsU+RNgJwxWIpmexUAZMsPEVPKRiTOEnD+xVIWLcr PSWtYsfnKJNxdozKJzBxf/jZR+6ZnYTPLVTPJvNC/h1XQcwHMjRjLDt0rbuZpbfLD7iK xJog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762332473; x=1762937273; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fTmt0EBBpoH00wEC41/FLfqCbZ/Fh2wyVTiBtA0d/dY=; b=xBHNDVpN+sXWekavOgR5QECx2JHlhuFLD5hOYDfSToT1WszmY2jrosI29f6cc3zwAN twGHXmWJsB9TmnWdy9rQ8mJquHFtN3WqSKMG1pgOFfuST2Nq2Ub/+6f0JUAdvTWtRgdR Io0bWFNWWpqhJ1zF+VReUi1xWa7meU6UR83Lk+IiS1NLWySCVAlzWtVLvDesekq6gUeD 6clx2aFarhJHrh1jAGPdTk9p/dCJkZdSz+FhBtKaR8yRDA0rThP7e8mvh3ItgzR0w/A0 bgZf/1+5O/yrOfnsFORU8dlx6pOYVX3j7qdmsmG7jIPq85bEGPu8aTeOCHTfAKC2z9Ol dRCQ== X-Forwarded-Encrypted: i=1; AJvYcCVLRPvT6z9rUX7jfe5HE9ZXnloJ4DdYbNb6x2uiDFGgkVqzSJ24zXrOITppHjAmJy54I1DS+SM0cC7Y42Y=@vger.kernel.org X-Gm-Message-State: AOJu0YzHUu5RRHWzKqmS2kYGa091K2P8BqEmOjWWrInR6K/VxorkPihF 0dmL1EUesZj1P6/fi/Y9wMIuy9K2NOL0Vvy0a5u1Rw7MphEYfGdOlQuBRa9kjrkK33M= X-Gm-Gg: ASbGncsDgx6aKSBs+TcoMkCilOQ7UNxKVz78J6M4EivNfQEbZeKgRRwN0LnIwFBAlaq pPY+EncG2oM1NIpUEc3Kf+RGI4fYvAa1K3YPsomyPnrYeoDZnCfoaFK7pB1roUFkntgFzyEiTCo WlKD/k8ejddMrBMcmV6W3HnjqpZcJqvxErkkzWML5VM2UYnEG0wFav8gSOo3PD8sOK+YeHaaOwA p/8O+tik4GJZKBnwTEbfdqabwPANkfR7gpM2SdpP71QfwYduBe1Kj/tW7qMC4UaSq+R3flAnoIh TWIWDgE0tzICoC0ErdNgBKUFcDNpP4wjjdfxx9Cp/4AMu0v624JMwXnjWeyFl0TFYi4E3LtyCMp f1E9JHk9mZ9iea6GxqQ5PffTHYrd+l2msIr3YxvEZ+PNt+4O8MOExs5Uzg1f40KIOsmNmpg== X-Google-Smtp-Source: AGHT+IH+m6E6WVdfcS6ls7YmNBuKBG9FV5JAluo3xUcZkxIadhZrNqI56KfB5EmPbH1Np5HIAcrzDQ== X-Received: by 2002:a05:6000:4102:b0:429:ce81:fe0d with SMTP id ffacd0b85a97d-429e3311c7fmr1609181f8f.60.1762332473294; Wed, 05 Nov 2025 00:47:53 -0800 (PST) Received: from [127.0.1.1] ([2a01:cb1d:dc:7e00:4e71:8371:5a52:77e4]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-429dc1f9cdbsm9315936f8f.34.2025.11.05.00.47.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Nov 2025 00:47:50 -0800 (PST) From: Bartosz Golaszewski Date: Wed, 05 Nov 2025 09:47:32 +0100 Subject: [PATCH v5 1/8] software node: read the reference args via the fwnode API Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251105-reset-gpios-swnodes-v5-1-1f67499a8287@linaro.org> References: <20251105-reset-gpios-swnodes-v5-0-1f67499a8287@linaro.org> In-Reply-To: <20251105-reset-gpios-swnodes-v5-0-1f67499a8287@linaro.org> To: Linus Walleij , Bartosz Golaszewski , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Philipp Zabel , Krzysztof Kozlowski Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1086; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=URxmTnl0JV1lV+vabMO/0fnz/R+E+W6aKsco0eYVKD8=; b=kA0DAAoBEacuoBRx13IByyZiAGkLDzGgxErq3XTBSHBKX2hVQ1nWMaGMH0fqS57EsLUZNHmkt YkCMwQAAQoAHRYhBBad62wLw8RgE9LHnxGnLqAUcddyBQJpCw8xAAoJEBGnLqAUcddy+YUP/1d+ hunHrEvjaYOZrXyexTBe7vgqA+mNYDsISiJVcApUeHI4DbwZeiLr9DgM4scHLYocuSzI9BWnRxh a0Ru5i/JYr2W3v7z+i3z2tW5LV+JWlfv7cGAkDtw24lEKkuMuFZDRScKCVGR3Kgis1idsA0lXbk JWbs0m1O0EliG4r9fVE2Qf4rJ17aHMFFcdoYq7uLSJZOb3IKxqrWR1uaBNlJhxvo+TnjdscfYOw UW58nqyFNRQPxDM12X4uQVPv3DeT0svG6O1beQQLrYwG2spn3H1UBR6cY5sAPE7bxlcMubm3Q0o JAEWAPv3gDJK+qim+4pJhMeEXK3nzmt05NlFbqvGlJl7ff+Uo75YS0MlXm+m50huCg4PYJGCktb xGIbhRvqM/6MNANPotyPiL2ja82vJABG2Xv7wLhWhwngmOM903iFIxqstayxkeAdolJlE4ajP+e rgf0qohN58Y/cDE3A0MqrW77T0Qw23CvILOBirYeZ1bivxMNdESj4DeRTwsjz7lmlcMuDMNN2R8 CH5jnWWwgJuS+TxHqeYpbnioLZ2fj6WMMj1urlUKWsJdcZtL8GknzpT2fkG+NjY4w+fb7koWLsj gDptVl6Fy0QrqC/rWURCsThoXMwagjm2/ZOLETpo6kKPF4jiACGjp4YzsAarb6sGdN+iK5lbYm9 UotW8 X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 From: Bartosz Golaszewski Once we allow software nodes to reference all kinds of firmware nodes, the refnode here will no longer necessarily be a software node so read its proprties going through its fwnode implementation. Acked-by: Linus Walleij Reviewed-by: Sakari Ailus Signed-off-by: Bartosz Golaszewski --- drivers/base/swnode.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c index be1e9e61a7bf4d1301a3e109628517cfd9214704..016a6fd12864f2c81d4dfb02195= 7f0c4efce4011 100644 --- a/drivers/base/swnode.c +++ b/drivers/base/swnode.c @@ -540,9 +540,7 @@ software_node_get_reference_args(const struct fwnode_ha= ndle *fwnode, return -ENOENT; =20 if (nargs_prop) { - error =3D property_entry_read_int_array(ref->node->properties, - nargs_prop, sizeof(u32), - &nargs_prop_val, 1); + error =3D fwnode_property_read_u32(refnode, nargs_prop, &nargs_prop_val); if (error) return error; =20 --=20 2.51.0 From nobody Fri Dec 19 12:45:19 2025 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30A762D739F for ; Wed, 5 Nov 2025 08:47:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762332481; cv=none; b=aZmm9b3LazULCLjVgN5etPFwerlYhM7kNwasJk10Pn0PmEaqdQN5vF3gaHYaSlJ8VMyiOTAQnWDowvMn1rEAH6hHxc5xFOhRuP60n+Ddel+7GdyyDkFdqsuNSABMhN/pXYG6Eks5IxB20peV/1bufkJPXh5zlQCGw8p89I/aEuM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762332481; c=relaxed/simple; bh=KzXWYFedYyI8UG+nwQx/rQYPGeNs0qKtqKI3x4qG4cI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hje2JWm5wYfD42oY4tbHhOgDbyjBQZ+wqkbwVT1RCCPKo92EFI/Ie5eCN6AiHmgdCRnrpieqgdFc25VCF811XilCuFXb2VN3PC8oKMita5OKjYJ6NDP1jyGi27K242HkLsMqLfv76a6cqOyzcP47h9I9jhj2rok3Lgae7I0a17w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=SAWC/G85; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="SAWC/G85" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4710683a644so4581855e9.0 for ; Wed, 05 Nov 2025 00:47:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1762332477; x=1762937277; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=XMbjX960Vd0zTJ6ycxKDpuXM+QwZlwVzJthScjlDZlY=; b=SAWC/G85VJvzBAB5oHgDCqWgDxslpflqEeywMYaPlrz72CPM4zWJFUqQVZ8tNG1JON 628NVK05dle1ReclGlEXFzYqQiY1unpoXUgzcSTATVHaOfJ2/FeH/riUVeC29OeA/Iig zodxaEGvtDigRg7WLHJl4gquXyrxf+X/2wPH8vAHKsMt9dxz4LUlcIrHajjr1VWTgitQ LPGmgZ3rq3cLWmLTIH27WHleLOa35c964LrIiA5GOoykyU7WcTe4ZTH0Tv1YoBo0aHa8 yZEXO/YYLy/urL0P8dfV8KfVtnwX6zDrxI88l4FDxL5IFkviWyz8PDwaTJXWPb3mnYJX fSow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762332477; x=1762937277; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XMbjX960Vd0zTJ6ycxKDpuXM+QwZlwVzJthScjlDZlY=; b=mA5ggCHvrFjDlPpCpY4gIvqlaaoUW0asJCT7dasjutNXLIWwKmE2huhZWJHufNYl58 Ebh1SAMD7jHeijooQ7qFTsgnPZtu/A3bccGjutgOoB2Z6Dx2KvSvDaS7l7d4Q3GbF/lA tUXSGAycGNMXw7W6MrkWtb6dnb2vXEmO/CBoo7sSbE/yjUcm+EXcQ/VB80rVh+qLQH/B iy4o+fItVBYMEE0ble6Moumgi2H9HpIKz00a3wgt6ul2gr2PIIMDDiUw2H+u0Lk1YLBe 6htxKOC4E5UrmmE9SI4H/MMyPe1aF6JNIIdFuH5EIH9JSTipUXNKE9EkBaypJFO4hcgR kg3g== X-Forwarded-Encrypted: i=1; AJvYcCX3tjmwk277pXhCFxpssTE9RtuoZoCxbQyIa6Z+2ubesA/8k5ckVzHxKOoK2F2Sp8Ij2tADIqPdvuuWqiA=@vger.kernel.org X-Gm-Message-State: AOJu0Yyb++S6oTGfbr0fCZOJRrpQ7uANOafUgljw2fzWD058DQCtrgoW 6m0tue7roF5Fkqt/podMPm3HkV/HdHodLKhNAQgC/cu3CeHEzlrHpU+EyxYEd7Sx7hM= X-Gm-Gg: ASbGnct7EEu0a+4a+tZn67TGxkiD7EiBEQkY4461Uo+Hth5/kM4+PWRCn0Z4PHmKH5T XHyU9ikp/cWr4lBgVK/Ikea7xloitdFiqpHP5EpT5cgxRYn/E02q1bg0rA+PHSRvPw6y27iyIT4 YZ5k8dHchH+Dh8ZyuhXaiXTPH0xVisP3M33RP8c83uOw2mZFU9pQ4ujHUuApq8hnvXdjFTg/pxo NbkWnCcghFhAVh4wul5Sk0pYD1Ax3rxCZC0haLFIwiVbUK84RVLjX44eQo4UMswS63QsOW7cwcT hqjXMO8pHvPpUtx7uKsv8bIo1qBrujQ+OYY8jCdf+SRM0zqot9xucQYJXU/I/07efncb1ovVIii vX6mOcFGsIFcIz+/KsHpsE3WxAmUmbUp5pdWDKyKp/MDUHM5vbsOGZeZ923oFFgbEw50QtA== X-Google-Smtp-Source: AGHT+IEm1noGATV9vo77sBfbVn3t28IHXH12mmVOJj8+v+ygz6vRHUxeGWcOZsqfv1MqUiJKLnPRmg== X-Received: by 2002:a05:600c:4e48:b0:46e:59bd:f7e2 with SMTP id 5b1f17b1804b1-4775c726664mr22898955e9.11.1762332477386; Wed, 05 Nov 2025 00:47:57 -0800 (PST) Received: from [127.0.1.1] ([2a01:cb1d:dc:7e00:4e71:8371:5a52:77e4]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-429dc1f9cdbsm9315936f8f.34.2025.11.05.00.47.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Nov 2025 00:47:54 -0800 (PST) From: Bartosz Golaszewski Date: Wed, 05 Nov 2025 09:47:33 +0100 Subject: [PATCH v5 2/8] software node: increase the reference of the swnode by its fwnode Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251105-reset-gpios-swnodes-v5-2-1f67499a8287@linaro.org> References: <20251105-reset-gpios-swnodes-v5-0-1f67499a8287@linaro.org> In-Reply-To: <20251105-reset-gpios-swnodes-v5-0-1f67499a8287@linaro.org> To: Linus Walleij , Bartosz Golaszewski , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Philipp Zabel , Krzysztof Kozlowski Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=963; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=HX7JTQgb7mODwXNdQkxhPlBcCXEZwyahgSTpWNcaNnE=; b=owEBbQKS/ZANAwAKARGnLqAUcddyAcsmYgBpCw8xBBL2/0lTTWj/7+vn9oeWymkUprFuMHnnD FlduvwOM7GJAjMEAAEKAB0WIQQWnetsC8PEYBPSx58Rpy6gFHHXcgUCaQsPMQAKCRARpy6gFHHX cuOOEACWdTdaOA3U0T9wTAblJlBn/1MxQztCaK0sk1RD7rwR+yBrKVNINJ4MT62K6lpUnpTDRnK 2vY5c2d6qV0IvoD0FCPNq3bpmg9w4OZ6a56JH+rSAUeGb5iypx1j0bdsJStaYMOiQLTudqcKL74 HXg/iNPMYdZsVqJgx2lVNBkaYF8b7atR1NkIgaUwof7nhyxOHo3EwcnyZJFGrVdV/Es7i9RE4eH KGDnOjSLT1jgIkvSbs7QRKiUJM6N9mtpVKR/kEeeR6BaOtvoTI+GlxRUwCPv06wsKY/Jt8mWBMI jpx+umcbtckEe+HMQ7bS2MnqQju06xnrXb4IVLfHHdVc2CYW4INgZi+vpkHf3hvWa7AK+q+Z5MD XQZNYe2CJVnh4yc6+H1430BJfxf/E5YL6NfksP+ezTVtpKWt7b5vm3nqq7Ke5H/MCg3uhCjq+/6 DNJw+tkDasBH4NAA1Ufz3IEk7tzMxrADj2HU8k3aPeMR7Du5FTgoxI1hGw/+HQ/xl4kElGxbPwE 3TueUPj5C6SbI7qUGQ1oQFSbNRefSl1lL8wtFA42f0AT3g27ljfOFrAh30PMmCJLrmt2DdjrWps lrDVeNvfKLjpTu9BHoYA/uj8Gm9qkbX6JwZDyaYWIhHJdSUEIMq3BLUAqv3ZZM25vTD2KxIx5cU NoGQzsVJwtV4aCA== X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 From: Bartosz Golaszewski Once we allow software nodes to reference other kinds of firmware nodes, the node in args will no longer necessarily be a software node so bump its reference count using its fwnode interface. Acked-by: Linus Walleij Reviewed-by: Sakari Ailus Signed-off-by: Bartosz Golaszewski --- drivers/base/swnode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c index 016a6fd12864f2c81d4dfb021957f0c4efce4011..6b1ee75a908fbf272f29dbe6552= 9ce69ce03a021 100644 --- a/drivers/base/swnode.c +++ b/drivers/base/swnode.c @@ -553,7 +553,7 @@ software_node_get_reference_args(const struct fwnode_ha= ndle *fwnode, if (!args) return 0; =20 - args->fwnode =3D software_node_get(refnode); + args->fwnode =3D fwnode_handle_get(refnode); args->nargs =3D nargs; =20 for (i =3D 0; i < nargs; i++) --=20 2.51.0 From nobody Fri Dec 19 12:45:19 2025 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 639E92E1F08 for ; Wed, 5 Nov 2025 08:48:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762332487; cv=none; b=cQErmW0QlMJ3sGIEJ/28JqGzLE7st1l5KdKYK+RiD9lJrV4F3JSJQa7w95nL1Cf7qpLd7wy8EVAN/F80oPdjZodqfylMeMjshjAKmYq0tN5EodnqcoEycM9U4zrjeg2/3fLCTP15zqpZLWFCUyA+hMD1R/sITzRvLXxsYjocAo4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762332487; c=relaxed/simple; bh=ZzrngTy8GvyLzYtwqD4FoT3jMmWGmQZFcpmlX8gaDnY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=k3G0SH3kL5Qjs+csE6rw18tOOqisoA6KCSnaLoOTe4WbdNVApwoui7FGT0FjXPEOztVLyICckd1x9v26Tw5DOz7+i4XXYKSUuQBpePK7bM8zipFPHosFA7Agwsa5Sfvim3sK1UrXRTz21juwRuN/W+uSR998CDDi2YleMZ1iu20= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=o43YTN0A; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="o43YTN0A" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4711810948aso45375165e9.2 for ; Wed, 05 Nov 2025 00:48:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1762332483; x=1762937283; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=8OAyY/i3h/xnNvRM460Hy35E4MkdMx/5c8tuVEvyWsY=; b=o43YTN0AzrHjFLs9lsFByT0SoGKhWKxOdNpfFxSvvbjWTa3uySGDs08TSOWJvcRufU Y+kqP+aNKdR+aCRUmkHTwkIahQqoR4sLhqXS6jOF50iycKlvQPDYP9zJO7F5VGvsKl1K qlJ1grQ1GDfNzDpaz7pAhef/xV1PgGrFTIDS6qEvMZCjlIZkS96CwjejrSlxWwFeXnqQ htZL2zE5O72oA3m5ug7GPbM5eDGSLZqjJoIV5mkatkT8rlJfoaNAuPDmQ3//7J7pqiJs gQqbXU9y/w9PQWNUylh8ybS+qPHBBHI60yuqhjeUkJeU9X5c0H193gHKiWxy33QE9U1p HnrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762332483; x=1762937283; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8OAyY/i3h/xnNvRM460Hy35E4MkdMx/5c8tuVEvyWsY=; b=pGOfX/JxaM8nLuJuxux5nAu+70IcdRoIxyzLWW7ql+R6lgtyAv/76HmBgm+K9Qu4EC HcRNsuBK2+i6Uvry/f1lzmSKfN9/8Q8KNZpNqQelzJJgMqrUkKSqSkh/9iZf4Wx1DVhy ptTWcwY6qESELASGwnsB0r5tzXwgwDJWP4VsGIa47VPp82rYrBBzkXkQfz8bvSlMj22k WZdeOLd9QjtZ1vTEZGPW6hh/lCRYItnS55vbOszXj24dbIk7xqhNr9wUmdw7Q1D5W5OS 0x8iFm8E5s4AW1CqSdOH4U2RIVUVkisqKBuJqSZKa9h5TT0FaXB6GWIXzZx/cwGSDSRH cf5g== X-Forwarded-Encrypted: i=1; AJvYcCUcbcRvV0cO+yX1lmnSMTwhe//FvocXLyATomAgVZJdDFB3KhEoZfrvF+sZF/CAihy9LiiZ9Q4kEp11MNM=@vger.kernel.org X-Gm-Message-State: AOJu0YztOFm6tIOy/c/5fc3o1BFXXquWp/+zEL5ZZB6rp7u4/BDR95rQ wgEo7QYBxgk3foufQYAK3EcFHwPwh7TW8Fq1wrYUdZ+wleVapIVLIA24SzTtmXd9at0= X-Gm-Gg: ASbGncuCM5EQP59k+orjOKGql2jniL+Ds6HQd7ONnxyyqSTabF2h7tzHMI1eB9E0Pmt aU/zB199yFO385sKO+sAzql2JOtUia2IwwyWUGkay5B6hkNuYmJXXXLsnSWnBuH2msNKqKvZVg1 re7IWJJlyeJKOkwExfryZt1bFqjrlfco4q4USO89zRi3dRL1HGQuJ6xIX8jCC0LOwV0POdRFMnd yAfC3E6WC36/DW/KXZlB7vuSIfUju456d9ZpJ64tjNqQjhJuBMQu5V0KmVoMjBDgNv0RL25TYVU YK/lmSl5BW4xGZYucseGAsCjJZLxHPZj0ZnqKhVrSVOu8RFIXlHhD3H+Ntyz5vGGLG0iHoAFEkN tfeGE6TGurZXhafJ82t/+ROt3D+qBfx/CP8h9c+CSj/OFV+nmsSLtLO24oae28BOtm9QVOQ== X-Google-Smtp-Source: AGHT+IE2WPCD4GiDlUt+MHh5JCpQNRYBZvuFk64K36d4NGc/YsH+GIeCl/xuZLKboh+Y80dVw4T4ug== X-Received: by 2002:a05:600c:821a:b0:471:1765:839c with SMTP id 5b1f17b1804b1-4775cdf4770mr16644615e9.20.1762332483098; Wed, 05 Nov 2025 00:48:03 -0800 (PST) Received: from [127.0.1.1] ([2a01:cb1d:dc:7e00:4e71:8371:5a52:77e4]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-429dc1f9cdbsm9315936f8f.34.2025.11.05.00.47.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Nov 2025 00:47:58 -0800 (PST) From: Bartosz Golaszewski Date: Wed, 05 Nov 2025 09:47:34 +0100 Subject: [PATCH v5 3/8] software node: allow referencing firmware nodes Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251105-reset-gpios-swnodes-v5-3-1f67499a8287@linaro.org> References: <20251105-reset-gpios-swnodes-v5-0-1f67499a8287@linaro.org> In-Reply-To: <20251105-reset-gpios-swnodes-v5-0-1f67499a8287@linaro.org> To: Linus Walleij , Bartosz Golaszewski , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Philipp Zabel , Krzysztof Kozlowski Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3759; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=wXlmW1dk+PI/4eJ8ubrNkh/VoKzD6+wnAicAUbt2Xl0=; b=owEBbQKS/ZANAwAKARGnLqAUcddyAcsmYgBpCw8x+G6l9pwkekwRY/FEtaPs1gOr5eb2k6K3c JU1HAMzFCKJAjMEAAEKAB0WIQQWnetsC8PEYBPSx58Rpy6gFHHXcgUCaQsPMQAKCRARpy6gFHHX ctMwEACfSzKb9DlWHXQfZWFRpCFeH2jLvNwW9DNJfuYb+rf0QlGnT6Jz7YlqOd158PxqgkPr/ex enpcuNGArvItmP1v/6Z0wykrf0piX2jCCzNbLhZTO3DJSFih4T3CtUeUL3proU7k3MWgLpLJO26 Xe+Op1urBq4s9P+nvXF3BKfa7iVg2u4ZdBmBsD7B/JHtI8bE6k/qqRNMW0m5v1TS+Ec8XVDoUV1 ra2xpriDkrkhl3ViTeD+Mp9TJDdUUxgIHs79X9xi2/98m6dVKmbhkUvcKCA9t26G2FPzgBoCiTk wxUa9gVTC3R2oWFD4tvk1I/f7Bv16rEJvu02TMhdXZiR+g8mFBBDA07TziYEFaGHv9e74ZZtPN1 i2q/6OzEVae7f1Rd1HWmLvZSMo+q8omo0kb5J098AG97EtyCgenP4DcxDVUHkXN0SvqppdN1F5C U4aEUAb5P99akn5mA3S1TEdz3VDcx4RlBkR2Y10IFgLH+FrLfmpGnVlEnYO8ZWJF2BDE/zLbrR8 vyZAPuwMpYKEtEByscVLYLEVdksQE5MQDKODWBHiP3dVbeWPUxKn2ldsy3pwMiAfgaVV+w3bUUe jIUoE4Dum8VmIZFSMnT5X/5srL7wihcYsiaY+vEhfoLtJzXDIp2mERaQfVxMBrwdEgQFsKjmIa8 zVy3d5nHN0U7+Yg== X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 From: Bartosz Golaszewski At the moment software nodes can only reference other software nodes. This is a limitation for devices created, for instance, on the auxiliary bus with a dynamic software node attached which cannot reference devices the firmware node of which is "real" (as an OF node or otherwise). Make it possible for a software node to reference all firmware nodes in addition to static software nodes. To that end: add a second pointer to struct software_node_ref_args of type struct fwnode_handle. The core swnode code will first check the swnode pointer and if it's NULL, it will assume the fwnode pointer should be set. Software node graphs remain the same, as in: the remote endpoints still have to be software nodes. Acked-by: Linus Walleij Signed-off-by: Bartosz Golaszewski Reviewed-by: Andy Shevchenko Reviewed-by: Sakari Ailus --- drivers/base/swnode.c | 24 ++++++++++++++++++++++-- include/linux/property.h | 13 ++++++++++--- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c index 6b1ee75a908fbf272f29dbe65529ce69ce03a021..44710339255ffba1766f5984b28= 98a5fb4436557 100644 --- a/drivers/base/swnode.c +++ b/drivers/base/swnode.c @@ -535,7 +535,24 @@ software_node_get_reference_args(const struct fwnode_h= andle *fwnode, ref_array =3D prop->pointer; ref =3D &ref_array[index]; =20 - refnode =3D software_node_fwnode(ref->node); + /* + * A software node can reference other software nodes or firmware + * nodes (which are the abstraction layer sitting on top of them). + * This is done to ensure we can create references to static software + * nodes before they're registered with the firmware node framework. + * At the time the reference is being resolved, we expect the swnodes + * in question to already have been registered and to be backed by + * a firmware node. This is why we use the fwnode API below to read the + * relevant properties and bump the reference count. + */ + + if (ref->swnode) + refnode =3D software_node_fwnode(ref->swnode); + else if (ref->fwnode) + refnode =3D ref->fwnode; + else + return -EINVAL; + if (!refnode) return -ENOENT; =20 @@ -633,7 +650,10 @@ software_node_graph_get_remote_endpoint(const struct f= wnode_handle *fwnode) =20 ref =3D prop->pointer; =20 - return software_node_get(software_node_fwnode(ref[0].node)); + if (!ref->swnode) + return NULL; + + return software_node_get(software_node_fwnode(ref[0].swnode)); } =20 static struct fwnode_handle * diff --git a/include/linux/property.h b/include/linux/property.h index 50b26589dd70d1756f3b8644255c24a011e2617c..272bfbdea7bf4ab1143159fa49f= c29dcdde0ef9d 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -355,19 +355,26 @@ struct software_node; =20 /** * struct software_node_ref_args - Reference property with additional argu= ments - * @node: Reference to a software node + * @swnode: Reference to a software node + * @fwnode: Alternative reference to a firmware node handle * @nargs: Number of elements in @args array * @args: Integer arguments */ struct software_node_ref_args { - const struct software_node *node; + const struct software_node *swnode; + struct fwnode_handle *fwnode; unsigned int nargs; u64 args[NR_FWNODE_REFERENCE_ARGS]; }; =20 #define SOFTWARE_NODE_REFERENCE(_ref_, ...) \ (const struct software_node_ref_args) { \ - .node =3D _ref_, \ + .swnode =3D _Generic(_ref_, \ + const struct software_node *: _ref_, \ + default: NULL), \ + .fwnode =3D _Generic(_ref_, \ + struct fwnode_handle *: _ref_, \ + default: NULL), \ .nargs =3D COUNT_ARGS(__VA_ARGS__), \ .args =3D { __VA_ARGS__ }, \ } --=20 2.51.0 From nobody Fri Dec 19 12:45:19 2025 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ABE9F2E22BF for ; Wed, 5 Nov 2025 08:48:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762332487; cv=none; b=P8A4Nm36bGIyv9/zAG9hB16YUqUXE+B1LYTpLHr6MqEwKCemLb2M2jHNCNOEz3UQr7X9VVnmEvn4AT09VSPZvTKTt3yIATMkhObIcv174+y7KdSbLwrQ7Lx2rSZnVLWooCUJcynj7WjzvK4XppwVWb/KHPFyk7IllA1bVxxp4rg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762332487; c=relaxed/simple; bh=oi+kOXiceGJ/Rz6eL6Neo6UZLLNYuqUvbiYaC2WT71g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=R5ARYSnbiDKtyUYnub06yviLHyIp/2zQczd5ObV0TBc8UikTQt1JR7Baq23KK/PfJl8asinAu4Wx6U/JpdaCVf8SZWi9RhFKNvYjj68tPG3+u2krQq8xiWJSeyzJ3SimyHc+yu4p/EwCISA/c14gsx52CJJ4FjXy3QT/ejlWASg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=xkiL3bNn; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="xkiL3bNn" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-471191ac79dso70249755e9.3 for ; Wed, 05 Nov 2025 00:48:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1762332484; x=1762937284; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Wjk7eFDeNZdnh41d9c98RA3CJ/jbvUDFmdSB3a+yBf0=; b=xkiL3bNnVuMspgn21cjJcJ1inmRmnFUDHHjmQiQs32k18ihBPOOKGCfIBG7OOs9AVy gGu7aIG2pVmrdyHx2dWf27I1f/z/M4guTHQsllGZDNKWSYFlzFrDtxXFtsib6kDiPmYq T3yq3IDDXkVLf2PK4yxyueHZbV5NhrJ5EYysuB51IfRgK78uhnDrchvtnqWVV61yTEHr KFmGNpk3LdmPDMSnKClnW9WWvKuiSzC0chtAxjY2ilrJgnzGffnlfbnflXLYSY2iBgV+ Wd4PrKMY0Nl9xebocPoDjaX2pf9E2pKNgLE/fbrVXp3B9icGcWTwVI17a6AjAe6ajen7 VU3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762332484; x=1762937284; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Wjk7eFDeNZdnh41d9c98RA3CJ/jbvUDFmdSB3a+yBf0=; b=HEsBHLvcTIinnpCKe2KxO8hbxudcfMYAJU8qVkVO7XDy9elrwN928jwGXGe0oJodqv RmCq2kTlFApMIYNORsEIfh/BnRP74/8vkXTtzTscwmXL3gWzvaS3LUrdgP0sdRBgYxJh 6c/0vjP4veLDfU2YXRmH7gwJgTm2515i/bR1mq0tAIC4ukR1SZz7ifzmDxT5ZbOPtkKx 3CFt3gPSIUoSEzNZhFs2XHC0HyDk99AwJO6JM/xoVcJbyuDNLeO/qf7mV4xnfypZCFg1 LysOFPf3rZlm997glUiL4PUg0xu25lBX/19NhfTmkylc9mdW2WXgxHuymUVJcBx3Slgo 4dbg== X-Forwarded-Encrypted: i=1; AJvYcCXyiN/5tJuuJa8h1AvG+ixvWkra36FMKUd7HUbnP27qRCRIhw9broaUoWBYiXFHSXnZSi22LSaeQS1T7uE=@vger.kernel.org X-Gm-Message-State: AOJu0Yx9J5DO8Iy1QlcieEroavmQAyVIzBZAqnx7PN77acYnbHiImwrO Oieb4bGPF0VXRio9ZfnM9N+I9I0LJQAlafV6u+r75uOLPu05sk7K+mLNZAgHmg7JkIYduWK2gSl nBQkQQ3itQg== X-Gm-Gg: ASbGncuOfAlc3X0UbSWlgcnOc2W8ZqNnP6y6LXWhkWLPo7jFtc7dzhztZv3mGCsLFBV fFdSmToUUoSZ+LURKNFpdnhIxnFqds+/2xyLdV9KCnFP3GXPAJl/xnFRa9R6TF6pXiWTv1egwRC HbsBzvfOeXlM5xxwzP+4vB7Hs/aW7vYN8QdWjM5ouirl53BtaiZMEmNk2nD2Ne4CmRZepbr35UM AVpQHtjx7FzfOWiVfkjsDMeW+fNg6XyOA2q1p+8mBNJSatcFXevQm0An/utiN8mOF1EievLOxfG KcEUyVbEg6QqjoWyfios6m0kOxVbU6o0RxHK3JMwIzzyMy3w7HqzXwMVKNOwfqEjY3m1qgx+PIr igkZAbOuuYj8Ws0IDYH2Cjk/gKkO3hLhMF+qUnIXsYxM7P7CqqwXkZ3cheJpRsrOosf1lWwRQ5M yaOn/Y X-Google-Smtp-Source: AGHT+IEo+JuIve4eGxvv+L0MqTDEpIF+pl87mOhFi/ng2h5XVmblcRW5etjFhkKZ7kr4GjUAr/6QHA== X-Received: by 2002:a05:600c:5297:b0:477:c71:1fc7 with SMTP id 5b1f17b1804b1-4775cdf61f3mr14533835e9.26.1762332484024; Wed, 05 Nov 2025 00:48:04 -0800 (PST) Received: from [127.0.1.1] ([2a01:cb1d:dc:7e00:4e71:8371:5a52:77e4]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-429dc1f9cdbsm9315936f8f.34.2025.11.05.00.48.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Nov 2025 00:48:03 -0800 (PST) From: Bartosz Golaszewski Date: Wed, 05 Nov 2025 09:47:35 +0100 Subject: [PATCH v5 4/8] gpio: swnode: allow referencing GPIO chips by firmware nodes Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251105-reset-gpios-swnodes-v5-4-1f67499a8287@linaro.org> References: <20251105-reset-gpios-swnodes-v5-0-1f67499a8287@linaro.org> In-Reply-To: <20251105-reset-gpios-swnodes-v5-0-1f67499a8287@linaro.org> To: Linus Walleij , Bartosz Golaszewski , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Philipp Zabel , Krzysztof Kozlowski Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1561; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=8uWrhgtN7CzxKixK+Z5LHouLHteEbmCYlT54UUspwT0=; b=owEBbQKS/ZANAwAKARGnLqAUcddyAcsmYgBpCw8x4m94z/YLOUCD5YwozqehQx2kgN3G13Ma9 8C5VFflfqSJAjMEAAEKAB0WIQQWnetsC8PEYBPSx58Rpy6gFHHXcgUCaQsPMQAKCRARpy6gFHHX clexEACWP4g6mcaYH3zBEhP1X2GcSqzaDXym/euuq1Tl69CfTJDylZvxKEb14yA/OnoLlE8rxMw sUvtI1fF4CJ+hxZ8m9dr6LttzQkMuIkBT1MEchkNJVHrKgWiSd5VUspCKox3PdCQ4m5Q4uRlB2o HmaI8Ka3Gz4oOCThSVhtNeFxe/g4pr37JWHNbIq36GzKlyaELb7dUohtJz20mm40cNPXRkzdLYj dIw03cQLHnnTh/R42GJosFFZ0HJW1qOiFfpld44kEOp8xJXRpfjYendleQmMES4ldxTh0f9aK0T diOiQl+A1a6KY3jWgKq/YdFBzEMNXze7kRq5fZ3f2Cq0YsQG9rQan/l5i1KiZ1HFaJbENpVxyvF rdz3Auqy61oX2WLWtcxkdHcophQAVyw99bcXAv0cMQdmSa530kOzGRak3lvdcsZbeNtIukSmdVG zkrMLf/qHRKoATgZb7ZeIYwuPRu1jLRPVhQx+fjYi+V/YDGUFcfeBgVMqfk6lHbyOPEHOY7UJPj zqBOrxB1il+wLqdUEhCpsMJgZlL2sIBEjkB9Oc7A82lw1KSpZ5Rlqg8sOq8X1VkZNy1eZ8aXs9y Tn3IsJuU2dTTyzZVaJ7AghutrZ8im/rNZamDjWi4QxF1CAMmSyxfqD6yoEDbt1uISDmdp1/+flm Yk9X6AAjWltrHSA== X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 From: Bartosz Golaszewski When doing a software node lookup, we require both the fwnode that references a GPIO chip as well as the node associated with that chip to be software nodes. However, we now allow referencing generic firmware nodes from software nodes in driver core so we should allow the same in GPIO core. Make the software node name check optional and dependent on whether the referenced firmware node is a software node. If it's not, just continue with the lookup. Acked-by: Linus Walleij Signed-off-by: Bartosz Golaszewski Reviewed-by: Andy Shevchenko --- drivers/gpio/gpiolib-swnode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib-swnode.c b/drivers/gpio/gpiolib-swnode.c index e3806db1c0e077d76fcc71a50ca40bbf6872ca40..b44f35d68459095a14b48056fca= 2c58e04b0a2ed 100644 --- a/drivers/gpio/gpiolib-swnode.c +++ b/drivers/gpio/gpiolib-swnode.c @@ -31,7 +31,7 @@ static struct gpio_device *swnode_get_gpio_device(struct = fwnode_handle *fwnode) =20 gdev_node =3D to_software_node(fwnode); if (!gdev_node || !gdev_node->name) - return ERR_PTR(-EINVAL); + goto fwnode_lookup; =20 /* * Check for a special node that identifies undefined GPIOs, this is @@ -41,6 +41,7 @@ static struct gpio_device *swnode_get_gpio_device(struct = fwnode_handle *fwnode) !strcmp(gdev_node->name, GPIOLIB_SWNODE_UNDEFINED_NAME)) return ERR_PTR(-ENOENT); =20 +fwnode_lookup: gdev =3D gpio_device_find_by_fwnode(fwnode); return gdev ?: ERR_PTR(-EPROBE_DEFER); } --=20 2.51.0 From nobody Fri Dec 19 12:45:19 2025 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C1C42E2EE5 for ; Wed, 5 Nov 2025 08:48:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762332489; cv=none; b=rw69HgUhLZNPPTTFEUAvMXr78Kx7r8BkQTYXgytdqwWJjnST4/28N93hpD2HLjwlPv2rcs88e2rFGBH5iD0hn1tD+IVp/2wY6Lyqk0dg1TjI01JyeXlM1Shxtx+s2wMaEuAM6qqBy0dmi5EKFeOt5SrOE1NsSK7lkLeJEwch70A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762332489; c=relaxed/simple; bh=X8edYpKFxJakc/RTqEB+Pipzfl1zQL02ONMlmJvW7is=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KQ5Q//JdicVttIyRdvfqOhnQ0Gm1VSB7E+Y7mxn5H4F5H7AAHSMtJiLzPgAoiAwlOGv24fYtLRQU8yq8Dy6243YaUABRZwIy2dk6fTAM7SZWBZ1N45UtFt61chvEgfFrAAW2+QH7pxBodboa+QQSH02auFbcRMUyU0eIX7qFQB8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=wxsI0aqW; arc=none smtp.client-ip=209.85.221.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="wxsI0aqW" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-429c8632fcbso3174322f8f.1 for ; Wed, 05 Nov 2025 00:48:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1762332485; x=1762937285; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=cWWTasux6nuDvfpZkvePzyRGdU+qe2S0riWlt2ij+bg=; b=wxsI0aqWJHp2fdcFWv+TDXXYlICmmezR4sL4ipmQirG4lHI6IlXY6X9YP45+EFYo2P yKoQWVpYHw9VnqlUSknz5fKWTDF+ceDX82xAYd/NQB4OMj23L9BkAh0KzJI9vzToDIHv 3diqvJ0fhO9c/RzlUsr4r3KjjXyXjdufl0zxUcV6gHd8+RM7oUYx2riyCzVnvMe51URE 0+suzwwpO4dkNXxuXw06UtJVhonoe4v1LSBQfEcbgjbuIGKHDV+TC7+U6lEapGiMuoqG XcyaCiV9AONuyntFXDUcbcHk2j5VeA/OYCSIhAI6fQhnP7pCGD3vv6ok+FgMY+TNZs6O ufEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762332485; x=1762937285; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cWWTasux6nuDvfpZkvePzyRGdU+qe2S0riWlt2ij+bg=; b=e8Xn+7gcCXY9TZXOQwf9CoJN6jEfotXgEWQVGThUvNgN0VhH6bvds1cmwV2HwQJfU+ pgeEolE7JNMpAuS/zUcxSd6VXKiplGNmIVRG5aDfr+hi09PW+Y96tuC1F6afvpq/V32A ak7CLPPxD/6Zbuk4UpDcTwoX9J2xQvUc+/OudbGJIKIhRPN3hF1bxsIKR0vx4sWpzeCg mIosV91ki7zjB/nZYZfU9DBznblluxNNEv9ydC5JRKxTsn/8prkHbDqAyxXeiH1Lj+8f uEjr8BlsZatn/5dn2jMGUgkBDv70nkWphauROQLC1CtfY1LOSKhnGFxeFzd+4iNucQUB HGlw== X-Forwarded-Encrypted: i=1; AJvYcCVO/3BIQOc4Mxkc7kmvovNgXGbsZhHnUKLxl2zGLzwfA9Q6OqAIXGunMw2uRIj6wnFjVAeZXGNrstjPF5E=@vger.kernel.org X-Gm-Message-State: AOJu0YyVupbVNI1xyook+c4GZqT7eIoXFimJo7AiokrNvvL4gmAhNBa+ vHKSAtLg0wWuWiPQLc34jQi7rgU4vxz7jAGxovTexQaEAfN1UWnix+jPgn+9PtH3AOQ= X-Gm-Gg: ASbGncsVp87Ud4FVcJhPf61wxTx8jIm6ptzHJm36PZMrVwBNsA/yJpFEbF8m61R2aYM rdp6noBMnLCFgdnxGpYj5Ix6tWx7R5Fv1CMHjgrEEaiKXlWOpTdkNmOmzOdvlBrdMb8/JWQiW88 kFagnAuJT+dQBojjWyU2RVMDFmNoy4kqeBHjqfvdpyCnUT+TkJ7hvtwcE8wN9LRBHjcwtSXGbUv UVnBo9s9EhkR48IzJYV12UfML0ReIN476yunFG84d1GQchOSSxJ8QHqKMgfi0OkzuXnOscXHjwa x8fesgRwLszuf3KIV/s/jvipltcqDqEpdZAsq7svppV2nGzonTq/FIHol6YABPILlgCHS9wc+56 kmzIq+Uv0ghZ0Cjeft0KY5I953KJg2gO4Qu0YfT1qoaD/Gm41SbtXpNJxvsdoaLZMLdA3Ug== X-Google-Smtp-Source: AGHT+IFKGljAN4NkKVJIQ54D8McX8K1Nf915phMDtJjjRKpgui/5LxN2/d8VKz+lQTYKVEd42J88qA== X-Received: by 2002:a05:6000:220e:b0:425:7c1b:9344 with SMTP id ffacd0b85a97d-429e32e91b2mr2003985f8f.15.1762332485395; Wed, 05 Nov 2025 00:48:05 -0800 (PST) Received: from [127.0.1.1] ([2a01:cb1d:dc:7e00:4e71:8371:5a52:77e4]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-429dc1f9cdbsm9315936f8f.34.2025.11.05.00.48.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Nov 2025 00:48:04 -0800 (PST) From: Bartosz Golaszewski Date: Wed, 05 Nov 2025 09:47:36 +0100 Subject: [PATCH v5 5/8] reset: order includes alphabetically in reset/core.c Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251105-reset-gpios-swnodes-v5-5-1f67499a8287@linaro.org> References: <20251105-reset-gpios-swnodes-v5-0-1f67499a8287@linaro.org> In-Reply-To: <20251105-reset-gpios-swnodes-v5-0-1f67499a8287@linaro.org> To: Linus Walleij , Bartosz Golaszewski , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Philipp Zabel , Krzysztof Kozlowski Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1201; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=YAQBLalSG4YSjo0vg2GdIJVruVYhGTc+UD/iGlJqB84=; b=owEBbQKS/ZANAwAKARGnLqAUcddyAcsmYgBpCw8x21Ejb1yFXnz2kosAyWpBJETwb/9mWsPQJ itx3PJY7NCJAjMEAAEKAB0WIQQWnetsC8PEYBPSx58Rpy6gFHHXcgUCaQsPMQAKCRARpy6gFHHX cjpCD/4nA48zw7npFITzKnfkqKIPQbwERTmdckcuMxGRycWKQT3YIusQjBVBT6yNHbh6qxOSmBy C/C+uO9mPBzlHmcCpdLJwg5MAZVNZzI7U9yzYYNkrt6OFKA8FEHwL71cn4Irjsx1JemJYg4QAGQ kdItL1908rDm9waGQ1hf2ak7FQquQwB2E6Y+u3bwsm+OB6I+isPXtp9IIfBr81XIKFE5Zj0O7Zs GzRQn6eKn5/JvXDsHKP9tkwOI5mYRTYz5K3rtg7+h0PwKzv/2/dl8PzqGhexkmuH10pG8EWyqD2 Gl+/gw7s+2gqQa1jjmiFCjBZOBrJCYn3g1R4k3u0yognbCB8FgJdIAhjxL9tfqW+EweFryz8K+F /eq+nADel9SQ4Qk0ZlJ8IogXH8kB53U750N/cL5u2Aj1tFaCp88ZddnSehZ8UJdso1T8EzlBAE0 8yIcWFlwy7i8Gz4eaYrSQdTlqQ60K/2zLB5E8+tCoOkcS5PJgNvHpRuQujagaoXQUC51V5etekn 04qvF/eSDMmsfUD1NsfNUexn8h1aTJMLL5jqCQMaK5A/QTwk1yQxIkhb/Pa/dJ8GfqveMZBeO+p q/Nh/Ifxg7043rVJDbsMVXFqfZ8cQEFni1RpJKjjLPmu+GrRaosIf+lOBKMyRh2NHDvDutKeH/D uSP3TrjJFOYNrtA== X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 From: Bartosz Golaszewski For better readability and easier maintenance order the includes alphabetically. Reviewed-by: Philipp Zabel Acked-by: Linus Walleij Signed-off-by: Bartosz Golaszewski --- drivers/reset/core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/reset/core.c b/drivers/reset/core.c index 4fbaa67a6f79a4af62855c88f6b74f92c3d97159..a368b14144e7bc29ae23becab2e= b7a96a4adbe44 100644 --- a/drivers/reset/core.c +++ b/drivers/reset/core.c @@ -4,19 +4,20 @@ * * Copyright 2013 Philipp Zabel, Pengutronix */ + +#include #include #include #include #include #include -#include -#include #include #include #include +#include +#include #include #include -#include #include #include #include --=20 2.51.0 From nobody Fri Dec 19 12:45:19 2025 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F47B2DE719 for ; Wed, 5 Nov 2025 08:48:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762332491; cv=none; b=Pk0As+fzIx3Isg3MMF1UE8k0LJY0Cjpw0ojOIZYHCQJ+hHO+GXgwtOPGR6+BYf0PyBlM+tT0kAItf4VgZyPzYYLURRVf4qxMLlJAB+HpnFVxvZYqord0D7S8qcaAQlV7jpWcL51Az7WPXALBHxZ4g+M9oVrtf42u6eLcdsIgCEE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762332491; c=relaxed/simple; bh=z0YSr7KrcAc/k0WngzdsyXNvl3twXbRlw/uwLjuKOK4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lTbdgq5i62ykrfV7VgjHJEpjPOuCz7TcN2XUAsjpv4mp2i6dqk8Omf3Z2F7pVM5ptpPMtgNElzbzXvWi6ho85RPunyHBirY1ahyMxcyz1RelRhptvTh6/cJeuAuz6Tonc2VBN2VEFBHOPtQw+sXHjquYxGauKpOmsNYAMkHueq4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=dy+gHzTa; arc=none smtp.client-ip=209.85.221.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="dy+gHzTa" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-429bcddad32so3973940f8f.3 for ; Wed, 05 Nov 2025 00:48:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1762332488; x=1762937288; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Fvp1VGmfGTlzha3gDCL6Cw0t8OXa3klcmoFT2A8KMRg=; b=dy+gHzTaCSQKVv7bgXbWEbOcCyH6y/WrrgmbhbIQA/Yy9pU2ivUe1q/EA8OnBKg9HA y+YywLZ/FsxpP5aCVTkIVpHfZQA+uuzDcjecsrMwJSwDS8/tE1MQ8bP15R5yw4q6e3dg NOqKSDSJ8AtCkbc3qiUtxIW+rFFdwY5jN6punOonfa7qF3j4Icao/xGPnDQuVZo37Pf3 8vjbLnuWyP1EjF9U174ll8WGXOySVjBdFs4oceiGm2XH4OgV9RZF3VDnJ7QB8VPIr7/j A4fnTuD7DZjgecy+SFTnGvp4XUpK1aOEZGXmfqrftPnC7IxUWf1ZaEOzlQnCJJUE6E2g 5ywA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762332488; x=1762937288; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Fvp1VGmfGTlzha3gDCL6Cw0t8OXa3klcmoFT2A8KMRg=; b=u6wv/Wykqahutbn3WRVgiAJKA1UlTDVyslfl8RsdRoKR/rlQ2tHXpWy6ryYtGF7iI9 PhYMs4kqHmY5EPZ1XJcDGXNCEiwEqSicqH8ZClZK9/0YoY7QpR/XzEz3V+RQlO9MENq+ easR5HOYhKXDLu4kPzkm0GkXNeZhiD7ybPyAZAzZMmNgwMWUFiOTA7qaklwcap34iNSQ s6OqCEPYw1FnjSwYDxJbfoFLkLPa+uynot1N6Yq3Hnr0my8HGeZtVvatmWHZZKcbhKms EKb7IS1eJSuIshzTZBczN3i6wI6q269kBH2gfUBJzpxRnZlp/3daGPuliz64nRXnqKJY TCuA== X-Forwarded-Encrypted: i=1; AJvYcCXj0pRphEdDaMF1xiPdCwPHEXQpEREoWl3YnlBcIgie4WnY0nOWppa2OAf+S6BGwn94lPmtaRzyPZiJvjs=@vger.kernel.org X-Gm-Message-State: AOJu0YybXw4DA7eOMoR8KGT4M2S2w1CurvXX9RyY8nLrUWUes2IpH97W 7qwErQq5pbebe5qYD0JJeKOiOTESapQIheiVByvaVYCZzNDltQwzOejERwNi/dfW6mQ= X-Gm-Gg: ASbGncszMSxhVei42tGpt87Y7XsiVvRjOWICULHqvdFanq5R+yv2Jdlki7GobptHvC5 HV6P95BjSk5MoQnahbL8AjUVqSCSLL7HkdMSKatPL3MJetEI2FT8Usy9Sb8eoYbbv+5bCb9FtZP ZfSkwion7bUSxeLsxOCS+oC9NODmFk164z6JhvyyL6XDYY+TC+RhldplYSU8HRr0yEbds/yZTsF wtQeRYaFxClwoSuts83hwavCG69n4M7I3dl8SPdQdMwrhOAKJrOcrrcJxK8o9zIigrbAoMG2eMg RLfMFoeR4zE/PcJB62dbZKKv6HhD9CJwzJVQcuaQT1G8sce/rGrEPwDo+IKkvqB8Ysn/NLppTAQ u2R+Hg/Prjv0G1Ap4XLyjwHdqShv54xbBh+L8YlI1OuasiDJ+GLNmmq6qTA0nM++Z8cC6YQ== X-Google-Smtp-Source: AGHT+IFCE+4Da8gI0APq0iWn7f7Tme0BJA40NUIdTq6Amxypg2aQ2fAQIQCz8g+XzJc63cIpCBUPiA== X-Received: by 2002:a05:6000:2382:b0:429:d6b7:6b9f with SMTP id ffacd0b85a97d-429e32f47f8mr2313937f8f.26.1762332487723; Wed, 05 Nov 2025 00:48:07 -0800 (PST) Received: from [127.0.1.1] ([2a01:cb1d:dc:7e00:4e71:8371:5a52:77e4]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-429dc1f9cdbsm9315936f8f.34.2025.11.05.00.48.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Nov 2025 00:48:05 -0800 (PST) From: Bartosz Golaszewski Date: Wed, 05 Nov 2025 09:47:37 +0100 Subject: [PATCH v5 6/8] reset: make the provider of reset-gpios the parent of the reset device Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251105-reset-gpios-swnodes-v5-6-1f67499a8287@linaro.org> References: <20251105-reset-gpios-swnodes-v5-0-1f67499a8287@linaro.org> In-Reply-To: <20251105-reset-gpios-swnodes-v5-0-1f67499a8287@linaro.org> To: Linus Walleij , Bartosz Golaszewski , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Philipp Zabel , Krzysztof Kozlowski Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3056; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=wbCx8dCgwX5b7rXFrK7TZvcGe4EfqUhDGU8MlxrqJm4=; b=owEBbQKS/ZANAwAKARGnLqAUcddyAcsmYgBpCw8y94lVfYRIK3McHELuUpTU5D9HiSg4LMYZM EAFZ69aoMCJAjMEAAEKAB0WIQQWnetsC8PEYBPSx58Rpy6gFHHXcgUCaQsPMgAKCRARpy6gFHHX ci/GEADK4gCdF+QDAPvyLEV4JJIEZZxgc1ErzGdn2kDofeunda+GvStXzppBh/AuLJ4gxCjfq0S l1wmQAggynStqV+JKrxGsCw/fDMxLObSyY1lgDa+usBSk+dFPTDAYhT5HAecSJn0/aCyPwp/5Mg 2H7M5a8RpFXeuA2DqnLp+OtIUylDqO2DwEr8+R8CBrjJO11QRCbT1bXFKiC67sVTkLdfQCPntFh EdI1AyHFpBaKWzO794u1vQoSMRHEvZZwBdsMx/icWd1yLl3GKL0rSrvbd6HUuiKQjCU4QMdVAx7 kNQf6Kcm+KrHm9TEsaDGEStQWonlDedBK6YQ3O4rngunRNW7mRXsmfFzP9MT5bNRnScjj3hJVK/ mJyGTFXxwhyCFWwRPZyOvACvGKyiAUJEZjDJ67TnsuAilPYrWGMD4QK0CG9zsBU5VrDlXewu4zZ mk80DChNrF1wkVh+4TcUJVoxVIz1mlk722K2+uF/gNy1k+DKlyIbZIpCg3sQfnUWCog1o+V9KL2 bRoSlxkfuz2ei975/7mushqLRkpUrmLgeStJqV0DNaMlbaqAHc/Qc/a0xkUbuXy9b54g3IZ+8r5 UhTrrZYZiUZCDWECU3GVJQzil+X6wAuEzHjuKZKRg01NYjtlh9msW88V6H2Xgq0nCFYoell4GJr jHg0GjyJe3xm22A== X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 From: Bartosz Golaszewski Auxiliary devices really do need a parent so ahead of converting the reset-gpios driver to registering on the auxiliary bus, make the GPIO device that provides the reset GPIO the parent of the reset-gpio device. To that end move the lookup of the GPIO device by fwnode to the beginning of __reset_add_reset_gpio_device() which has the added benefit of bailing out earlier, before allocating resources for the virtual device, if the chip is not up yet. Reviewed-by: Philipp Zabel Acked-by: Linus Walleij Signed-off-by: Bartosz Golaszewski --- drivers/reset/core.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/reset/core.c b/drivers/reset/core.c index a368b14144e7bc29ae23becab2eb7a96a4adbe44..af42f4d12bbbfcba225219eac6d= 6c7edbe2405cc 100644 --- a/drivers/reset/core.c +++ b/drivers/reset/core.c @@ -822,11 +822,11 @@ static void __reset_control_put_internal(struct reset= _control *rstc) kref_put(&rstc->refcnt, __reset_control_release); } =20 -static int __reset_add_reset_gpio_lookup(int id, struct device_node *np, +static int __reset_add_reset_gpio_lookup(struct gpio_device *gdev, int id, + struct device_node *np, unsigned int gpio, unsigned int of_flags) { - const struct fwnode_handle *fwnode =3D of_fwnode_handle(np); unsigned int lookup_flags; const char *label_tmp; =20 @@ -841,10 +841,6 @@ static int __reset_add_reset_gpio_lookup(int id, struc= t device_node *np, return -EINVAL; } =20 - struct gpio_device *gdev __free(gpio_device_put) =3D gpio_device_find_by_= fwnode(fwnode); - if (!gdev) - return -EPROBE_DEFER; - label_tmp =3D gpio_device_get_label(gdev); if (!label_tmp) return -EINVAL; @@ -899,6 +895,11 @@ static int __reset_add_reset_gpio_device(const struct = of_phandle_args *args) */ lockdep_assert_not_held(&reset_list_mutex); =20 + struct gpio_device *gdev __free(gpio_device_put) =3D + gpio_device_find_by_fwnode(of_fwnode_handle(args->np)); + if (!gdev) + return -EPROBE_DEFER; + guard(mutex)(&reset_gpio_lookup_mutex); =20 list_for_each_entry(rgpio_dev, &reset_gpio_lookup_list, list) { @@ -919,7 +920,7 @@ static int __reset_add_reset_gpio_device(const struct o= f_phandle_args *args) goto err_ida_free; } =20 - ret =3D __reset_add_reset_gpio_lookup(id, args->np, args->args[0], + ret =3D __reset_add_reset_gpio_lookup(gdev, id, args->np, args->args[0], args->args[1]); if (ret < 0) goto err_kfree; @@ -931,7 +932,8 @@ static int __reset_add_reset_gpio_device(const struct o= f_phandle_args *args) * Hold reference as long as rgpio_dev memory is valid. */ of_node_get(rgpio_dev->of_args.np); - pdev =3D platform_device_register_data(NULL, "reset-gpio", id, + pdev =3D platform_device_register_data(gpio_device_to_device(gdev), + "reset-gpio", id, &rgpio_dev->of_args, sizeof(rgpio_dev->of_args)); ret =3D PTR_ERR_OR_ZERO(pdev); --=20 2.51.0 From nobody Fri Dec 19 12:45:19 2025 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 286CA2DC357 for ; Wed, 5 Nov 2025 08:48:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762332495; cv=none; b=DCuaJo/aAbMpDAA7BCRLmMukAZQafAhTGwd142t36cX7PuxBiX5uoGI91Tb+/HUySunZjcNHbOvkCr2mO+QjcNjsxJAMQRhBsFkW8HatiAu4vmkgthsPfCcGGX/zuawEx1YRxebmGjL2Hij1svqMfKbgfzIC3Y96VJax9KBk/jw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762332495; c=relaxed/simple; bh=RblnhEgjT1ATQCpBOT39uE2nJPA2rhEO7IRHMN8Quh0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bypJzLytl/bIePLoRX/Kv6+TtyNyK0qXvTYmWGRvhL6Pn65ljCLIVs+N+GZ56Lqz4Xa8JhfrvDgTAJ0Le7fL6qtvlMPbpdN2nLx9xDZ7M9VtAitpDnuk8AcFx1CgjGus902YTrakJzbCKibrJ1K/pYuPkfp6xafjA7xh2jj+IM4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=yp7LniJ5; arc=none smtp.client-ip=209.85.221.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="yp7LniJ5" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-429c19b5de4so1271920f8f.3 for ; Wed, 05 Nov 2025 00:48:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1762332490; x=1762937290; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=zRbag5R4phUt0lvwmog2563w0RmrCN5eKMWnzPULmkg=; b=yp7LniJ5k+tuz6kI2UeWTYCo9yKx6hiweep77Yjb74b8gsCiYivAQr8QQuahRPc9aU FaYzp8NSB+QttTGTvSqWYs8dSXktX9rtAvwiV0QOo8gfIFRnzLRPZ2aoeiomxGXfvsq6 /h2WF6g+EFyZAUZd6UEmfTayOPSZfxQr53hkejJtkFG2C37OT0lPYqti6sWWH7sd3bB1 +rcsKFvXqTKU8fPaUfkUvgKSc/dLNrAdJ0z0F+es/ri54QhiVg5pqqZSh9az2UewROTB s9YYTsStS1ZSK6clzDb8PhO19YxGQ9ZCnAMgs7kQVLamTawLLTnkuHG1HwavC3ft4bc4 mRLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762332490; x=1762937290; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zRbag5R4phUt0lvwmog2563w0RmrCN5eKMWnzPULmkg=; b=k0sKsotza6U/2rpog2VfTUumxH43/KiJ3x9kWckGU/sDSw6ySn01EWXM1XU5c94kWa pjikBWD6TEE/7Y3Aq9tFgoaruaBe5QlOdTP3PaPIhb0nvfhUftwwD+GkDsbzWYfi+maU 3TPEnigwCfCzfbE5eqF1vGRwClPRutgb6W0iufmt+SMqSN3EosNn7/b7ki2lg/mzJTyO JlRYlTnOxIQmFtYM3RXcTykXGYub1QKPn0SXCBxq8MPTZTENmCBzDjZCtQfapG2l0STK 9NYZufrIT8P36oFaQmixiH/j+UqVg+BZL76J2CA00nndOpV492CxwPITuwzPfRJR+JQF 6yqQ== X-Forwarded-Encrypted: i=1; AJvYcCVC7V6Z8qwPQGQQ4tUg5fIu6v0t3XpglpaEteARPIIZtqxibYxXY/+jbzBeo8TdmloI3PC6YOyTtBmH6E0=@vger.kernel.org X-Gm-Message-State: AOJu0Yx/AVRCSqn8HhsmSm/xssDLqBTVQe/C0KHA5ZLlfIjYFCLvUUnQ NK1AywU0kaUE+UzpCXi3QKS9f0u+AZIGh7Axdu0xzZ/+5Lgr+yUeenIopT6mVNkT93k= X-Gm-Gg: ASbGncvpOp4Iu6ZcrmjSjTbKr/mUAmOZxmaZUixl4uSUi/IU6Z37MESVJskQcEHyMnc PLLylrZQ3dfY0XCTW37LFZAVI8b5cnKTglHP4Wiurf3Ekm9CPW7A6CyhBhSTVQkm5vQLSOK9rqm 9k0m306xcJIugiTSsEupysxM3t0A8uH7nshnW7K6c+9owfDbLoRfPVsCV587zx3sNRBJjUbcQxF MGiJTg9P7tmV1ysaVZebzfT94SDDrVrWZ7Kpdw82YhI/F7daZZa14RWtoQnv6G9Wo82Z87fi1Mu BF/HttUFV0iW0XxEdtO4p22Mi0NoZAG/JV1Hs6JH72rX+8Fw/ziXGkCkxaens9g/bPNH97JemZ/ xpKpmrZdUljgpekv8vXpwHLVhNJs3nLhOoXZ0/n41KvoYbTbnO9kiGYJpN6F2hZhq5rFWpg== X-Google-Smtp-Source: AGHT+IHFdgupmZQjjNPKK2Hdlytw71iW5JNMxOC3/yJ6wdug8mwzbWkD+SzLbGPLgyoeDoEIfEht5Q== X-Received: by 2002:a05:6000:22c4:b0:427:7f0:95f0 with SMTP id ffacd0b85a97d-429e33079c5mr1768149f8f.37.1762332489393; Wed, 05 Nov 2025 00:48:09 -0800 (PST) Received: from [127.0.1.1] ([2a01:cb1d:dc:7e00:4e71:8371:5a52:77e4]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-429dc1f9cdbsm9315936f8f.34.2025.11.05.00.48.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Nov 2025 00:48:08 -0800 (PST) From: Bartosz Golaszewski Date: Wed, 05 Nov 2025 09:47:38 +0100 Subject: [PATCH v5 7/8] reset: gpio: convert the driver to using the auxiliary bus Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251105-reset-gpios-swnodes-v5-7-1f67499a8287@linaro.org> References: <20251105-reset-gpios-swnodes-v5-0-1f67499a8287@linaro.org> In-Reply-To: <20251105-reset-gpios-swnodes-v5-0-1f67499a8287@linaro.org> To: Linus Walleij , Bartosz Golaszewski , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Philipp Zabel , Krzysztof Kozlowski Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=5084; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=f8XqWT6MV/Vm24ULyDMORR+Vw3utb1iWh132/5v3Ubw=; b=owEBbQKS/ZANAwAKARGnLqAUcddyAcsmYgBpCw8yYVRHDD3E12dVJC0rwQ7WsEpfipPFL+dME BxRROEbJNiJAjMEAAEKAB0WIQQWnetsC8PEYBPSx58Rpy6gFHHXcgUCaQsPMgAKCRARpy6gFHHX clX2EADDWk2TS8JzwJf2hluVKTYk9n+o8eO2Y9pzjRZH4g74ijOlyq9h4ylsvUU9IpCzgoAprqw txuWk8fggh5oezwQIbuvcyqc2MyQ2ToQtdCY7xH2cjU0Z7vq+ESQWQf+ZScaE0TznJPzx/255si KYdohT3woEhFCxiBlOBZIfXuRYiOveSkONsJ/T3IStbzMYSPa6ysPLsFONOm7O9d5RQ6POcQNiD AZgOHP7FR8JVTtz7D5WLv+cQlaAmpSPVKrhZh4lCSaWxmHdtEm1y3Jn0kGt5zHBtBzCyR5meiEj WVjQhZ5e7ZwNX+6qvYZhGeZqNkrRZLnNjh1hwoYUbDUW5VU1xQD+KCpgRYqRngCR4tq890Bcf+r WkqoLXbOhWy7MIxp9FDCNxdfl+xERhUdzgN8sDeejhiVAG0MMuNyqUovukwzE0xeeVOzIAZsfGC xcbpdXzcUbbkp/bpbdq5sCZ4fQMmqrKpagNFq/pX7z7UoTxUDGSQKWZyJx1UvgAnGJaGHQpeSUL 34k0k32Kw2+k2bqZojmxaXci3qzEUeGTyU+JXw9gDRFXnzkxN59EXBC0koRj+MaFA6cCSNBb2Jo gokY95xgaLb22EM1NOO2YEWx7kfjpomRVZ7j6gKbguy/Yj+UKZ7SJTvCyA9z9dc+yVdNLRkP8Fg lIEdNUN39cRbJ4Q== X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 From: Bartosz Golaszewski As the reset-gpio devices are purely virtual and never instantiated from real firmware nodes, let's convert the driver to using the - more fitting - auxiliary bus. Reviewed-by: Philipp Zabel Acked-by: Linus Walleij Signed-off-by: Bartosz Golaszewski --- drivers/reset/Kconfig | 1 + drivers/reset/core.c | 14 ++++++-------- drivers/reset/reset-gpio.c | 19 ++++++++++--------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig index 67ca87c9a86ecdbd41cbd3397d2a0c9921227eef..26c8efce0394b238691e87b0408= 7b3d705bfadb0 100644 --- a/drivers/reset/Kconfig +++ b/drivers/reset/Kconfig @@ -99,6 +99,7 @@ config RESET_EYEQ config RESET_GPIO tristate "GPIO reset controller" depends on GPIOLIB + select AUXILIARY_BUS help This enables a generic reset controller for resets attached via GPIOs. Typically for OF platforms this driver expects "reset-gpios" diff --git a/drivers/reset/core.c b/drivers/reset/core.c index af42f4d12bbbfcba225219eac6d6c7edbe2405cc..fcf1c24086e565015b0956fdd40= 334274a1edb00 100644 --- a/drivers/reset/core.c +++ b/drivers/reset/core.c @@ -7,6 +7,7 @@ =20 #include #include +#include #include #include #include @@ -18,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -855,7 +855,7 @@ static int __reset_add_reset_gpio_lookup(struct gpio_de= vice *gdev, int id, if (!lookup) return -ENOMEM; =20 - lookup->dev_id =3D kasprintf(GFP_KERNEL, "reset-gpio.%d", id); + lookup->dev_id =3D kasprintf(GFP_KERNEL, "reset.gpio.%d", id); if (!lookup->dev_id) return -ENOMEM; =20 @@ -876,7 +876,7 @@ static int __reset_add_reset_gpio_lookup(struct gpio_de= vice *gdev, int id, static int __reset_add_reset_gpio_device(const struct of_phandle_args *arg= s) { struct reset_gpio_lookup *rgpio_dev; - struct platform_device *pdev; + struct auxiliary_device *adev; int id, ret; =20 /* @@ -932,11 +932,9 @@ static int __reset_add_reset_gpio_device(const struct = of_phandle_args *args) * Hold reference as long as rgpio_dev memory is valid. */ of_node_get(rgpio_dev->of_args.np); - pdev =3D platform_device_register_data(gpio_device_to_device(gdev), - "reset-gpio", id, - &rgpio_dev->of_args, - sizeof(rgpio_dev->of_args)); - ret =3D PTR_ERR_OR_ZERO(pdev); + adev =3D auxiliary_device_create(gpio_device_to_device(gdev), "reset", + "gpio", &rgpio_dev->of_args, id); + ret =3D PTR_ERR_OR_ZERO(adev); if (ret) goto err_put; =20 diff --git a/drivers/reset/reset-gpio.c b/drivers/reset/reset-gpio.c index 2290b25b6703536f2245f15cab870bd7092d3453..e5512b3b596b5290af20e5fdd99= a38f81e670d2b 100644 --- a/drivers/reset/reset-gpio.c +++ b/drivers/reset/reset-gpio.c @@ -1,10 +1,10 @@ // SPDX-License-Identifier: GPL-2.0 =20 +#include #include #include #include #include -#include #include =20 struct reset_gpio_priv { @@ -61,9 +61,10 @@ static void reset_gpio_of_node_put(void *data) of_node_put(data); } =20 -static int reset_gpio_probe(struct platform_device *pdev) +static int reset_gpio_probe(struct auxiliary_device *adev, + const struct auxiliary_device_id *id) { - struct device *dev =3D &pdev->dev; + struct device *dev =3D &adev->dev; struct of_phandle_args *platdata =3D dev_get_platdata(dev); struct reset_gpio_priv *priv; int ret; @@ -75,7 +76,7 @@ static int reset_gpio_probe(struct platform_device *pdev) if (!priv) return -ENOMEM; =20 - platform_set_drvdata(pdev, &priv->rc); + auxiliary_set_drvdata(adev, &priv->rc); =20 priv->reset =3D devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); if (IS_ERR(priv->reset)) @@ -99,20 +100,20 @@ static int reset_gpio_probe(struct platform_device *pd= ev) return devm_reset_controller_register(dev, &priv->rc); } =20 -static const struct platform_device_id reset_gpio_ids[] =3D { - { .name =3D "reset-gpio", }, +static const struct auxiliary_device_id reset_gpio_ids[] =3D { + { .name =3D "reset.gpio" }, {} }; -MODULE_DEVICE_TABLE(platform, reset_gpio_ids); +MODULE_DEVICE_TABLE(auxiliary, reset_gpio_ids); =20 -static struct platform_driver reset_gpio_driver =3D { +static struct auxiliary_driver reset_gpio_driver =3D { .probe =3D reset_gpio_probe, .id_table =3D reset_gpio_ids, .driver =3D { .name =3D "reset-gpio", }, }; -module_platform_driver(reset_gpio_driver); +module_auxiliary_driver(reset_gpio_driver); =20 MODULE_AUTHOR("Krzysztof Kozlowski "); MODULE_DESCRIPTION("Generic GPIO reset driver"); --=20 2.51.0 From nobody Fri Dec 19 12:45:19 2025 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 86CE92E2679 for ; Wed, 5 Nov 2025 08:48:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762332494; cv=none; b=e7hn56zL8P5xAxe6RfXwbf61/MMOS+k0PVXHyre4edZlmxdHg+60h0U2kiP9F5H3Td3FmlNJTx0XNVZWjNNuj7ET6HsoxYKKmWLnCNhuGPk/ZqHgw1orkQ+r/5lJBI+VkmO1ZGjgQSU6o4nfOEIAeYn6uQkz3F8N2d2XedPbPxU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762332494; c=relaxed/simple; bh=SGEipYyBFPCCyVC6q8YgOSs4LCXD3vaIIQV9W9NaxB4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=toBr7/eA8iiE+I7LROV9gcK/eTimoB7+6hJCULTMxjpXfCY1X9ymvYizGpSrlmQmkUymhE3dDbQBXSyv51RL+oQNfauflCTC9UWam/Ba6SZjPYxZ64q0n/0KsKLoJbBciPFRJlJazXHqhya4eiKxgfGi4/U3DQPgoltt3JgpOFc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=qtO7Sb8g; arc=none smtp.client-ip=209.85.221.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="qtO7Sb8g" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-3ece1102998so4387135f8f.2 for ; Wed, 05 Nov 2025 00:48:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1762332491; x=1762937291; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=DkhhDNpmKZjGJKpspl88pg7px7XG43dcD6b9QvYDK5U=; b=qtO7Sb8gg3JwQxi9AazobilbIhGG9+btvldMINwfkCRsQN2X4ODwsFY16FnjQSSIms kPyoOXE4GgYEvU61UrKdnNrIUCKRFn1nZCc6h4yQdXYHkpvR6RHiR+shmNVntOGydRK1 06Eboa3SJ418r1JauJYYI5azGLhvd4c45n6jrkQ7Afqio3s9NgYOsFztIh+BoqYPULzu ZcwTGJGhvcAmeqiB5mYDSd52e/3qPtPbJG5cSkaM0tobtE80hlxMVb0Psw+MQAv3Sgqq Nqqa7IFUHNdpLXVPuiRdwdWEM1ECegivBZ2tcDv1WGVmmK5vVS2y1j/6PU8VD+39q/Ps eXTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762332491; x=1762937291; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DkhhDNpmKZjGJKpspl88pg7px7XG43dcD6b9QvYDK5U=; b=rsfVgarZxqrftqv7KBhyxVfUkwOis23EH10zoyHNLZs395aB7xPdFhQpWv3YdJB4wB nH/6JwOyLrovNe/eRGT3ASd4UWTMUAwc0fVcUJ8ozT7/NlXdzSAmzGj1dYbW9iqTNvZp rLYSCg+UhnbNiKEm6pEprqbWJjvqmJT/dsq2FgHdT9Drz5KyqCa/GU1L6Bl6NFlkBvfq ogXpOLM9D9eFzN1mWDrRztb+uBN4jy1vmqq3BXko4NnwEiNtU6puFQRKEcGrYniMLCdx NtG04G8dyhYeGIyNlXdiLihMH/XCPB7CtymhiBxG/GQet47++93HxNWbgMH4BB5zJcNq T1Dw== X-Forwarded-Encrypted: i=1; AJvYcCXdTDsk2wL9mBFwsz2z1P82XBb51+9jnA4iy9esdqnZ4bLEXHZC9YjdhMeipvJLLYCg1Uyfvuik6OoUSUQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yyu+OGmz/dAFs9SUooPGeoPnYbnr3f5auZ+wtF9MlTeM5PFeNDC P9ddzGFZqOC1AUqZa5pDGveflXWGZzcfthxKxNCKAWSTkFotLoj588+9qHWNxxV+YzEIAL6Bl87 W4gkPoebdYw== X-Gm-Gg: ASbGncuyMtgL6NyPpvu3bhhl78TrCT5xPALKJsUvVkgtN2VOtmCL90r1KJioVvp66e6 VgUZXIa6fYCDKXd7rO25hDygL2TUUuolosLPpO2sSZL3X4Ap07ltCo/D4cyLYMRQL1Y8kfk/x+n BOx0xH/CkM2PKxZw1GIFazqXws5540qNuFocIVjriAd3u80AJ8jqbX/ns0VWvzt8PsgWmNHQpFR iGMzQ1fpL2cOsnC4qnxKhIBw6BLNdwDBCS3E8faSh/zoLlPvqNp/6bKTSpA19lJmzTf3q9eKP0t wsnZB0aTOaQxkKxsU6l2LH9eboA9WPg7x7xTSpQLzmu5k+uzBZHvIU+6W/s2uLohINEJEYLtM1/ IFALHAKpwNlxZM9/udy10NS0FkfKgXDp9VsLL0ebOsHcTxPNYxTzGK9EN1cseG0WqKcphow== X-Google-Smtp-Source: AGHT+IGTUfxyJN5QHNOp0FTOnoLQgzs14kVKOEtC+nMrHYH+LcVaxtpywpF6tGJ9j4zAjwjvArwqFw== X-Received: by 2002:a05:6000:458f:b0:429:cbba:b242 with SMTP id ffacd0b85a97d-429e3306470mr1523705f8f.41.1762332490686; Wed, 05 Nov 2025 00:48:10 -0800 (PST) Received: from [127.0.1.1] ([2a01:cb1d:dc:7e00:4e71:8371:5a52:77e4]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-429dc1f9cdbsm9315936f8f.34.2025.11.05.00.48.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Nov 2025 00:48:09 -0800 (PST) From: Bartosz Golaszewski Date: Wed, 05 Nov 2025 09:47:39 +0100 Subject: [PATCH v5 8/8] reset: gpio: use software nodes to setup the GPIO lookup Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251105-reset-gpios-swnodes-v5-8-1f67499a8287@linaro.org> References: <20251105-reset-gpios-swnodes-v5-0-1f67499a8287@linaro.org> In-Reply-To: <20251105-reset-gpios-swnodes-v5-0-1f67499a8287@linaro.org> To: Linus Walleij , Bartosz Golaszewski , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Philipp Zabel , Krzysztof Kozlowski Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=7132; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=NNQdvThjugcgWNXPcBcBS6gI52byrFAWIB9wM4h8qXg=; b=owEBbQKS/ZANAwAKARGnLqAUcddyAcsmYgBpCw8yu1+tDlfSt4WuUulr+TLFSJdB3g8qziixY B74F11UPXuJAjMEAAEKAB0WIQQWnetsC8PEYBPSx58Rpy6gFHHXcgUCaQsPMgAKCRARpy6gFHHX cr1ND/9zeaDEMfSGJ6sFnCXa81JnjVuhcR/lMtxHf4udsqyjNAXIcSXpxXHKffLYaG8Fr39Xxd1 EydW+kJbY6qoaZDS5iXNm8aXsZl990kvC1or3OWfVvL226s3ZUOXL/Dmagok6Yo6VdYj54gMuOd /I0Fy45FfGNXMn4CJZczIWZC8qFYa398RWzQdmYxTIiSeJiLjBbCbboFqWKzOBAmVvTg5wF40Pu 3vCU2pBUT5DVJoh7HHYiB5BJ59axl4ycnXbf97Q+03sNPXakO7mKAIgCsxUrl7HBCuZt/TpiQiT B0dqiIbzIs+kwk4hvDuhvgFkSc64bGxpA+CvWctGtLLAZG2lmm3tTSZjjGk/NOzCdiK6taFXQHh 9VtL6y18Fnv97p8M1Q15bWZB3jKe5f5ERhlRI0pbpI5Ia4guNu3a+Tw9wtfXQpwqAuOJViy5qXl 7S+4VMLHJbsHTfrjP9Fbic++ocS83Bu5ZIUNd3M4KjlpQB0RSfGGepSiR5Ooq9izM8s3gciyBE9 h+KXawiFy4us4GwQ7CJ+3Nabw+VxjUC/4v+mjlRRVj5bth1J73Y7opJ46yFsReWYXYWyoe8l2FO 7hjwcPqI2m0M0B5FrqWDVhz+DqUHyCCnAxgztV/ffn+2wjevtkFt0pUcCpxYanR7j8lgyAlx+ov yWEQj8EO+3TUSHA== X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 From: Bartosz Golaszewski GPIO machine lookup is a nice mechanism for associating GPIOs with consumers if we don't know what kind of device the GPIO provider is or when it will become available. However in the case of the reset-gpio, we are already holding a reference to the device and so can reference its firmware node. Let's setup a software node that references the relevant GPIO and attach it to the auxiliary device we're creating. Reviewed-by: Philipp Zabel Acked-by: Linus Walleij Signed-off-by: Bartosz Golaszewski --- drivers/reset/core.c | 129 ++++++++++++++++++++++++++++++-----------------= ---- 1 file changed, 75 insertions(+), 54 deletions(-) diff --git a/drivers/reset/core.c b/drivers/reset/core.c index fcf1c24086e565015b0956fdd40334274a1edb00..66a99bdfb7093232d169c92d49c= b953c4b1033e6 100644 --- a/drivers/reset/core.c +++ b/drivers/reset/core.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -77,10 +78,12 @@ struct reset_control_array { /** * struct reset_gpio_lookup - lookup key for ad-hoc created reset-gpio dev= ices * @of_args: phandle to the reset controller with all the args like GPIO n= umber + * @swnode: Software node containing the reference to the GPIO provider * @list: list entry for the reset_gpio_lookup_list */ struct reset_gpio_lookup { struct of_phandle_args of_args; + struct fwnode_handle *swnode; struct list_head list; }; =20 @@ -822,52 +825,45 @@ static void __reset_control_put_internal(struct reset= _control *rstc) kref_put(&rstc->refcnt, __reset_control_release); } =20 -static int __reset_add_reset_gpio_lookup(struct gpio_device *gdev, int id, - struct device_node *np, - unsigned int gpio, - unsigned int of_flags) +static void reset_gpio_aux_device_release(struct device *dev) { - unsigned int lookup_flags; - const char *label_tmp; + struct auxiliary_device *adev =3D to_auxiliary_dev(dev); =20 - /* - * Later we map GPIO flags between OF and Linux, however not all - * constants from include/dt-bindings/gpio/gpio.h and - * include/linux/gpio/machine.h match each other. - */ - if (of_flags > GPIO_ACTIVE_LOW) { - pr_err("reset-gpio code does not support GPIO flags %u for GPIO %u\n", - of_flags, gpio); - return -EINVAL; + kfree(adev); +} + +static int reset_add_gpio_aux_device(struct device *parent, + struct fwnode_handle *swnode, + int id, void *pdata) +{ + struct auxiliary_device *adev; + int ret; + + adev =3D kzalloc(sizeof(*adev), GFP_KERNEL); + if (!adev) + return -ENOMEM; + + adev->id =3D id; + adev->name =3D "gpio"; + adev->dev.parent =3D parent; + adev->dev.platform_data =3D pdata; + adev->dev.release =3D reset_gpio_aux_device_release; + device_set_node(&adev->dev, swnode); + + ret =3D auxiliary_device_init(adev); + if (ret) { + kfree(adev); + return ret; } =20 - label_tmp =3D gpio_device_get_label(gdev); - if (!label_tmp) - return -EINVAL; + ret =3D __auxiliary_device_add(adev, "reset"); + if (ret) { + auxiliary_device_uninit(adev); + kfree(adev); + return ret; + } =20 - char *label __free(kfree) =3D kstrdup(label_tmp, GFP_KERNEL); - if (!label) - return -ENOMEM; - - /* Size: one lookup entry plus sentinel */ - struct gpiod_lookup_table *lookup __free(kfree) =3D kzalloc(struct_size(l= ookup, table, 2), - GFP_KERNEL); - if (!lookup) - return -ENOMEM; - - lookup->dev_id =3D kasprintf(GFP_KERNEL, "reset.gpio.%d", id); - if (!lookup->dev_id) - return -ENOMEM; - - lookup_flags =3D GPIO_PERSISTENT; - lookup_flags |=3D of_flags & GPIO_ACTIVE_LOW; - lookup->table[0] =3D GPIO_LOOKUP(no_free_ptr(label), gpio, "reset", - lookup_flags); - - /* Not freed on success, because it is persisent subsystem data. */ - gpiod_add_lookup_table(no_free_ptr(lookup)); - - return 0; + return ret; } =20 /* @@ -875,9 +871,11 @@ static int __reset_add_reset_gpio_lookup(struct gpio_d= evice *gdev, int id, */ static int __reset_add_reset_gpio_device(const struct of_phandle_args *arg= s) { + struct property_entry properties[] =3D { {}, {} }; struct reset_gpio_lookup *rgpio_dev; - struct auxiliary_device *adev; - int id, ret; + unsigned int offset, of_flags; + struct device *parent; + int id, ret, lflags; =20 /* * Currently only #gpio-cells=3D2 is supported with the meaning of: @@ -895,6 +893,23 @@ static int __reset_add_reset_gpio_device(const struct = of_phandle_args *args) */ lockdep_assert_not_held(&reset_list_mutex); =20 + offset =3D args->args[0]; + of_flags =3D args->args[1]; + + /* + * Later we map GPIO flags between OF and Linux, however not all + * constants from include/dt-bindings/gpio/gpio.h and + * include/linux/gpio/machine.h match each other. + * + * FIXME: Find a better way of translating OF flags to GPIO lookup + * flags. + */ + if (of_flags > GPIO_ACTIVE_LOW) { + pr_err("reset-gpio code does not support GPIO flags %u for GPIO %u\n", + of_flags, offset); + return -EINVAL; + } + struct gpio_device *gdev __free(gpio_device_put) =3D gpio_device_find_by_fwnode(of_fwnode_handle(args->np)); if (!gdev) @@ -909,6 +924,10 @@ static int __reset_add_reset_gpio_device(const struct = of_phandle_args *args) } } =20 + lflags =3D GPIO_PERSISTENT | (of_flags & GPIO_ACTIVE_LOW); + parent =3D gpio_device_to_device(gdev); + properties[0] =3D PROPERTY_ENTRY_GPIO("reset-gpios", parent->fwnode, offs= et, lflags); + id =3D ida_alloc(&reset_gpio_ida, GFP_KERNEL); if (id < 0) return id; @@ -920,11 +939,6 @@ static int __reset_add_reset_gpio_device(const struct = of_phandle_args *args) goto err_ida_free; } =20 - ret =3D __reset_add_reset_gpio_lookup(gdev, id, args->np, args->args[0], - args->args[1]); - if (ret < 0) - goto err_kfree; - rgpio_dev->of_args =3D *args; /* * We keep the device_node reference, but of_args.np is put at the end @@ -932,19 +946,26 @@ static int __reset_add_reset_gpio_device(const struct= of_phandle_args *args) * Hold reference as long as rgpio_dev memory is valid. */ of_node_get(rgpio_dev->of_args.np); - adev =3D auxiliary_device_create(gpio_device_to_device(gdev), "reset", - "gpio", &rgpio_dev->of_args, id); - ret =3D PTR_ERR_OR_ZERO(adev); + + rgpio_dev->swnode =3D fwnode_create_software_node(properties, NULL); + if (IS_ERR(rgpio_dev->swnode)) { + ret =3D PTR_ERR(rgpio_dev->swnode); + goto err_put_of_node; + } + + ret =3D reset_add_gpio_aux_device(parent, rgpio_dev->swnode, id, + &rgpio_dev->of_args); if (ret) - goto err_put; + goto err_del_swnode; =20 list_add(&rgpio_dev->list, &reset_gpio_lookup_list); =20 return 0; =20 -err_put: +err_del_swnode: + fwnode_remove_software_node(rgpio_dev->swnode); +err_put_of_node: of_node_put(rgpio_dev->of_args.np); -err_kfree: kfree(rgpio_dev); err_ida_free: ida_free(&reset_gpio_ida, id); --=20 2.51.0