uclass: Use uclass_foreach_dev() macro instead of open coding
PATCH 1/1 uclass: Use uclass_foreach_dev() macro instead of open coding
Use the uclass_foreach_dev() macro instead of the open coded version.
--- drivers/core/uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/core/uclass.c +1 -1
@@ -337,7 +337,7 @@ int uclass_find_device_by_ofnode(enum uclass_id id, ofnode node,if (ret)return ret; -list_for_each_entry (dev, &uc->dev_head, uclass_node) { + uclass_foreach_dev(dev, uc) {log (LOGC_DM ,LOGL_DEBUG_CONTENT ," - checking %s\n" , dev->name);if (ofnode_equal (dev_ofnode (dev), node)) {
Signature · 1 line
2.18.0
PATCH 1/1 uclass: Use uclass_foreach_dev() macro instead of open coding
Quoted 6 lines · Liviu Dudau
Use the
uclass_foreach_dev()macro instead of the open coded version.Signed-off-by Liviu Dudau <[email protected]>--- drivers/core/uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Perhaps you could also convert a few usages?
PATCH 1/1 uclass: Use uclass_foreach_dev() macro instead of open coding
Quoted 11 lines · Simon Glass
Quoted 6 lines · Liviu Dudau
Use the
uclass_foreach_dev()macro instead of the open coded version.Signed-off-by Liviu Dudau <[email protected]>--- drivers/core/uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Reviewed-by Simon Glass <[email protected]>Perhaps you could also convert a few usages?
Not sure what you mean. Are you suggesting that I should convert more of the code that uses the open coded version into uclass_foreach_dev() ?
Best regards,
Liviu
Signature · 8 lines
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯PATCH 1/1 uclass: Use uclass_foreach_dev() macro instead of open coding
Hi,
Quoted 10 lines · Liviu Dudau
Quoted 8 lines · Simon Glass
Quoted 6 lines · Liviu Dudau
Use the
uclass_foreach_dev()macro instead of the open coded version.Signed-off-by Liviu Dudau <[email protected]>--- drivers/core/uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 6 lines
Quoted 3 lines
Reviewed-by Simon Glass <[email protected]>Perhaps you could also convert a few usages?
Not sure what you mean. Are you suggesting that I should convert more of the code that uses the open coded version into
uclass_foreach_dev()?
Yes. After all, at present your macro is just dead code :-)
Regards,
Simon
PATCH 1/1 uclass: Use uclass_foreach_dev() macro instead of open coding
Quoted 13 lines · Simon Glass
Hi,
Quoted 10 lines · Liviu Dudau
Quoted 8 lines · Simon Glass
Quoted 6 lines · Liviu Dudau
Use the
uclass_foreach_dev()macro instead of the open coded version.Signed-off-by Liviu Dudau <[email protected]>--- drivers/core/uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Reviewed-by Simon Glass <[email protected]>Perhaps you could also convert a few usages?
Not sure what you mean. Are you suggesting that I should convert more of the code that uses the open coded version into
uclass_foreach_dev()?Yes. After all, at present your macro is just dead code :-)
I think there is some confusion here. I didn't write the macro, it is present in include/dm/uclass.h since you have introduced it in commit 6494d708bfc630ac0 ("dm: Add base driver model support"). All I have done was to notice
that in uclass.c the list_for_each_entry() line can be replaced by the macro with the same effect.
I also didn't get what you meant by "your macro is just dead code".
Best regards,
Liviu
Quoted 3 lines
Regards,
Simon
Signature · 8 lines
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯PATCH 1/1 uclass: Use uclass_foreach_dev() macro instead of open coding
Hi Livu,
Quoted 23 lines · Liviu Dudau
Quoted 13 lines · Simon Glass
Hi,
Quoted 10 lines · Liviu Dudau
Quoted 8 lines · Simon Glass
Quoted 6 lines · Liviu Dudau
Use the
uclass_foreach_dev()macro instead of the open coded version.Signed-off-by Liviu Dudau <[email protected]>--- drivers/core/uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Reviewed-by Simon Glass <[email protected]>Perhaps you could also convert a few usages?
Not sure what you mean. Are you suggesting that I should convert more of the code that uses the open coded version into
uclass_foreach_dev()?Yes. After all, at present your macro is just dead code :-)
Quoted 7 lines
I think there is some confusion here. I didn't write the macro, it is present in
include/dm/uclass.hsince you have introduced it in commit6494d708bfc630ac0("dm: Add base driver model support"). All I have done was to notice
that inuclass.cthelist_for_each_entry()line can be replaced by the macro with the same effect.I also didn't get what you meant by "your macro is just dead code".
Sorry I completely missed the purpose of your patch!
Yes I think it would be good to convert other code to use this function, if you can find some.
Regards,
Simon
PATCH v2 1/1 uclass: Use uclass_foreach_dev() macro instead of open coding
Use the uclass_foreach_dev() macro instead of the open coded version.
---
Changelog:
- v2: Find more places where the open coded version exists and replace them with the macro
drivers/core/dump.c | 2 +- drivers/core/uclass.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-)
drivers/core/dump.c +1 -1
@@ -89,7 +89,7 @@ void dm_dump_uclass(void)printf ("uclass %d: %s\n" , id, uc->uc_drv->name);if (list_empty (&uc->dev_head))continue ; -list_for_each_entry (dev, &uc->dev_head, uclass_node) { + uclass_foreach_dev(dev, uc) {dm_display_line (dev, i); i++; }
drivers/core/uclass.c +9 -9
@@ -180,7 +180,7 @@ int dev_get_uclass_index(struct udevice *dev, struct uclass **ucp)if (list_empty (&uc->dev_head))return -ENODEV ; -list_for_each_entry (iter, &uc->dev_head, uclass_node) { + uclass_foreach_dev(iter, uc) {if (iter == dev) {if (ucp) *ucp = uc;
@@ -205,7 +205,7 @@ int uclass_find_device(enum uclass_id id, int index, struct udevice **devp)if (list_empty (&uc->dev_head))return -ENODEV ; -list_for_each_entry (dev, &uc->dev_head, uclass_node) { + uclass_foreach_dev(dev, uc) {if (!index--) { *devp = dev;return 0 ;
@@ -259,7 +259,7 @@ int uclass_find_device_by_name(enum uclass_id id, const char *name,if (ret)return ret; -list_for_each_entry (dev, &uc->dev_head, uclass_node) { + uclass_foreach_dev(dev, uc) {if (!strncmp (dev->name, name,strlen (name))) { *devp = dev;return 0 ;
@@ -284,7 +284,7 @@ int uclass_find_device_by_seq(enum uclass_id id, int seq_or_req_seq,if (ret)return ret; -list_for_each_entry (dev, &uc->dev_head, uclass_node) { + uclass_foreach_dev(dev, uc) {debug (" - %d %d '%s'\n" , dev->req_seq, dev->seq, dev->name);if ((find_req_seq ? dev->req_seq : dev->seq) == seq_or_req_seq) {
@@ -312,7 +312,7 @@ int uclass_find_device_by_of_offset(enum uclass_id id, int node,if (ret)return ret; -list_for_each_entry (dev, &uc->dev_head, uclass_node) { + uclass_foreach_dev(dev, uc) {if (dev_of_offset (dev) == node) { *devp = dev;return 0 ;
@@ -337,7 +337,7 @@ int uclass_find_device_by_ofnode(enum uclass_id id, ofnode node,if (ret)return ret; -list_for_each_entry (dev, &uc->dev_head, uclass_node) { + uclass_foreach_dev(dev, uc) {log (LOGC_DM ,LOGL_DEBUG_CONTENT ," - checking %s\n" , dev->name);if (ofnode_equal (dev_ofnode (dev), node)) {
@@ -372,7 +372,7 @@ static int uclass_find_device_by_phandle(enum uclass_id id,if (ret)return ret; -list_for_each_entry (dev, &uc->dev_head, uclass_node) { + uclass_foreach_dev(dev, uc) {uint phandle; phandle =dev_read_phandle (dev);
@@ -399,7 +399,7 @@ int uclass_get_device_by_driver(enum uclass_id id,if (ret)return ret; -list_for_each_entry (dev, &uc->dev_head, uclass_node) { + uclass_foreach_dev(dev, uc) {if (dev->driver == find_drv)return uclass_get_device_tail (dev,0 , devp); }
@@ -499,7 +499,7 @@ int uclass_get_device_by_phandle_id(enum uclass_id id, uint phandle_id,if (ret)return ret; -list_for_each_entry (dev, &uc->dev_head, uclass_node) { + uclass_foreach_dev(dev, uc) {uint phandle; phandle =dev_read_phandle (dev);
Signature · 1 line
2.18.0
PATCH v2 1/1 uclass: Use uclass_foreach_dev() macro instead of open coding
Quoted 11 lines · Liviu Dudau
Use the
uclass_foreach_dev()macro instead of the open coded version.Signed-off-by Liviu Dudau <[email protected]>---
Changelog:
- v2: Find more places where the open coded version exists and replace them with the macrodrivers/core/dump.c | 2 +- drivers/core/uclass.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-)
I wonder how you got that email address?!
- Simon
PATCH v2 1/1 uclass: Use uclass_foreach_dev() macro instead of open coding
Quoted 9 lines · Simon Glass
Quoted 8 lines · Liviu Dudau
Use the
uclass_foreach_dev()macro instead of the open coded version.Signed-off-by Liviu Dudau <[email protected]>---
Changelog:
- v2: Find more places where the open coded version exists and replace them with the macro
Quoted 7 lines
Quoted 3 lines
drivers/core/dump.c | 2 +- drivers/core/uclass.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-)Reviewed-by Simon Glass <[email protected]>I wonder how you got that email address?!
Which one? Mine or yours?
Mine comes from the new setup that Arm has for dealing with FOSS, where the email servers don't send the standard Arm disclaimer.
Best regards,
Liviu
Quoted 2 lines
- Simon
Signature · 8 lines
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯PATCH v2 1/1 uclass: Use uclass_foreach_dev() macro instead of open coding
Hi Livu,
Quoted 14 lines · Liviu Dudau
Quoted 13 lines · Simon Glass
Quoted 11 lines · Liviu Dudau
Use the
uclass_foreach_dev()macro instead of the open coded version.Signed-off-by Liviu Dudau <[email protected]>---
Changelog:
- v2: Find more places where the open coded version exists and replace them with the macrodrivers/core/dump.c | 2 +- drivers/core/uclass.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-)
Quoted 8 lines
Quoted 3 lines
Reviewed-by Simon Glass <[email protected]>I wonder how you got that email address?!
Which one? Mine or yours?
Mine comes from the new setup that Arm has for dealing with FOSS, where the email servers don't send the standard Arm disclaimer.
Yes I mean yours. OK I see, seems useful.
Regards,
Simon
PATCH v2 1/1 uclass: Use uclass_foreach_dev() macro instead of open coding
Hi Livu,
Quoted 14 lines · Liviu Dudau
Quoted 13 lines · Simon Glass
Quoted 11 lines · Liviu Dudau
Use the
uclass_foreach_dev()macro instead of the open coded version.Signed-off-by Liviu Dudau <[email protected]>---
Changelog:
- v2: Find more places where the open coded version exists and replace them with the macrodrivers/core/dump.c | 2 +- drivers/core/uclass.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-)
Quoted 8 lines
Quoted 3 lines
Reviewed-by Simon Glass <[email protected]>I wonder how you got that email address?!
Which one? Mine or yours?
Mine comes from the new setup that Arm has for dealing with FOSS, where the email servers don't send the standard Arm disclaimer.
Yes I mean yours. OK I see, seems useful.
Regards,
Simon
Applied to u-boot-dm/next, thanks!
PATCH 1/1 uclass: Use uclass_foreach_dev() macro instead of open coding
In reply to Liviu DudauHello Liviu,
Am 17.09.2018 um 18:44 schrieb Liviu Dudau:
Quoted 6 lines
Use the
uclass_foreach_dev()macro instead of the open coded version.Signed-off-by Liviu Dudau <[email protected]>--- drivers/core/uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
bye,
Heiko
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: hs at denx.de