[PATCH 1/3] driver: support Linux device/driver OF struct member names

Ahmad Fatoum a.fatoum at pengutronix.de
Thu Dec 8 23:10:00 PST 2022


When porting drivers from Linux, one of the modifications that needs to
be done is to rename all .of_node to .device_node and of_match_table
to of_compatible. Just accept both names. It comes at no extra cost.

Once all barebox drivers use the Linux naming, we could drop the union
again.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 include/driver.h | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/include/driver.h b/include/driver.h
index 2386949c312a..1c50b79886c1 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -74,7 +74,10 @@ struct device_d {
 	struct list_head cdevs;
 
 	const struct platform_device_id *id_entry;
-	struct device_node *device_node;
+	union {
+		struct device_node *device_node;
+		struct device_node *of_node;
+	};
 
 	const struct of_device_id *of_id_entry;
 
@@ -113,7 +116,10 @@ struct driver_d {
 	struct bus_type *bus;
 
 	const struct platform_device_id *id_table;
-	const struct of_device_id *of_compatible;
+	union {
+		const struct of_device_id *of_compatible;
+		const struct of_device_id *of_match_table;
+	};
 };
 
 /*@}*/	/* do not delete, doxygen relevant */
-- 
2.30.2




More information about the barebox mailing list