diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2022-08-18 07:19:47 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-09-01 10:40:49 +0200 |
commit | a2d9b1d42d7e5ff060bc42adb7ae0301f78e09f0 (patch) | |
tree | 2adf13676f33f49584911b905cb2418e33a8157e /drivers | |
parent | dc5f9e74316aac7eac45dbe88060cc1a7ea8d834 (diff) | |
download | barebox-a2d9b1d42d7e5ff060bc42adb7ae0301f78e09f0.tar.gz barebox-a2d9b1d42d7e5ff060bc42adb7ae0301f78e09f0.tar.xz |
driver: consult feature controller prior to device probe
The newly added feature controller framework has two goals: Avoid
probing device in barebox that aren't indeed available and fixing
up the kernel tree, so the same devices aren't probed either.
The first one is easily done, by checking whether a feature is gated
prior to probe.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20220818051955.2088238-3-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/base/driver.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/base/driver.c b/drivers/base/driver.c index e7288f6a61..072870bea4 100644 --- a/drivers/base/driver.c +++ b/drivers/base/driver.c @@ -27,6 +27,7 @@ #include <linux/err.h> #include <complete.h> #include <pinctrl.h> +#include <featctrl.h> #include <linux/clk/clk-conf.h> #ifdef CONFIG_DEBUG_PROBES @@ -85,6 +86,14 @@ int device_probe(struct device_d *dev) static int depth = 0; int ret; + ret = of_feature_controller_check(dev->device_node); + if (ret < 0) + return ret; + if (ret == FEATCTRL_GATED) { + dev_dbg(dev, "feature gated, skipping probe\n"); + return -ENODEV; + } + depth++; pr_report_probe("%*sprobe-> %s\n", depth * 4, "", dev_name(dev)); |