From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Bartosz Golaszewski <brgl@kernel.org>, Linus Walleij <linusw@kernel.org>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/4] gpiolib: of: compile of_find_trigger_gpio() conditionally
Date: Fri, 17 Jul 2026 21:13:06 -0700 [thread overview]
Message-ID: <20260718041311.2605172-2-dmitry.torokhov@gmail.com> (raw)
In-Reply-To: <20260718041311.2605172-1-dmitry.torokhov@gmail.com>
Compile of_find_trigger_gpio() and include its entry in the
of_find_gpio_quirks table only when CONFIG_LEDS_TRIGGER_GPIO is enabled,
and remove the redundant runtime check.
Assisted-by: Antigravity:gemini-3.5-flash
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/gpio/gpiolib-of.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index fc77cf6b306a..f4ea7ca27296 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -651,6 +651,7 @@ static struct gpio_desc *of_find_mt2701_gpio(struct device_node *np,
}
#endif
+#if IS_ENABLED(CONFIG_LEDS_TRIGGER_GPIO)
/*
* Trigger sources are special, they allow us to use any GPIO as a LED trigger
* and have the name "trigger-sources" no matter which kind of phandle it is
@@ -664,9 +665,6 @@ static struct gpio_desc *of_find_trigger_gpio(struct device_node *np,
{
struct gpio_desc *desc;
- if (!IS_ENABLED(CONFIG_LEDS_TRIGGER_GPIO))
- return ERR_PTR(-ENOENT);
-
if (!con_id || strcmp(con_id, "trigger-sources"))
return ERR_PTR(-ENOENT);
@@ -676,6 +674,7 @@ static struct gpio_desc *of_find_trigger_gpio(struct device_node *np,
return desc;
}
+#endif
typedef struct gpio_desc *(*of_find_gpio_quirk)(struct device_node *np,
@@ -687,7 +686,9 @@ static const of_find_gpio_quirk of_find_gpio_quirks[] = {
#if IS_ENABLED(CONFIG_SND_SOC_MT2701_CS42448)
of_find_mt2701_gpio,
#endif
+#if IS_ENABLED(CONFIG_LEDS_TRIGGER_GPIO)
of_find_trigger_gpio,
+#endif
NULL
};
--
2.55.0.229.g6434b31f56-goog
next prev parent reply other threads:[~2026-07-18 4:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-18 4:13 [PATCH 1/4] gpiolib: of: remove redundant IS_ENABLED check in of_find_mt2701_gpio() Dmitry Torokhov
2026-07-18 4:13 ` Dmitry Torokhov [this message]
2026-07-18 4:13 ` [PATCH 3/4] gpiolib: of: add a quirk for legacy name for TWL4030 external mute GPIO Dmitry Torokhov
2026-07-18 4:13 ` [PATCH 4/4] gpiolib: of: clean up formatting to pass checkpatch Dmitry Torokhov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260718041311.2605172-2-dmitry.torokhov@gmail.com \
--to=dmitry.torokhov@gmail.com \
--cc=brgl@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome