[PATCH v2 07/12] sysinfo: Make .detect() non-mandatory

Marek Behún kabel at kernel.org
Thu Nov 4 00:23:27 CET 2021


From: Marek Behún <marek.behun at nic.cz>

Make it so that if the .detect() method is not implemented, the sysinfo
is considered to be present.

Signed-off-by: Marek Behún <marek.behun at nic.cz>
---
 drivers/sysinfo/sysinfo-uclass.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/sysinfo/sysinfo-uclass.c b/drivers/sysinfo/sysinfo-uclass.c
index 71f9ad105a..d945f073c5 100644
--- a/drivers/sysinfo/sysinfo-uclass.c
+++ b/drivers/sysinfo/sysinfo-uclass.c
@@ -25,10 +25,7 @@ int sysinfo_detect(struct udevice *dev)
 	struct sysinfo_priv *priv = dev_get_uclass_priv(dev);
 	struct sysinfo_ops *ops = sysinfo_get_ops(dev);
 
-	if (!ops->detect)
-		return -ENOSYS;
-
-	ret = ops->detect(dev);
+	ret = ops->detect ? ops->detect(dev) : 0;
 	if (!ret)
 		priv->detected = true;
 
-- 
2.32.0



More information about the U-Boot mailing list