From nobody Sun Feb 8 15:46:04 2026 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (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 D9735321442 for ; Fri, 19 Dec 2025 12:18:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766146700; cv=none; b=i3/XPUqfJgVIgzFAxlTng8tnmss5FLSVYV2QmZ6ezKRJn8MnXWxPoe+tpqsXi/gavXPpRYlrNZOcU88yeMRk6zc3ZqrNliJelNrjuyGAMjgjIx8skOtvcDBbNyRFK3XS0GM9n82FCaMkEzR6ffHUo94rYGT14d9lIcruJoUrRzU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766146700; c=relaxed/simple; bh=NqYpGRwNiJZMNHsNDQ6mieRhnvQaiij1LSadtAJlSSc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=LIwEf5F4MP/b45+j2dfvRXmru6ukjfyk9ZxkEeSntiKQW/aj466JTLAZ+j2zbu9aXfugtpxSXjnPY1sdwAyDyUi+QD9PY1W7uf6brOOgWqf11CajxDzgbgu7vCPP+vJm0kwnlCvjAPUOd6eHUr33maQZKOWrBbd3YVd6GgJj7ME= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk; spf=pass smtp.mailfrom=rasmusvillemoes.dk; dkim=pass (1024-bit key) header.d=rasmusvillemoes.dk header.i=@rasmusvillemoes.dk header.b=S18wUPp0; arc=none smtp.client-ip=209.85.167.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rasmusvillemoes.dk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=rasmusvillemoes.dk header.i=@rasmusvillemoes.dk header.b="S18wUPp0" Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-5959d9a8eceso1898006e87.3 for ; Fri, 19 Dec 2025 04:18:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; t=1766146696; x=1766751496; 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=eO7uXcZKUOMnaSXMHDCw019HIcNxVBD6hOyBH7bitFI=; b=S18wUPp070C8lolPtp9ZB0YeDqH0jNUMDCGGdZWpB4xsnXdYEKdFsw0/KmTF5GOt3j lxD7xUT5aEWFUSbdVE/eBBjNfFLi77hrb1eLsVm7/UVqUVQJPSkG1I+0c8zsDBCikNFT cwj0/ivhDF8NQYt8V7nVw3BbhMNaCsriCMXXU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766146696; x=1766751496; 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=eO7uXcZKUOMnaSXMHDCw019HIcNxVBD6hOyBH7bitFI=; b=PruIqYUHWjOzvV7kRnn86RzxiPBKCNM46KgWAWzEkwtqT2j6cvWcaO2JK6yEUpDeE1 wxk/mVVPSTkrCr2e9bmUaBQvJB22BpGgR66Am+iHzOXy1095/oYJbWdpmFYjAOHosDLn pD2aGr7Fc1CAz8tczYWTJ7Xh1Y+cehcBj1dFbMV/+XvcSesyvhp+OHuK9aNLP2N7dIZs +R61G5ZbGIUkuCF1hvoWTHHzPBFSq/2x6scwlUfLpaobnTiSh5GtxSIruUHpm1EXVNMG V9Rt9jRUdsMGxjBA1X7ncoBYQi9FSFUScH4AfDocVc6Q8iq5D83UgG88eWnsm+H4+VO+ e6wg== X-Forwarded-Encrypted: i=1; AJvYcCU5TTy9viNLUP+Ia5LNQL2a4tPNZ7pjFbBb1jU/Y7r7OyL04cBybYjFdijLXjald0Ew3HJ/+5O3ZE6FQLE=@vger.kernel.org X-Gm-Message-State: AOJu0YzuGiPtLljvoHXO93ZqPfh/l/JLuMmMYzbrcS8b1h1MqgjYyP3y +qoU6C0wmZYIkq3q6Nkm8ZiefeuXMzY9OOcbtU+DlWnUA16UKSeD8Ox7SpUQzaMnV42HotEq7qp Lm9+gGEs= X-Gm-Gg: AY/fxX6ERgltnORRNKojyaPE5UAKyD3nG4AnZdjcypwfR17gy03mz/DMUh2MHmxBerP xcrMLXQhwrA7Y6pUDrgZSB2JaiRLIFIx/F9UTEBCkmrDVQDvyi+aZ/3LA/24Q6eF2YdMwTViTjq 4vaS7BIbMuYDWGtO6vs5/AUvo1hdKZPlnuJvkV29At5oVkvgfTE5HWAiRFbzNLiYRDdJL9vlfmp iaedsdtc5I6DGpzd+xPfSHsnNuaMd7yRE13v+wxDQ0dgmwV64lh/DGPAvvVTEFwsFbez7KZW1Wn jGQjzzn3oYBndzijRiyRs5LtZ+GUCi93kF4djuG8ctoJLy5Cdqi1f5/HiKAaxw0ZNvfEl8wfpfq rRgGtjIMZb9M4Vip8rEjoQtWgcvATF9k9zxg2NF7ekFut6KI3vg5xhtoDJ7YVOtuQLhym/yFP26 y0aCD4KMQvuWInnw== X-Google-Smtp-Source: AGHT+IHYJtQhTXdrwBQDN1QFHJOMYQGk+5jKQPR0/HQa9wAXumSUO16WYiRWgoxzde8j3zq4sd+e+g== X-Received: by 2002:a05:6512:3e06:b0:59a:107a:4593 with SMTP id 2adb3069b0e04-59a17d722admr1039997e87.4.1766146695536; Fri, 19 Dec 2025 04:18:15 -0800 (PST) Received: from localhost ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-59a185dd90esm670000e87.31.2025.12.19.04.18.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Dec 2025 04:18:15 -0800 (PST) From: Rasmus Villemoes To: Rob Herring Cc: Saravana Kannan , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Rasmus Villemoes Subject: [PATCH] of: property: stop creating callback for each pinctrl-N property Date: Fri, 19 Dec 2025 13:18:11 +0100 Message-ID: <20251219121811.390988-1-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.52.0 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 Content-Type: text/plain; charset="utf-8" While not a lot in the grand scheme of things, this eliminates 8*2 pointless function calls for almost every property present in the device tree (the exception are the few properties that were already matched). It also seems to reduce .text by about 1.5K - why gcc decides to inline parse_prop_cells() in every instantiation I don't know. Supporting double-digit suffixes would still require tweaking, but it does match pinctrl-9. Signed-off-by: Rasmus Villemoes --- drivers/of/property.c | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/drivers/of/property.c b/drivers/of/property.c index c1feb631e383..7c6fe4529d73 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -21,6 +21,7 @@ =20 #define pr_fmt(fmt) "OF: " fmt =20 +#include #include #include #include @@ -1358,15 +1359,6 @@ DEFINE_SIMPLE_PROP(extcon, "extcon", NULL) DEFINE_SIMPLE_PROP(nvmem_cells, "nvmem-cells", "#nvmem-cell-cells") DEFINE_SIMPLE_PROP(phys, "phys", "#phy-cells") DEFINE_SIMPLE_PROP(wakeup_parent, "wakeup-parent", NULL) -DEFINE_SIMPLE_PROP(pinctrl0, "pinctrl-0", NULL) -DEFINE_SIMPLE_PROP(pinctrl1, "pinctrl-1", NULL) -DEFINE_SIMPLE_PROP(pinctrl2, "pinctrl-2", NULL) -DEFINE_SIMPLE_PROP(pinctrl3, "pinctrl-3", NULL) -DEFINE_SIMPLE_PROP(pinctrl4, "pinctrl-4", NULL) -DEFINE_SIMPLE_PROP(pinctrl5, "pinctrl-5", NULL) -DEFINE_SIMPLE_PROP(pinctrl6, "pinctrl-6", NULL) -DEFINE_SIMPLE_PROP(pinctrl7, "pinctrl-7", NULL) -DEFINE_SIMPLE_PROP(pinctrl8, "pinctrl-8", NULL) DEFINE_SIMPLE_PROP(pwms, "pwms", "#pwm-cells") DEFINE_SIMPLE_PROP(resets, "resets", "#reset-cells") DEFINE_SIMPLE_PROP(leds, "leds", NULL) @@ -1380,6 +1372,18 @@ DEFINE_SIMPLE_PROP(power_supplies, "power-supplies",= NULL) DEFINE_SUFFIX_PROP(regulators, "-supply", NULL) DEFINE_SUFFIX_PROP(gpio, "-gpio", "#gpio-cells") =20 +static struct device_node *parse_pinctrl_n(struct device_node *np, + const char *prop_name, int index) +{ + if (!strstarts(prop_name, "pinctrl-")) + return NULL; + + if (!isdigit(prop_name[strlen("pinctrl-")])) + return NULL; + + return of_parse_phandle(np, prop_name, index); +} + static struct device_node *parse_gpios(struct device_node *np, const char *prop_name, int index) { @@ -1503,15 +1507,7 @@ static const struct supplier_bindings of_supplier_bi= ndings[] =3D { { .parse_prop =3D parse_nvmem_cells, }, { .parse_prop =3D parse_phys, }, { .parse_prop =3D parse_wakeup_parent, }, - { .parse_prop =3D parse_pinctrl0, }, - { .parse_prop =3D parse_pinctrl1, }, - { .parse_prop =3D parse_pinctrl2, }, - { .parse_prop =3D parse_pinctrl3, }, - { .parse_prop =3D parse_pinctrl4, }, - { .parse_prop =3D parse_pinctrl5, }, - { .parse_prop =3D parse_pinctrl6, }, - { .parse_prop =3D parse_pinctrl7, }, - { .parse_prop =3D parse_pinctrl8, }, + { .parse_prop =3D parse_pinctrl_n, }, { .parse_prop =3D parse_remote_endpoint, .get_con_dev =3D of_graph_get_port_parent, --=20 2.52.0