firmware/br-ext-chip-allwinner/board/v83x/kernel/patches/00000-drivers_of_platform.c...

27 lines
814 B
Diff

diff -drupN a/drivers/of/platform.c b/drivers/of/platform.c
--- a/drivers/of/platform.c 2018-08-06 17:23:04.000000000 +0300
+++ b/drivers/of/platform.c 2022-06-12 05:28:14.000000000 +0300
@@ -78,6 +78,22 @@ void of_device_make_bus_id(struct device
struct device_node *node = dev->of_node;
const __be32 *reg;
u64 addr;
+ const char __maybe_unused *name;
+
+#if defined(CONFIG_ARCH_SUNXI)
+ /*
+ * In sunxi platform, we have used "device_type" property as an unique
+ * name for each platform device.
+ */
+ name = of_get_property(node, "device_name", NULL);
+ if (!name)
+ name = of_get_property(node, "device_type", NULL);
+
+ if (name) {
+ dev_set_name(dev, "%s", name);
+ return;
+ }
+#endif
/* Construct the name, using parent nodes if necessary to ensure uniqueness */
while (node->parent) {