dtoc: Rename the phandle struct
authorSimon Glass <sjg@chromium.org>
Tue, 29 Aug 2017 20:15:56 +0000 (14:15 -0600)
committerSimon Glass <sjg@chromium.org>
Fri, 15 Sep 2017 11:27:47 +0000 (05:27 -0600)
Rather than naming the phandle struct according to the number of cells it
uses (e.g. struct phandle_2_cell) name it according to the number of
arguments it has (e.g. struct phandle_1_arg). This is a more intuitive
naming.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
doc/driver-model/of-plat.txt
drivers/clk/clk-uclass.c
include/clk.h
include/dt-structs.h
tools/dtoc/dtb_platdata.py
tools/dtoc/test_dtoc.py

index 3ed8c759d691d925c8c7a9be703c17bc59ca6970..732bc34f067d5736456123c9c11988f0ba8ecae3 100644 (file)
@@ -111,7 +111,7 @@ struct dtd_rockchip_rk3288_dw_mshc {
         bool            cap_sd_highspeed;
         fdt32_t         card_detect_delay;
         fdt32_t         clock_freq_min_max[2];
-        struct phandle_2_cell clocks[4];
+        struct phandle_1_arg clocks[4];
         bool            disable_wp;
         fdt32_t         fifo_depth;
         fdt32_t         interrupts[3];
index e68d9279b96322737e14125d25d65ae029688e30..8b40326efa2c60036f14473a9ea27ed4ed22f9b4 100644 (file)
@@ -23,7 +23,7 @@ static inline struct clk_ops *clk_dev_ops(struct udevice *dev)
 #if CONFIG_IS_ENABLED(OF_CONTROL)
 # if CONFIG_IS_ENABLED(OF_PLATDATA)
 int clk_get_by_index_platdata(struct udevice *dev, int index,
-                             struct phandle_2_cell *cells, struct clk *clk)
+                             struct phandle_1_arg *cells, struct clk *clk)
 {
        int ret;
 
index c5988f78a8f1a1c7fc3f6b777eb00848db490757..e7ce3e8576883f8e6df0d21d19347bfd9d7047be 100644 (file)
@@ -61,9 +61,9 @@ struct clk {
 };
 
 #if CONFIG_IS_ENABLED(OF_CONTROL) && CONFIG_IS_ENABLED(CLK)
-struct phandle_2_cell;
+struct phandle_1_arg;
 int clk_get_by_index_platdata(struct udevice *dev, int index,
-                             struct phandle_2_cell *cells, struct clk *clk);
+                             struct phandle_1_arg *cells, struct clk *clk);
 
 /**
  * clock_get_by_index - Get/request a clock by integer index.
index 0732c442ff8d9e600c39979327d911b2dc0c6300..2ed997115aee5e6e56a9fb4fbc0f0740bd27b5ca 100644 (file)
@@ -9,7 +9,12 @@
 
 /* These structures may only be used in SPL */
 #if CONFIG_IS_ENABLED(OF_PLATDATA)
-struct phandle_2_cell {
+struct phandle_0_arg {
+       const void *node;
+       int id[0];
+};
+
+struct phandle_1_arg {
        const void *node;
        int id;
 };
index 001bc4ea668913686303b3b6c1c422603f6ec29a..0234f71b76712f88445a26e10747b4c45dc977ca 100644 (file)
@@ -419,7 +419,8 @@ class DtbPlatdata(object):
                 info = self.get_phandle_argc(prop, structs[name])
                 if info:
                     # For phandles, include a reference to the target
-                    self.out('\t%s%s[%d]' % (tab_to(2, 'struct phandle_2_cell'),
+                    struct_name = 'struct phandle_%d_arg' % info.max_args
+                    self.out('\t%s%s[%d]' % (tab_to(2, struct_name),
                                              conv_name_to_c(prop.name),
                                              len(prop.value) / 2))
                 else:
index 62460acb7c5c7acbbe3a26337a2516ddb2af7580..23c4439ed9183347eb080782f1cb5e82b3fddd2f 100644 (file)
@@ -228,7 +228,7 @@ U_BOOT_DEVICE(pmic_at_9) = {
         self.assertEqual('''#include <stdbool.h>
 #include <libfdt.h>
 struct dtd_source {
-\tstruct phandle_2_cell clocks[1];
+\tstruct phandle_1_arg clocks[1];
 };
 struct dtd_target {
 \tfdt32_t\t\tintval;