Commit 54c5d08a09e631f88738db54c75395c6457c2157

Authored by Heiko Schocher
Committed by Tom Rini
1 parent 9665fa8f9e

dm: rename device struct to udevice

using UBI and DM together leads in compiler error, as
both define a "struct device", so rename "struct device"
in include/dm/device.h to "struct udevice", as we use
linux code (MTD/UBI/UBIFS some USB code,...) and cannot
change the linux "struct device"

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Marek Vasut <marex@denx.de>

Showing 30 changed files with 193 additions and 191 deletions Side-by-side Diff

arch/sandbox/include/asm/gpio.h
... ... @@ -29,7 +29,7 @@
29 29 * @param gp GPIO number
30 30 * @return -1 on error, 0 if GPIO is low, >0 if high
31 31 */
32   -int sandbox_gpio_get_value(struct device *dev, unsigned int offset);
  32 +int sandbox_gpio_get_value(struct udevice *dev, unsigned int offset);
33 33  
34 34 /**
35 35 * Set the simulated value of a GPIO (used only in sandbox test code)
... ... @@ -38,7 +38,7 @@
38 38 * @param value value to set (0 for low, non-zero for high)
39 39 * @return -1 on error, 0 if ok
40 40 */
41   -int sandbox_gpio_set_value(struct device *dev, unsigned int offset, int value);
  41 +int sandbox_gpio_set_value(struct udevice *dev, unsigned int offset, int value);
42 42  
43 43 /**
44 44 * Return the simulated direction of a GPIO (used only in sandbox test code)
... ... @@ -46,7 +46,7 @@
46 46 * @param gp GPIO number
47 47 * @return -1 on error, 0 if GPIO is input, >0 if output
48 48 */
49   -int sandbox_gpio_get_direction(struct device *dev, unsigned int offset);
  49 +int sandbox_gpio_get_direction(struct udevice *dev, unsigned int offset);
