Commit 81f351d6e7ebb371de8ea849fc21dd07dc2eff24

Authored by Liviu Dudau
Committed by Simon Glass
1 parent 216460ec12

uclass: Use uclass_foreach_dev() macro instead of open coding

Use the uclass_foreach_dev() macro instead of the open coded version.

Signed-off-by: Liviu Dudau <liviu.dudau@foss.arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

Showing 2 changed files with 10 additions and 10 deletions Side-by-side Diff

... ... @@ -89,7 +89,7 @@
89 89 printf("uclass %d: %s\n", id, uc->uc_drv->name);
90 90 if (list_empty(&uc->dev_head))
91 91 continue;
92   - list_for_each_entry(dev, &uc->dev_head, uclass_node) {
  92 + uclass_foreach_dev(dev, uc) {
93 93 dm_display_line(dev, i);
94 94 i++;
95 95 }
drivers/core/uclass.c
... ... @@ -180,7 +180,7 @@
180 180 if (list_empty(&uc->dev_head))
181 181 return -ENODEV;
182 182  
183   - list_for_each_entry(iter, &uc->dev_head, uclass_node) {
  183 + uclass_foreach_dev(iter, uc) {
184 184 if (iter == dev) {
185 185 if (ucp)
186 186 *ucp = uc;
... ... @@ -205,7 +205,7 @@
205 205 if (list_empty(&uc->dev_head))
206 206 return -ENODEV;
207 207  
208   - list_for_each_entry(dev, &uc->dev_head, uclass_node) {
  208 + uclass_foreach_dev(dev, uc) {
209 209 if (!index--) {
210 210 *devp = dev;
211 211 return 0;
... ... @@ -259,7 +259,7 @@
259 259 if (ret)
260 260 return ret;
261 261  
262   - list_for_each_entry(dev, &uc->dev_head, uclass_node) {
  262 + uclass_foreach_dev(dev, uc) {
263 263 if (!strncmp(dev->name, name, strlen(name))) {
264 264 *devp = dev;
265 265 return 0;
... ... @@ -284,7 +284,7 @@
284 284 if (ret)
285 285 return ret;
286 286  
287   - list_for_each_entry(dev, &uc->dev_head, uclass_node) {
  287 + uclass_foreach_dev(dev, uc) {
288 288 debug(" - %d %d '%s'\n", dev->req_seq, dev->seq, dev->name);
289 289 if ((find_req_seq ? dev->req_seq : dev->seq) ==
290 290 seq_or_req_seq) {
... ... @@ -312,7 +312,7 @@
312 312 if (ret)
313 313 return ret;
314 314  
315   - list_for_each_entry(dev, &uc->dev_head, uclass_node) {
  315 + uclass_foreach_dev(dev, uc) {
316 316 if (dev_of_offset(dev) == node) {
317 317 *devp = dev;
318 318 return 0;
... ... @@ -337,7 +337,7 @@
337 337 if (ret)
338 338 return ret;
339 339  
340   - list_for_each_entry(dev, &uc->dev_head, uclass_node) {
  340 + uclass_foreach_dev(dev, uc) {
341 341 log(LOGC_DM, LOGL_DEBUG_CONTENT, " - checking %s\n",
342 342 dev->name);
343 343 if (ofnode_equal(dev_ofnode(dev), node)) {
... ... @@ -372,7 +372,7 @@
372 372 if (ret)
373 373 return ret;
374 374  
375   - list_for_each_entry(dev, &uc->dev_head, uclass_node) {
  375 + uclass_foreach_dev(dev, uc) {
376 376 uint phandle;
377 377  
378 378 phandle = dev_read_phandle(dev);
... ... @@ -399,7 +399,7 @@
399 399 if (ret)
400 400 return ret;
401 401  
402   - list_for_each_entry(dev, &uc->dev_head, uclass_node) {
  402 + uclass_foreach_dev(dev, uc) {
403 403 if (dev->driver == find_drv)
404 404 return uclass_get_device_tail(dev, 0, devp);
405 405 }
... ... @@ -499,7 +499,7 @@
499 499 if (ret)
500 500 return ret;
501 501  
502   - list_for_each_entry(dev, &uc->dev_head, uclass_node) {
  502 + uclass_foreach_dev(dev, uc) {
503 503 uint phandle;
504 504  
505 505 phandle = dev_read_phandle(dev);