[PATCH RFC 1/3] amba: bus: Warn on adding an AMBA device without valid periphid
From: Zijun Hu
Date: Sun Sep 08 2024 - 19:38:44 EST
From: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>
In order to handle rare case that an AMBA device is added without valid
periphid, it is costly for @amba_bustype's match() to try to read periphid
from hardware, so remind user to configure periphid via DT|ACPI as far as
possible by warning message.
Signed-off-by: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>
---
drivers/amba/bus.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index 34bc880ca20b..cc3c57f83798 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -560,6 +560,9 @@ int amba_device_add(struct amba_device *dev, struct resource *parent)
/* If primecell ID isn't hard-coded, figure it out */
if (!dev->periphid) {
+ dev_warn(&dev->dev,
+ "Periphid of AMBA device '%s' is not configured, please fix it\n",
+ dev_name(&dev->dev));
/*
* AMBA device uevents require reading its pid and cid
* registers. To do this, the device must be on, clocked and
--
2.34.1