50 50  
51 51 /**
52 52 * Set the simulated direction of a GPIO (used only in sandbox test code)
... ... @@ -55,7 +55,7 @@
55 55 * @param output 0 to set as input, 1 to set as output
56 56 * @return -1 on error, 0 if ok
57 57 */
58   -int sandbox_gpio_set_direction(struct device *dev, unsigned int offset,
  58 +int sandbox_gpio_set_direction(struct udevice *dev, unsigned int offset,
59 59 int output);
60 60  
61 61 #endif
... ... @@ -11,7 +11,7 @@
11 11 #include <dm-demo.h>
12 12 #include <asm/io.h>
13 13  
14   -struct device *demo_dev;
  14 +struct udevice *demo_dev;
15 15  
16 16 static int do_demo_hello(cmd_tbl_t *cmdtp, int flag, int argc,
17 17 char * const argv[])
... ... @@ -41,7 +41,7 @@
41 41  
42 42 int do_demo_list(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
43 43 {
44   - struct device *dev;
  44 + struct udevice *dev;
45 45 int i, ret;
46 46  
47 47 puts("Demo uclass entries:\n");
... ... @@ -30,7 +30,7 @@
30 30 "unknown",
31 31 };
32 32  
33   -static void show_gpio(struct device *dev, const char *bank_name, int offset)
  33 +static void show_gpio(struct udevice *dev, const char *bank_name, int offset)
34 34 {
35 35 struct dm_gpio_ops *ops = gpio_get_ops(dev);
36 36 char buf[80];
... ... @@ -62,7 +62,7 @@
62 62  
63 63 static int do_gpio_status(const char *gpio_name)
64 64 {
65   - struct device *dev;
  65 + struct udevice *dev;
66 66 int newline = 0;
67 67 int ret;
68 68  
doc/driver-model/README.txt
... ... @@ -122,7 +122,7 @@
122 122 Let's start at the top. The demo command is in common/cmd_demo.c. It does
123 123 the usual command procesing and then:
124 124  
125   - struct device *demo_dev;
  125 + struct udevice *demo_dev;
126 126  
127 127 ret = uclass_get_device(UCLASS_DEMO, devnum, &demo_dev);
128 128  
... ... @@ -147,7 +147,7 @@
147 147  
148 148 The code for demo_hello() is in drivers/demo/demo-uclass.c:
149 149  
150   -int demo_hello(struct device *dev, int ch)
  150 +int demo_hello(struct udevice *dev, int ch)
151 151 {
152 152 const struct demo_ops *ops = device_get_ops(dev);
153 153  
... ... @@ -160,7 +160,7 @@
160 160 As you can see it just calls the relevant driver method. One of these is
161 161 in drivers/demo/demo-simple.c:
162 162  
163   -static int simple_hello(struct device *dev, int ch)
  163 +static int simple_hello(struct udevice *dev, int ch)
164 164 {
165 165 const struct dm_demo_pdata *pdata = dev_get_platdata(dev);
166 166  
... ... @@ -321,7 +321,7 @@
321 321 this concept relates to a class of drivers (or a subsystem). We shouldn't
322 322 use 'class' since it is a C++ reserved word, so U-Boot class (uclass) seems
323 323 better than 'core'.
324   -- Remove 'struct driver_instance' and just use a single 'struct device'.
  324 +- Remove 'struct driver_instance' and just use a single 'struct udevice'.
325 325 This removes a level of indirection that doesn't seem necessary.
326 326 - Built in device tree support, to avoid the need for platdata
327 327 - Removed the concept of driver relocation, and just make it possible for
drivers/core/device.c
... ... @@ -30,9 +30,9 @@
30 30 * @dev: The device that is to be stripped of its children
31 31 * @return 0 on success, -ve on error
32 32 */
33   -static int device_chld_unbind(struct device *dev)
  33 +static int device_chld_unbind(struct udevice *dev)
34 34 {
35   - struct device *pos, *n;
  35 + struct udevice *pos, *n;
36 36 int ret, saved_ret = 0;
37 37  
38 38 assert(dev);
39 39  
... ... @@ -51,9 +51,9 @@
51 51 * @dev: The device whose children are to be removed
52 52 * @return 0 on success, -ve on error
53 53 */
54   -static int device_chld_remove(struct device *dev)
  54 +static int device_chld_remove(struct udevice *dev)
55 55 {
56   - struct device *pos, *n;
  56 + struct udevice *pos, *n;
57 57 int ret;
58 58  
59 59 assert(dev);
60 60  
... ... @@ -67,10 +67,10 @@
67 67 return 0;
68 68 }
69 69  
70   -int device_bind(struct device *parent, struct driver *drv, const char *name,
71   - void *platdata, int of_offset, struct device **devp)
  70 +int device_bind(struct udevice *parent, struct driver *drv, const char *name,
  71 + void *platdata, int of_offset, struct udevice **devp)
72 72 {
73   - struct device *dev;
  73 + struct udevice *dev;
74 74 struct uclass *uc;
75 75 int ret = 0;
76 76  
... ... @@ -82,7 +82,7 @@
82 82 if (ret)
83 83 return ret;
84 84  
85   - dev = calloc(1, sizeof(struct device));
  85 + dev = calloc(1, sizeof(struct udevice));
86 86 if (!dev)
87 87 return -ENOMEM;
88 88  
... ... @@ -129,8 +129,8 @@
129 129 return ret;
130 130 }
131 131  
132   -int device_bind_by_name(struct device *parent, const struct driver_info *info,
133   - struct device **devp)
  132 +int device_bind_by_name(struct udevice *parent, const struct driver_info *info,
  133 + struct udevice **devp)
134 134 {
135 135 struct driver *drv;
136 136  
... ... @@ -142,7 +142,7 @@
142 142 -1, devp);
143 143 }
144 144  
145   -int device_unbind(struct device *dev)
  145 +int device_unbind(struct udevice *dev)
146 146 {
147 147 struct driver *drv;
148 148 int ret;
... ... @@ -181,7 +181,7 @@
181 181 * device_free() - Free memory buffers allocated by a device
182 182 * @dev: Device that is to be started
183 183 */
184   -static void device_free(struct device *dev)
  184 +static void device_free(struct udevice *dev)
185 185 {
186 186 int size;
187 187  
... ... @@ -200,7 +200,7 @@
200 200 }
201 201 }
202 202  
203   -int device_probe(struct device *dev)
  203 +int device_probe(struct udevice *dev)
204 204 {
205 205 struct driver *drv;
206 206 int size = 0;
... ... @@ -279,7 +279,7 @@
279 279 return ret;
280 280 }
281 281  
282   -int device_remove(struct device *dev)
  282 +int device_remove(struct udevice *dev)
283 283 {
284 284 struct driver *drv;
285 285 int ret;
... ... @@ -327,7 +327,7 @@
327 327 return ret;
328 328 }
329 329  
330   -void *dev_get_platdata(struct device *dev)
  330 +void *dev_get_platdata(struct udevice *dev)
331 331 {
332 332 if (!dev) {
333 333 dm_warn("%s: null device", __func__);
... ... @@ -337,7 +337,7 @@
337 337 return dev->platdata;
338 338 }
339 339  
340   -void *dev_get_priv(struct device *dev)
  340 +void *dev_get_priv(struct udevice *dev)
341 341 {
342 342 if (!dev) {
343 343 dm_warn("%s: null device", __func__);
drivers/core/lists.c
... ... @@ -60,13 +60,13 @@
60 60 return NULL;
61 61 }
62 62  
63   -int lists_bind_drivers(struct device *parent)
  63 +int lists_bind_drivers(struct udevice *parent)
64 64 {
65 65 struct driver_info *info =
66 66 ll_entry_start(struct driver_info, driver_info);
67 67 const int n_ents = ll_entry_count(struct driver_info, driver_info);
68 68 struct driver_info *entry;
69   - struct device *dev;
  69 + struct udevice *dev;
70 70 int result = 0;
71 71 int ret;
72 72  
73 73  
... ... @@ -116,12 +116,12 @@
116 116 return -ENOENT;
117 117 }
118 118  
119   -int lists_bind_fdt(struct device *parent, const void *blob, int offset)
  119 +int lists_bind_fdt(struct udevice *parent, const void *blob, int offset)
120 120 {
121 121 struct driver *driver = ll_entry_start(struct driver, driver);
122 122 const int n_ents = ll_entry_count(struct driver, driver);
123 123 struct driver *entry;
124   - struct device *dev;
  124 + struct udevice *dev;
125 125 const char *name;
126 126 int result = 0;
127 127 int ret;
... ... @@ -24,7 +24,7 @@
24 24 .name = "root_driver",
25 25 };
26 26  
27   -struct device *dm_root(void)
  27 +struct udevice *dm_root(void)
28 28 {
29 29 if (!gd->dm_root) {
30 30 dm_warn("Virtual root driver does not exist!\n");
drivers/core/uclass.c
... ... @@ -101,7 +101,7 @@
101 101 int uclass_destroy(struct uclass *uc)
102 102 {
103 103 struct uclass_driver *uc_drv;
104   - struct device *dev, *tmp;
  104 + struct udevice *dev, *tmp;
105 105 int ret;
106 106  
107 107 list_for_each_entry_safe(dev, tmp, &uc->dev_head, uclass_node) {
108 108  
... ... @@ -137,10 +137,10 @@
137 137 return 0;
138 138 }
139 139  
140   -int uclass_find_device(enum uclass_id id, int index, struct device **devp)
  140 +int uclass_find_device(enum uclass_id id, int index, struct udevice **devp)
141 141 {
142 142 struct uclass *uc;
143   - struct device *dev;
  143 + struct udevice *dev;
144 144 int ret;
145 145  
146 146 *devp = NULL;
147 147  
... ... @@ -158,9 +158,9 @@
158 158 return -ENODEV;
159 159 }
160 160  
161   -int uclass_get_device(enum uclass_id id, int index, struct device **devp)
  161 +int uclass_get_device(enum uclass_id id, int index, struct udevice **devp)
162 162 {
163   - struct device *dev;
  163 + struct udevice *dev;
164 164 int ret;
165 165  
166 166 *devp = NULL;
167 167  
... ... @@ -177,10 +177,10 @@
177 177 return 0;
178 178 }
179 179  
180   -int uclass_first_device(enum uclass_id id, struct device **devp)
  180 +int uclass_first_device(enum uclass_id id, struct udevice **devp)
181 181 {
182 182 struct uclass *uc;
183   - struct device *dev;
  183 + struct udevice *dev;
184 184 int ret;
185 185  
186 186 *devp = NULL;
... ... @@ -190,7 +190,7 @@
190 190 if (list_empty(&uc->dev_head))
191 191 return 0;
192 192  
193   - dev = list_first_entry(&uc->dev_head, struct device, uclass_node);
  193 + dev = list_first_entry(&uc->dev_head, struct udevice, uclass_node);
194 194 ret = device_probe(dev);
195 195 if (ret)
196 196 return ret;
197 197  
198 198  
... ... @@ -199,16 +199,17 @@
199 199 return 0;
200 200 }
201 201  
202   -int uclass_next_device(struct device **devp)
  202 +int uclass_next_device(struct udevice **devp)
203 203 {
204   - struct device *dev = *devp;
  204 + struct udevice *dev = *devp;
205 205 int ret;
206 206  
207 207 *devp = NULL;
208 208 if (list_is_last(&dev->uclass_node, &dev->uclass->dev_head))
209 209 return 0;
210 210  
211   - dev = list_entry(dev->uclass_node.next, struct device, uclass_node);
  211 + dev = list_entry(dev->uclass_node.next, struct udevice,
  212 + uclass_node);
212 213 ret = device_probe(dev);
213 214 if (ret)
214 215 return ret;
... ... @@ -217,7 +218,7 @@
217 218 return 0;
218 219 }
219 220  
220   -int uclass_bind_device(struct device *dev)
  221 +int uclass_bind_device(struct udevice *dev)
221 222 {
222 223 struct uclass *uc;
223 224 int ret;
... ... @@ -237,7 +238,7 @@
237 238 return 0;
238 239 }
239 240  
240   -int uclass_unbind_device(struct device *dev)
  241 +int uclass_unbind_device(struct udevice *dev)
241 242 {
242 243 struct uclass *uc;
243 244 int ret;
... ... @@ -253,7 +254,7 @@
253 254 return 0;
254 255 }
255 256  
256   -int uclass_post_probe_device(struct device *dev)
  257 +int uclass_post_probe_device(struct udevice *dev)
257 258 {
258 259 struct uclass_driver *uc_drv = dev->uclass->uc_drv;
259 260  
... ... @@ -263,7 +264,7 @@
263 264 return 0;
264 265 }
265 266  
266   -int uclass_pre_remove_device(struct device *dev)
  267 +int uclass_pre_remove_device(struct udevice *dev)
267 268 {
268 269 struct uclass_driver *uc_drv;
269 270 struct uclass *uc;
drivers/demo/demo-shape.c
... ... @@ -23,7 +23,7 @@
23 23 };
24 24  
25 25 /* Crazy little function to draw shapes on the console */
26   -static int shape_hello(struct device *dev, int ch)
  26 +static int shape_hello(struct udevice *dev, int ch)
27 27 {
28 28 const struct dm_demo_pdata *pdata = dev_get_platdata(dev);
29 29 struct shape_data *data = dev_get_priv(dev);
... ... @@ -81,7 +81,7 @@
81 81 return 0;
82 82 }
83 83  
84   -static int shape_status(struct device *dev, int *status)
  84 +static int shape_status(struct udevice *dev, int *status)
85 85 {
86 86 struct shape_data *data = dev_get_priv(dev);
87 87  
... ... @@ -94,7 +94,7 @@
94 94 .status = shape_status,
95 95 };
96 96  
97   -static int shape_ofdata_to_platdata(struct device *dev)
  97 +static int shape_ofdata_to_platdata(struct udevice *dev)
98 98 {
99 99 struct dm_demo_pdata *pdata = dev_get_platdata(dev);
100 100 int ret;
drivers/demo/demo-simple.c
... ... @@ -12,7 +12,7 @@
12 12 #include <dm-demo.h>
13 13 #include <asm/io.h>
14 14  
15   -static int simple_hello(struct device *dev, int ch)
  15 +static int simple_hello(struct udevice *dev, int ch)
16 16 {
17 17 const struct dm_demo_pdata *pdata = dev_get_platdata(dev);
18 18  
... ... @@ -26,7 +26,7 @@
26 26 .hello = simple_hello,
27 27 };
28 28  
29   -static int demo_shape_ofdata_to_platdata(struct device *dev)
  29 +static int demo_shape_ofdata_to_platdata(struct udevice *dev)
30 30 {
31 31 /* Parse the data that is common with all demo devices */
32 32 return demo_parse_dt(dev);
drivers/demo/demo-uclass.c
... ... @@ -22,7 +22,7 @@
22 22 .id = UCLASS_DEMO,
23 23 };
24 24  
25   -int demo_hello(struct device *dev, int ch)
  25 +int demo_hello(struct udevice *dev, int ch)
26 26 {
27 27 const struct demo_ops *ops = device_get_ops(dev);
28 28  
... ... @@ -32,7 +32,7 @@
32 32 return ops->hello(dev, ch);
33 33 }
34 34  
35   -int demo_status(struct device *dev, int *status)
  35 +int demo_status(struct udevice *dev, int *status)
36 36 {
37 37 const struct demo_ops *ops = device_get_ops(dev);
38 38  
... ... @@ -42,7 +42,7 @@
42 42 return ops->status(dev, status);
43 43 }
44 44  
45   -int demo_parse_dt(struct device *dev)
  45 +int demo_parse_dt(struct udevice *dev)
46 46 {
47 47 struct dm_demo_pdata *pdata = dev_get_platdata(dev);
48 48 int dn = dev->of_offset;
drivers/gpio/gpio-uclass.c
... ... @@ -17,11 +17,11 @@
17 17 * or GPIO blocks registered with the GPIO controller. Returns
18 18 * entry on success, NULL on error.
19 19 */
20   -static int gpio_to_device(unsigned int gpio, struct device **devp,
  20 +static int gpio_to_device(unsigned int gpio, struct udevice **devp,
21 21 unsigned int *offset)
22 22 {
23 23 struct gpio_dev_priv *uc_priv;
24   - struct device *dev;
  24 + struct udevice *dev;
25 25 int ret;
26 26  
27 27 for (ret = uclass_first_device(UCLASS_GPIO, &dev);
28 28  
... ... @@ -40,11 +40,11 @@
40 40 return ret ? ret : -EINVAL;
41 41 }
42 42  
43   -int gpio_lookup_name(const char *name, struct device **devp,
  43 +int gpio_lookup_name(const char *name, struct udevice **devp,
44 44 unsigned int *offsetp, unsigned int *gpiop)
45 45 {
46 46 struct gpio_dev_priv *uc_priv;
47   - struct device *dev;
  47 + struct udevice *dev;
48 48 int ret;
49 49  
50 50 if (devp)
... ... @@ -86,7 +86,7 @@
86 86 int gpio_request(unsigned gpio, const char *label)
87 87 {
88 88 unsigned int offset;
89   - struct device *dev;
  89 + struct udevice *dev;
90 90 int ret;
91 91  
92 92 ret = gpio_to_device(gpio, &dev, &offset);
... ... @@ -110,7 +110,7 @@
110 110 int gpio_free(unsigned gpio)
111 111 {
112 112 unsigned int offset;
113   - struct device *dev;
  113 + struct udevice *dev;
114 114 int ret;
115 115  
116 116 ret = gpio_to_device(gpio, &dev, &offset);
... ... @@ -133,7 +133,7 @@
133 133 int gpio_direction_input(unsigned gpio)
134 134 {
135 135 unsigned int offset;
136   - struct device *dev;
  136 + struct udevice *dev;
137 137 int ret;
138 138  
139 139 ret = gpio_to_device(gpio, &dev, &offset);
... ... @@ -155,7 +155,7 @@
155 155 int gpio_direction_output(unsigned gpio, int value)
156 156 {
157 157 unsigned int offset;
158   - struct device *dev;
  158 + struct udevice *dev;
159 159 int ret;
160 160  
161 161 ret = gpio_to_device(gpio, &dev, &offset);
... ... @@ -177,7 +177,7 @@
177 177 int gpio_get_value(unsigned gpio)
178 178 {
179 179 unsigned int offset;
180   - struct device *dev;
  180 + struct udevice *dev;
181 181 int ret;
182 182  
183 183 ret = gpio_to_device(gpio, &dev, &offset);
... ... @@ -199,7 +199,7 @@
199 199 int gpio_set_value(unsigned gpio, int value)
200 200 {
201 201 unsigned int offset;
202   - struct device *dev;
  202 + struct udevice *dev;
203 203 int ret;
204 204  
205 205 ret = gpio_to_device(gpio, &dev, &offset);
... ... @@ -209,7 +209,7 @@
209 209 return gpio_get_ops(dev)->set_value(dev, offset, value);
210 210 }
211 211  
212   -const char *gpio_get_bank_info(struct device *dev, int *bit_count)
  212 +const char *gpio_get_bank_info(struct udevice *dev, int *bit_count)
213 213 {
214 214 struct gpio_dev_priv *priv;
215 215  
... ... @@ -225,7 +225,7 @@
225 225 static int gpio_renumber(void)
226 226 {
227 227 struct gpio_dev_priv *uc_priv;
228   - struct device *dev;
  228 + struct udevice *dev;
229 229 struct uclass *uc;
230 230 unsigned base;
231 231 int ret;
232 232  
... ... @@ -247,12 +247,12 @@
247 247 return 0;
248 248 }
249 249  
250   -static int gpio_post_probe(struct device *dev)
  250 +static int gpio_post_probe(struct udevice *dev)
251 251 {
252 252 return gpio_renumber();
253 253 }
254 254  
255   -static int gpio_pre_remove(struct device *dev)
  255 +static int gpio_pre_remove(struct udevice *dev)
256 256 {
257 257 return gpio_renumber();
258 258 }
drivers/gpio/sandbox.c
... ... @@ -22,7 +22,7 @@
22 22 };
23 23  
24 24 /* Access routines for GPIO state */
25   -static u8 *get_gpio_flags(struct device *dev, unsigned offset)
  25 +static u8 *get_gpio_flags(struct udevice *dev, unsigned offset)
26 26 {
27 27 struct gpio_dev_priv *uc_priv = dev->uclass_priv;
28 28 struct gpio_state *state = dev_get_priv(dev);
29 29  
... ... @@ -36,12 +36,12 @@
36 36 return &state[offset].flags;
37 37 }
38 38  
39   -static int get_gpio_flag(struct device *dev, unsigned offset, int flag)
  39 +static int get_gpio_flag(struct udevice *dev, unsigned offset, int flag)
40 40 {
41 41 return (*get_gpio_flags(dev, offset) & flag) != 0;
42 42 }
43 43  
44   -static int set_gpio_flag(struct device *dev, unsigned offset, int flag,
  44 +static int set_gpio_flag(struct udevice *dev, unsigned offset, int flag,
45 45 int value)
46 46 {
47 47 u8 *gpio = get_gpio_flags(dev, offset);
... ... @@ -54,7 +54,7 @@
54 54 return 0;
55 55 }
56 56  
57   -static int check_reserved(struct device *dev, unsigned offset,
  57 +static int check_reserved(struct udevice *dev, unsigned offset,
58 58 const char *func)
59 59 {
60 60 if (!get_gpio_flag(dev, offset, GPIOF_RESERVED)) {
61 61  
62 62  
63 63  
... ... @@ -70,24 +70,24 @@
70 70 * Back-channel sandbox-internal-only access to GPIO state
71 71 */
72 72  
73   -int sandbox_gpio_get_value(struct device *dev, unsigned offset)
  73 +int sandbox_gpio_get_value(struct udevice *dev, unsigned offset)
74 74 {
75 75 if (get_gpio_flag(dev, offset, GPIOF_OUTPUT))
76 76 debug("sandbox_gpio: get_value on output gpio %u\n", offset);
77 77 return get_gpio_flag(dev, offset, GPIOF_HIGH);
78 78 }
79 79  
80   -int sandbox_gpio_set_value(struct device *dev, unsigned offset, int value)
  80 +int sandbox_gpio_set_value(struct udevice *dev, unsigned offset, int value)
81 81 {
82 82 return set_gpio_flag(dev, offset, GPIOF_HIGH, value);
83 83 }
84 84  
85   -int sandbox_gpio_get_direction(struct device *dev, unsigned offset)
  85 +int sandbox_gpio_get_direction(struct udevice *dev, unsigned offset)
86 86 {
87 87 return get_gpio_flag(dev, offset, GPIOF_OUTPUT);
88 88 }
89 89  
90   -int sandbox_gpio_set_direction(struct device *dev, unsigned offset, int output)
  90 +int sandbox_gpio_set_direction(struct udevice *dev, unsigned offset, int output)
91 91 {
92 92 return set_gpio_flag(dev, offset, GPIOF_OUTPUT, output);
93 93 }
... ... @@ -97,7 +97,7 @@
97 97 */
98 98  
99 99 /* set GPIO port 'offset' as an input */
100   -static int sb_gpio_direction_input(struct device *dev, unsigned offset)
  100 +static int sb_gpio_direction_input(struct udevice *dev, unsigned offset)
101 101 {
102 102 debug("%s: offset:%u\n", __func__, offset);
103 103  
... ... @@ -108,7 +108,7 @@
108 108 }
109 109  
110 110 /* set GPIO port 'offset' as an output, with polarity 'value' */
111   -static int sb_gpio_direction_output(struct device *dev, unsigned offset,
  111 +static int sb_gpio_direction_output(struct udevice *dev, unsigned offset,
112 112 int value)
113 113 {
114 114 debug("%s: offset:%u, value = %d\n", __func__, offset, value);
... ... @@ -121,7 +121,7 @@
121 121 }
122 122  
123 123 /* read GPIO IN value of port 'offset' */
124   -static int sb_gpio_get_value(struct device *dev, unsigned offset)
  124 +static int sb_gpio_get_value(struct udevice *dev, unsigned offset)
125 125 {
126 126 debug("%s: offset:%u\n", __func__, offset);
127 127  
... ... @@ -132,7 +132,7 @@
132 132 }
133 133  
134 134 /* write GPIO OUT value to port 'offset' */
135   -static int sb_gpio_set_value(struct device *dev, unsigned offset, int value)
  135 +static int sb_gpio_set_value(struct udevice *dev, unsigned offset, int value)
136 136 {
137 137 debug("%s: offset:%u, value = %d\n", __func__, offset, value);
138 138  
... ... @@ -148,7 +148,7 @@
148 148 return sandbox_gpio_set_value(dev, offset, value);
149 149 }
150 150  
151   -static int sb_gpio_request(struct device *dev, unsigned offset,
  151 +static int sb_gpio_request(struct udevice *dev, unsigned offset,
152 152 const char *label)
153 153 {
154 154 struct gpio_dev_priv *uc_priv = dev->uclass_priv;
... ... @@ -171,7 +171,7 @@
171 171 return set_gpio_flag(dev, offset, GPIOF_RESERVED, 1);
172 172 }
173 173  
174   -static int sb_gpio_free(struct device *dev, unsigned offset)
  174 +static int sb_gpio_free(struct udevice *dev, unsigned offset)
175 175 {
176 176 struct gpio_state *state = dev_get_priv(dev);
177 177  
... ... @@ -184,7 +184,7 @@
184 184 return set_gpio_flag(dev, offset, GPIOF_RESERVED, 0);
185 185 }
186 186  
187   -static int sb_gpio_get_state(struct device *dev, unsigned int offset,
  187 +static int sb_gpio_get_state(struct udevice *dev, unsigned int offset,
188 188 char *buf, int bufsize)
189 189 {
190 190 struct gpio_dev_priv *uc_priv = dev->uclass_priv;
... ... @@ -213,7 +213,7 @@
213 213 .get_state = sb_gpio_get_state,
214 214 };
215 215  
216   -static int sandbox_gpio_ofdata_to_platdata(struct device *dev)
  216 +static int sandbox_gpio_ofdata_to_platdata(struct udevice *dev)
217 217 {
218 218 struct gpio_dev_priv *uc_priv = dev->uclass_priv;
219 219  
... ... @@ -225,7 +225,7 @@
225 225 return 0;
226 226 }
227 227  
228   -static int gpio_sandbox_probe(struct device *dev)
  228 +static int gpio_sandbox_probe(struct udevice *dev)
229 229 {
230 230 struct gpio_dev_priv *uc_priv = dev->uclass_priv;
231 231  
include/asm-generic/global_data.h
... ... @@ -65,7 +65,7 @@
65 65 struct global_data *new_gd; /* relocated global data */
66 66  
67 67 #ifdef CONFIG_DM
68   - struct device *dm_root; /* Root instance for Driver Model */
  68 + struct udevice *dm_root;/* Root instance for Driver Model */
69 69 struct list_head uclass_root; /* Head of core tree */
70 70 #endif
71 71  
include/asm-generic/gpio.h
... ... @@ -86,7 +86,7 @@
86 86 GPIOF_UNKNOWN,
87 87 };
88 88  
89   -struct device;
  89 +struct udevice;
90 90  
91 91 /**
92 92 * struct struct dm_gpio_ops - Driver model GPIO operations
93 93  
... ... @@ -116,15 +116,15 @@
116 116 * all devices. Be careful not to confuse offset with gpio in the parameters.
117 117 */
118 118 struct dm_gpio_ops {
119   - int (*request)(struct device *dev, unsigned offset, const char *label);
120   - int (*free)(struct device *dev, unsigned offset);
121   - int (*direction_input)(struct device *dev, unsigned offset);
122   - int (*direction_output)(struct device *dev, unsigned offset,
  119 + int (*request)(struct udevice *dev, unsigned offset, const char *label);
  120 + int (*free)(struct udevice *dev, unsigned offset);
  121 + int (*direction_input)(struct udevice *dev, unsigned offset);
  122 + int (*direction_output)(struct udevice *dev, unsigned offset,
123 123 int value);
124   - int (*get_value)(struct device *dev, unsigned offset);
125   - int (*set_value)(struct device *dev, unsigned offset, int value);
126   - int (*get_function)(struct device *dev, unsigned offset);
127   - int (*get_state)(struct device *dev, unsigned offset, char *state,
  124 + int (*get_value)(struct udevice *dev, unsigned offset);
  125 + int (*set_value)(struct udevice *dev, unsigned offset, int value);
  126 + int (*get_function)(struct udevice *dev, unsigned offset);
  127 + int (*get_state)(struct udevice *dev, unsigned offset, char *state,
128 128 int maxlen);
129 129 };
130 130  
... ... @@ -166,7 +166,7 @@
166 166 * @offset_count: Returns number of GPIOs within this bank
167 167 * @return bank name of this device
168 168 */
169   -const char *gpio_get_bank_info(struct device *dev, int *offset_count);
  169 +const char *gpio_get_bank_info(struct udevice *dev, int *offset_count);
170 170  
171 171 /**
172 172 * gpio_lookup_name - Look up a GPIO name and return its details
... ... @@ -179,7 +179,7 @@
179 179 * @offsetp: Returns the offset number within this device
180 180 * @gpiop: Returns the absolute GPIO number, numbered from 0
181 181 */
182   -int gpio_lookup_name(const char *name, struct device **devp,
  182 +int gpio_lookup_name(const char *name, struct udevice **devp,
183 183 unsigned int *offsetp, unsigned int *gpiop);
184 184  
185 185 #endif /* _ASM_GENERIC_GPIO_H_ */
... ... @@ -23,15 +23,15 @@
23 23 };
24 24  
25 25 struct demo_ops {
26   - int (*hello)(struct device *dev, int ch);
27   - int (*status)(struct device *dev, int *status);
  26 + int (*hello)(struct udevice *dev, int ch);
  27 + int (*status)(struct udevice *dev, int *status);
28 28 };
29 29  
30   -int demo_hello(struct device *dev, int ch);
31   -int demo_status(struct device *dev, int *status);
  30 +int demo_hello(struct udevice *dev, int ch);
  31 +int demo_status(struct udevice *dev, int *status);
32 32 int demo_list(void);
33 33  
34   -int demo_parse_dt(struct device *dev);
  34 +int demo_parse_dt(struct udevice *dev);
35 35  
36 36 #endif
include/dm/device-internal.h
... ... @@ -11,7 +11,7 @@
11 11 #ifndef _DM_DEVICE_INTERNAL_H
12 12 #define _DM_DEVICE_INTERNAL_H
13 13  
14   -struct device;
  14 +struct udevice;
15 15  
16 16 /**
17 17 * device_bind() - Create a device and bind it to a driver
18 18  
... ... @@ -34,9 +34,9 @@
34 34 * @devp: Returns a pointer to the bound device
35 35 * @return 0 if OK, -ve on error
36 36 */
37   -int device_bind(struct device *parent, struct driver *drv,
  37 +int device_bind(struct udevice *parent, struct driver *drv,
38 38 const char *name, void *platdata, int of_offset,
39   - struct device **devp);
  39 + struct udevice **devp);
40 40  
41 41 /**
42 42 * device_bind_by_name: Create a device and bind it to a driver
... ... @@ -49,8 +49,8 @@
49 49 * @devp: Returns a pointer to the bound device
50 50 * @return 0 if OK, -ve on error
51 51 */
52   -int device_bind_by_name(struct device *parent, const struct driver_info *info,
53   - struct device **devp);
  52 +int device_bind_by_name(struct udevice *parent, const struct driver_info *info,
  53 + struct udevice **devp);
54 54  
55 55 /**
56 56 * device_probe() - Probe a device, activating it
... ... @@ -61,7 +61,7 @@
61 61 * @dev: Pointer to device to probe
62 62 * @return 0 if OK, -ve on error
63 63 */
64   -int device_probe(struct device *dev);
  64 +int device_probe(struct udevice *dev);
65 65  
66 66 /**
67 67 * device_remove() - Remove a device, de-activating it
... ... @@ -72,7 +72,7 @@
72 72 * @dev: Pointer to device to remove
73 73 * @return 0 if OK, -ve on error (an error here is normally a very bad thing)
74 74 */
75   -int device_remove(struct device *dev);
  75 +int device_remove(struct udevice *dev);
76 76  
77 77 /**
78 78 * device_unbind() - Unbind a device, destroying it
... ... @@ -82,7 +82,7 @@
82 82 * @dev: Pointer to device to unbind
83 83 * @return 0 if OK, -ve on error
84 84 */
85   -int device_unbind(struct device *dev);
  85 +int device_unbind(struct udevice *dev);
86 86  
87 87 #endif
... ... @@ -24,7 +24,7 @@
24 24 #define DM_FLAG_ALLOC_PDATA (2 << 0)
25 25  
26 26 /**
27   - * struct device - An instance of a driver
  27 + * struct udevice - An instance of a driver
28 28 *
29 29 * This holds information about a device, which is a driver bound to a
30 30 * particular port or peripheral (essentially a driver instance).
31 31  
... ... @@ -53,12 +53,12 @@
53 53 * @sibling_node: Next device in list of all devices
54 54 * @flags: Flags for this device DM_FLAG_...
55 55 */
56   -struct device {
  56 +struct udevice {
57 57 struct driver *driver;
58 58 const char *name;
59 59 void *platdata;
60 60 int of_offset;
61   - struct device *parent;
  61 + struct udevice *parent;
62 62 void *priv;
63 63 struct uclass *uclass;
64 64 void *uclass_priv;
... ... @@ -122,11 +122,11 @@
122 122 char *name;
123 123 enum uclass_id id;
124 124 const struct device_id *of_match;
125   - int (*bind)(struct device *dev);
126   - int (*probe)(struct device *dev);
127   - int (*remove)(struct device *dev);
128   - int (*unbind)(struct device *dev);
129   - int (*ofdata_to_platdata)(struct device *dev);
  125 + int (*bind)(struct udevice *dev);
  126 + int (*probe)(struct udevice *dev);
  127 + int (*remove)(struct udevice *dev);
  128 + int (*unbind)(struct udevice *dev);
  129 + int (*ofdata_to_platdata)(struct udevice *dev);
130 130 int priv_auto_alloc_size;
131 131 int platdata_auto_alloc_size;
132 132 const void *ops; /* driver-specific operations */
... ... @@ -144,7 +144,7 @@
144 144 * @dev Device to check
145 145 * @return platform data, or NULL if none
146 146 */
147   -void *dev_get_platdata(struct device *dev);
  147 +void *dev_get_platdata(struct udevice *dev);
148 148  
149 149 /**
150 150 * dev_get_priv() - Get the private data for a device
... ... @@ -154,7 +154,7 @@
154 154 * @dev Device to check
155 155 * @return private data, or NULL if none
156 156 */
157   -void *dev_get_priv(struct device *dev);
  157 +void *dev_get_priv(struct udevice *dev);
158 158  
159 159 #endif
... ... @@ -32,9 +32,9 @@
32 32 */
33 33 struct uclass_driver *lists_uclass_lookup(enum uclass_id id);
34 34  
35   -int lists_bind_drivers(struct device *parent);
  35 +int lists_bind_drivers(struct udevice *parent);
36 36  
37   -int lists_bind_fdt(struct device *parent, const void *blob, int offset);
  37 +int lists_bind_fdt(struct udevice *parent, const void *blob, int offset);
38 38  
39 39 #endif
... ... @@ -10,7 +10,7 @@
10 10 #ifndef _DM_ROOT_H_
11 11 #define _DM_ROOT_H_
12 12  
13   -struct device;
  13 +struct udevice;
14 14  
15 15 /**
16 16 * dm_root() - Return pointer to the top of the driver tree
... ... @@ -19,7 +19,7 @@
19 19 *
20 20 * @return pointer to root device, or NULL if not inited yet
21 21 */
22   -struct device *dm_root(void);
  22 +struct udevice *dm_root(void);
23 23  
24 24 /**
25 25 * dm_scan_platdata() - Scan all platform data and bind drivers
... ... @@ -30,7 +30,7 @@
30 30 * @return 0 if OK, -ve on error
31 31 */
32 32 struct test_ops {
33   - int (*ping)(struct device *dev, int pingval, int *pingret);
  33 + int (*ping)(struct udevice *dev, int pingval, int *pingret);
34 34 };
35 35  
36 36 /* Operations that our test driver supports */
... ... @@ -102,8 +102,8 @@
102 102 * @skip_post_probe: Skip uclass post-probe processing
103 103 */
104 104 struct dm_test_state {
105   - struct device *root;
106   - struct device *testdev;
  105 + struct udevice *root;
  106 + struct udevice *testdev;
107 107 int fail_count;
108 108 int force_fail_alloc;
109 109 int skip_post_probe;
... ... @@ -138,8 +138,8 @@
138 138 }
139 139  
140 140 /* Declare ping methods for the drivers */
141   -int test_ping(struct device *dev, int pingval, int *pingret);
142   -int testfdt_ping(struct device *dev, int pingval, int *pingret);
  141 +int test_ping(struct udevice *dev, int pingval, int *pingret);
  142 +int testfdt_ping(struct udevice *dev, int pingval, int *pingret);
143 143  
144 144 /**
145 145 * dm_check_operations() - Check that we can perform ping operations
... ... @@ -152,7 +152,7 @@
152 152 * @priv: Pointer to private test information
153 153 * @return 0 if OK, -ve on error
154 154 */
155   -int dm_check_operations(struct dm_test_state *dms, struct device *dev,
  155 +int dm_check_operations(struct dm_test_state *dms, struct udevice *dev,
156 156 uint32_t base, struct dm_test_priv *priv);
157 157  
158 158 /**
include/dm/uclass-internal.h
... ... @@ -21,7 +21,7 @@
21 21 * @return the uclass pointer of a child at the given index or
22 22 * return NULL on error.
23 23 */
24   -int uclass_find_device(enum uclass_id id, int index, struct device **devp);
  24 +int uclass_find_device(enum uclass_id id, int index, struct udevice **devp);
25 25  
26 26 /**
27 27 * uclass_bind_device() - Associate device with a uclass
... ... @@ -31,7 +31,7 @@
31 31 * @dev: Pointer to the device
32 32 * #return 0 on success, -ve on error
33 33 */
34   -int uclass_bind_device(struct device *dev);
  34 +int uclass_bind_device(struct udevice *dev);
35 35  
36 36 /**
37 37 * uclass_unbind_device() - Deassociate device with a uclass
... ... @@ -41,7 +41,7 @@
41 41 * @dev: Pointer to the device
42 42 * #return 0 on success, -ve on error
43 43 */
44   -int uclass_unbind_device(struct device *dev);
  44 +int uclass_unbind_device(struct udevice *dev);
45 45  
46 46 /**
47 47 * uclass_post_probe_device() - Deal with a device that has just been probed
... ... @@ -52,7 +52,7 @@
52 52 * @dev: Pointer to the device
53 53 * #return 0 on success, -ve on error
54 54 */
55   -int uclass_post_probe_device(struct device *dev);
  55 +int uclass_post_probe_device(struct udevice *dev);
56 56  
57 57 /**
58 58 * uclass_pre_remove_device() - Handle a device which is about to be removed
... ... @@ -62,7 +62,7 @@
62 62 * @dev: Pointer to the device
63 63 * #return 0 on success, -ve on error
64 64 */
65   -int uclass_pre_remove_device(struct device *dev);
  65 +int uclass_pre_remove_device(struct udevice *dev);
66 66  
67 67 /**
68 68 * uclass_find() - Find uclass by its id
... ... @@ -37,7 +37,7 @@
37 37 struct list_head sibling_node;
38 38 };
39 39  
40   -struct device;
  40 +struct udevice;
41 41  
42 42 /**
43 43 * struct uclass_driver - Driver for the uclass
... ... @@ -65,10 +65,10 @@
65 65 struct uclass_driver {
66 66 const char *name;
67 67 enum uclass_id id;
68   - int (*post_bind)(struct device *dev);
69   - int (*pre_unbind)(struct device *dev);
70   - int (*post_probe)(struct device *dev);
71   - int (*pre_remove)(struct device *dev);
  68 + int (*post_bind)(struct udevice *dev);
  69 + int (*pre_unbind)(struct udevice *dev);
  70 + int (*post_probe)(struct udevice *dev);
  71 + int (*pre_remove)(struct udevice *dev);
72 72 int (*init)(struct uclass *class);
73 73 int (*destroy)(struct uclass *class);
74 74 int priv_auto_alloc_size;
... ... @@ -101,7 +101,7 @@
101 101 * @ucp: Returns pointer to uclass (there is only one per for each ID)
102 102 * @return 0 if OK, -ve on error
103 103 */
104   -int uclass_get_device(enum uclass_id id, int index, struct device **ucp);
  104 +int uclass_get_device(enum uclass_id id, int index, struct udevice **ucp);
105 105  
106 106 /**
107 107 * uclass_first_device() - Get the first device in a uclass
... ... @@ -110,7 +110,7 @@
110 110 * @devp: Returns pointer to the first device in that uclass, or NULL if none
111 111 * @return 0 if OK (found or not found), -1 on error
112 112 */
113   -int uclass_first_device(enum uclass_id id, struct device **devp);
  113 +int uclass_first_device(enum uclass_id id, struct udevice **devp);
114 114  
115 115 /**
116 116 * uclass_next_device() - Get the next device in a uclass
... ... @@ -119,7 +119,7 @@
119 119 * to the next device in the same uclass, or NULL if none
120 120 * @return 0 if OK (found or not found), -1 on error
121 121 */
122   -int uclass_next_device(struct device **devp);
  122 +int uclass_next_device(struct udevice **devp);
123 123  
124 124 /**
125 125 * uclass_foreach_dev() - Helper function to iteration through devices
... ... @@ -127,7 +127,7 @@
127 127 * This creates a for() loop which works through the available devices in
128 128 * a uclass in order from start to end.
129 129 *
130   - * @pos: struct device * to hold the current device. Set to NULL when there
  130 + * @pos: struct udevice * to hold the current device. Set to NULL when there
131 131 * are no more devices.
132 132 * uc: uclass to scan
133 133 */
... ... @@ -16,12 +16,12 @@
16 16 #include <dm/test.h>
17 17 #include <dm/uclass-internal.h>
18 18  
19   -static int display_succ(struct device *in, char *buf)
  19 +static int display_succ(struct udevice *in, char *buf)
20 20 {
21 21 int len;
22 22 int ip = 0;
23 23 char local[16];
24   - struct device *pos, *n, *prev = NULL;
  24 + struct udevice *pos, *n, *prev = NULL;
25 25  
26 26 printf("%s- %s @ %08x", buf, in->name, map_to_sysmem(in));
27 27 if (in->flags & DM_FLAG_ACTIVATED)
... ... @@ -49,7 +49,7 @@
49 49 return 0;
50 50 }
51 51  
52   -static int dm_dump(struct device *dev)
  52 +static int dm_dump(struct udevice *dev)
53 53 {
54 54 if (!dev)
55 55 return -EINVAL;
... ... @@ -59,7 +59,7 @@
59 59 static int do_dm_dump_all(cmd_tbl_t *cmdtp, int flag, int argc,
60 60 char * const argv[])
61 61 {
62   - struct device *root;
  62 + struct udevice *root;
63 63  
64 64 root = dm_root();
65 65 printf("ROOT %08x\n", map_to_sysmem(root));
... ... @@ -74,7 +74,7 @@
74 74 int id;
75 75  
76 76 for (id = 0; id < UCLASS_COUNT; id++) {
77   - struct device *dev;
  77 + struct udevice *dev;
78 78  
79 79 ret = uclass_get(id, &uc);
80 80 if (ret)
... ... @@ -60,7 +60,7 @@
60 60 /* Test that binding with platdata occurs correctly */
61 61 static int dm_test_autobind(struct dm_test_state *dms)
62 62 {
63   - struct device *dev;
  63 + struct udevice *dev;
64 64  
65 65 /*
66 66 * We should have a single class (UCLASS_ROOT) and a single root
... ... @@ -95,7 +95,7 @@
95 95 static int dm_test_autoprobe(struct dm_test_state *dms)
96 96 {
97 97 int expected_base_add;
98   - struct device *dev;
  98 + struct udevice *dev;
99 99 struct uclass *uc;
100 100 int i;
101 101  
... ... @@ -157,7 +157,7 @@
157 157 static int dm_test_platdata(struct dm_test_state *dms)
158 158 {
159 159 const struct dm_test_pdata *pdata;
160   - struct device *dev;
  160 + struct udevice *dev;
161 161 int i;
162 162  
163 163 for (i = 0; i < 3; i++) {
... ... @@ -175,7 +175,7 @@
175 175 static int dm_test_lifecycle(struct dm_test_state *dms)
176 176 {
177 177 int op_count[DM_TEST_OP_COUNT];
178   - struct device *dev, *test_dev;
  178 + struct udevice *dev, *test_dev;
179 179 int pingret;
180 180 int ret;
181 181  
... ... @@ -229,7 +229,7 @@
229 229 /* Test that we can bind/unbind and the lists update correctly */
230 230 static int dm_test_ordering(struct dm_test_state *dms)
231 231 {
232   - struct device *dev, *dev_penultimate, *dev_last, *test_dev;
  232 + struct udevice *dev, *dev_penultimate, *dev_last, *test_dev;
233 233 int pingret;
234 234  
235 235 ut_assertok(device_bind_by_name(dms->root, &driver_info_manual,
... ... @@ -281,7 +281,7 @@
281 281 DM_TEST(dm_test_ordering, DM_TESTF_SCAN_PDATA);
282 282  
283 283 /* Check that we can perform operations on a device (do a ping) */
284   -int dm_check_operations(struct dm_test_state *dms, struct device *dev,
  284 +int dm_check_operations(struct dm_test_state *dms, struct udevice *dev,
285 285 uint32_t base, struct dm_test_priv *priv)
286 286 {
287 287 int expected;
... ... @@ -311,7 +311,7 @@
311 311 /* Check that we can perform operations on devices */
312 312 static int dm_test_operations(struct dm_test_state *dms)
313 313 {
314   - struct device *dev;
  314 + struct udevice *dev;
315 315 int i;
316 316  
317 317 /*
... ... @@ -341,7 +341,7 @@
341 341 /* Remove all drivers and check that things work */
342 342 static int dm_test_remove(struct dm_test_state *dms)
343 343 {
344   - struct device *dev;
  344 + struct udevice *dev;
345 345 int i;
346 346  
347 347 for (i = 0; i < 3; i++) {
... ... @@ -367,7 +367,7 @@
367 367  
368 368 for (i = 0; i < 2; i++) {
369 369 struct mallinfo start, end;
370   - struct device *dev;
  370 + struct udevice *dev;
371 371 int ret;
372 372 int id;
373 373  
374 374  
... ... @@ -435,10 +435,10 @@
435 435 * this array.
436 436 * @return 0 if OK, -ve on error
437 437 */
438   -static int create_children(struct dm_test_state *dms, struct device *parent,
439   - int count, int key, struct device *child[])
  438 +static int create_children(struct dm_test_state *dms, struct udevice *parent,
  439 + int count, int key, struct udevice *child[])
440 440 {
441   - struct device *dev;
  441 + struct udevice *dev;
442 442 int i;
443 443  
444 444 for (i = 0; i < count; i++) {
... ... @@ -460,10 +460,10 @@
460 460  
461 461 static int dm_test_children(struct dm_test_state *dms)
462 462 {
463   - struct device *top[NODE_COUNT];
464   - struct device *child[NODE_COUNT];
465   - struct device *grandchild[NODE_COUNT];
466   - struct device *dev;
  463 + struct udevice *top[NODE_COUNT];
  464 + struct udevice *child[NODE_COUNT];
  465 + struct udevice *grandchild[NODE_COUNT];
  466 + struct udevice *dev;
467 467 int total;
468 468 int ret;
469 469 int i;
... ... @@ -17,7 +17,7 @@
17 17 {
18 18 unsigned int offset, gpio;
19 19 struct dm_gpio_ops *ops;
20   - struct device *dev;
  20 + struct udevice *dev;
21 21 const char *name;
22 22 int offset_count;
23 23 char buf[80];
test/dm/test-driver.c
... ... @@ -18,7 +18,7 @@
18 18 int dm_testdrv_op_count[DM_TEST_OP_COUNT];
19 19 static struct dm_test_state *dms = &global_test_state;
20 20  
21   -static int testdrv_ping(struct device *dev, int pingval, int *pingret)
  21 +static int testdrv_ping(struct udevice *dev, int pingval, int *pingret)
22 22 {
23 23 const struct dm_test_pdata *pdata = dev_get_platdata(dev);
24 24 struct dm_test_priv *priv = dev_get_priv(dev);
... ... @@ -33,7 +33,7 @@
33 33 .ping = testdrv_ping,
34 34 };
35 35  
36   -static int test_bind(struct device *dev)
  36 +static int test_bind(struct udevice *dev)
37 37 {
38 38 /* Private data should not be allocated */
39 39 ut_assert(!dev_get_priv(dev));
... ... @@ -42,7 +42,7 @@
42 42 return 0;
43 43 }
44 44  
45   -static int test_probe(struct device *dev)
  45 +static int test_probe(struct udevice *dev)
46 46 {
47 47 struct dm_test_priv *priv = dev_get_priv(dev);
48 48  
... ... @@ -54,7 +54,7 @@
54 54 return 0;
55 55 }
56 56  
57   -static int test_remove(struct device *dev)
  57 +static int test_remove(struct udevice *dev)
58 58 {
59 59 /* Private data should still be allocated */
60 60 ut_assert(dev_get_priv(dev));
... ... @@ -63,7 +63,7 @@
63 63 return 0;
64 64 }
65 65  
66   -static int test_unbind(struct device *dev)
  66 +static int test_unbind(struct udevice *dev)
67 67 {
68 68 /* Private data should not be allocated */
69 69 ut_assert(!dev->priv);
... ... @@ -94,7 +94,7 @@
94 94 .priv_auto_alloc_size = sizeof(struct dm_test_priv),
95 95 };
96 96  
97   -static int test_manual_drv_ping(struct device *dev, int pingval, int *pingret)
  97 +static int test_manual_drv_ping(struct udevice *dev, int pingval, int *pingret)
98 98 {
99 99 *pingret = pingval + 2;
100 100  
101 101  
... ... @@ -105,14 +105,14 @@
105 105 .ping = test_manual_drv_ping,
106 106 };
107 107  
108   -static int test_manual_bind(struct device *dev)
  108 +static int test_manual_bind(struct udevice *dev)
109 109 {
110 110 dm_testdrv_op_count[DM_TEST_OP_BIND]++;
111 111  
112 112 return 0;
113 113 }
114 114  
115   -static int test_manual_probe(struct device *dev)
  115 +static int test_manual_probe(struct udevice *dev)
116 116 {
117 117 dm_testdrv_op_count[DM_TEST_OP_PROBE]++;
118 118 if (!dms->force_fail_alloc)
119 119  
... ... @@ -123,13 +123,13 @@
123 123 return 0;
124 124 }
125 125  
126   -static int test_manual_remove(struct device *dev)
  126 +static int test_manual_remove(struct udevice *dev)
127 127 {
128 128 dm_testdrv_op_count[DM_TEST_OP_REMOVE]++;
129 129 return 0;
130 130 }
131 131  
132   -static int test_manual_unbind(struct device *dev)
  132 +static int test_manual_unbind(struct udevice *dev)
133 133 {
134 134 dm_testdrv_op_count[DM_TEST_OP_UNBIND]++;
135 135 return 0;
... ... @@ -18,7 +18,7 @@
18 18  
19 19 DECLARE_GLOBAL_DATA_PTR;
20 20  
21   -static int testfdt_drv_ping(struct device *dev, int pingval, int *pingret)
  21 +static int testfdt_drv_ping(struct udevice *dev, int pingval, int *pingret)
22 22 {
23 23 const struct dm_test_pdata *pdata = dev->platdata;
24 24 struct dm_test_priv *priv = dev_get_priv(dev);
... ... @@ -33,7 +33,7 @@
33 33 .ping = testfdt_drv_ping,
34 34 };
35 35  
36   -static int testfdt_ofdata_to_platdata(struct device *dev)
  36 +static int testfdt_ofdata_to_platdata(struct udevice *dev)
37 37 {
38 38 struct dm_test_pdata *pdata = dev_get_platdata(dev);
39 39  
... ... @@ -44,7 +44,7 @@
44 44 return 0;
45 45 }
46 46  
47   -static int testfdt_drv_probe(struct device *dev)
  47 +static int testfdt_drv_probe(struct udevice *dev)
48 48 {
49 49 struct dm_test_priv *priv = dev_get_priv(dev);
50 50  
... ... @@ -75,7 +75,7 @@
75 75 };
76 76  
77 77 /* From here is the testfdt uclass code */
78   -int testfdt_ping(struct device *dev, int pingval, int *pingret)
  78 +int testfdt_ping(struct udevice *dev, int pingval, int *pingret)
79 79 {
80 80 const struct test_ops *ops = device_get_ops(dev);
81 81  
... ... @@ -94,7 +94,7 @@
94 94 static int dm_test_fdt(struct dm_test_state *dms)
95 95 {
96 96 const int num_drivers = 3;
97   - struct device *dev;
  97 + struct udevice *dev;
98 98 struct uclass *uc;
99 99 int ret;
100 100 int i;
... ... @@ -32,7 +32,7 @@
32 32 /* Ensure all the test devices are probed */
33 33 static int do_autoprobe(struct dm_test_state *dms)
34 34 {
35   - struct device *dev;
  35 + struct udevice *dev;
36 36 int ret;
37 37  
38 38 /* Scanning the uclass is enough to probe all the devices */
test/dm/test-uclass.c
... ... @@ -18,7 +18,7 @@
18 18  
19 19 static struct dm_test_state *dms = &global_test_state;
20 20  
21   -int test_ping(struct device *dev, int pingval, int *pingret)
  21 +int test_ping(struct udevice *dev, int pingval, int *pingret)
22 22 {
23 23 const struct test_ops *ops = device_get_ops(dev);
24 24  
25 25  
26 26  
27 27  
... ... @@ -28,24 +28,25 @@
28 28 return ops->ping(dev, pingval, pingret);
29 29 }
30 30  
31   -static int test_post_bind(struct device *dev)
  31 +static int test_post_bind(struct udevice *dev)
32 32 {
33 33 dm_testdrv_op_count[DM_TEST_OP_POST_BIND]++;
34 34  
35 35 return 0;
36 36 }
37 37  
38   -static int test_pre_unbind(struct device *dev)
  38 +static int test_pre_unbind(struct udevice *dev)
39 39 {
40 40 dm_testdrv_op_count[DM_TEST_OP_PRE_UNBIND]++;
41 41  
42 42 return 0;
43 43 }
44 44  
45   -static int test_post_probe(struct device *dev)
  45 +static int test_post_probe(struct udevice *dev)
46 46 {
47   - struct device *prev = list_entry(dev->uclass_node.prev, struct device,
48   - uclass_node);
  47 + struct udevice *prev = list_entry(dev->uclass_node.prev,
  48 + struct udevice, uclass_node);
  49 +
49 50 struct dm_test_uclass_perdev_priv *priv = dev->uclass_priv;
50 51 struct uclass *uc = dev->uclass;
51 52  
... ... @@ -68,7 +69,7 @@
68 69 return 0;
69 70 }
70 71  
71   -static int test_pre_remove(struct device *dev)
  72 +static int test_pre_remove(struct udevice *dev)
72 73 {
73 74 dm_testdrv_op_count[DM_TEST_OP_PRE_REMOVE]++;
74 75