Message ID | 20180917164404.27530-1-Liviu.Dudau@foss.arm.com |
---|---|
State | Superseded |
Delegated to: | Simon Glass |
Headers | show |
Series | [U-Boot] uclass: Use uclass_foreach_dev() macro instead of open coding | expand |
On 17 September 2018 at 10:44, Liviu Dudau <Liviu.Dudau@foss.arm.com> wrote: > Use the uclass_foreach_dev() macro instead of the open coded version. > > Signed-off-by: Liviu Dudau <liviu.dudau@foss.arm.com> > --- > drivers/core/uclass.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Simon Glass <sjg@chromium.org> Perhaps you could also convert a few usages?
Hello Liviu, Am 17.09.2018 um 18:44 schrieb Liviu Dudau: > Use the uclass_foreach_dev() macro instead of the open coded version. > > Signed-off-by: Liviu Dudau <liviu.dudau@foss.arm.com> > --- > drivers/core/uclass.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Heiko Schocher <hs@denx.de> bye, Heiko
On Tue, Sep 18, 2018 at 04:06:13AM +0200, Simon Glass wrote: > On 17 September 2018 at 10:44, Liviu Dudau <Liviu.Dudau@foss.arm.com> wrote: > > Use the uclass_foreach_dev() macro instead of the open coded version. > > > > Signed-off-by: Liviu Dudau <liviu.dudau@foss.arm.com> > > --- > > drivers/core/uclass.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > Reviewed-by: Simon Glass <sjg@chromium.org> > > 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
Hi, On 18 September 2018 at 02:08, Liviu Dudau <Liviu.Dudau@foss.arm.com> wrote: > > On Tue, Sep 18, 2018 at 04:06:13AM +0200, Simon Glass wrote: > > On 17 September 2018 at 10:44, Liviu Dudau <Liviu.Dudau@foss.arm.com> wrote: > > > Use the uclass_foreach_dev() macro instead of the open coded version. > > > > > > Signed-off-by: Liviu Dudau <liviu.dudau@foss.arm.com> > > > --- > > > drivers/core/uclass.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > Reviewed-by: Simon Glass <sjg@chromium.org> > > > > 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
On Wed, Sep 19, 2018 at 09:30:37AM -0600, Simon Glass wrote: > Hi, > > On 18 September 2018 at 02:08, Liviu Dudau <Liviu.Dudau@foss.arm.com> wrote: > > > > On Tue, Sep 18, 2018 at 04:06:13AM +0200, Simon Glass wrote: > > > On 17 September 2018 at 10:44, Liviu Dudau <Liviu.Dudau@foss.arm.com> wrote: > > > > Use the uclass_foreach_dev() macro instead of the open coded version. > > > > > > > > Signed-off-by: Liviu Dudau <liviu.dudau@foss.arm.com> > > > > --- > > > > drivers/core/uclass.c | 2 +- > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > Reviewed-by: Simon Glass <sjg@chromium.org> > > > > > > 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 > > Regards, > Simon
Hi Livu, On 19 September 2018 at 10:37, Liviu Dudau <Liviu.Dudau@foss.arm.com> wrote: > On Wed, Sep 19, 2018 at 09:30:37AM -0600, Simon Glass wrote: >> Hi, >> >> On 18 September 2018 at 02:08, Liviu Dudau <Liviu.Dudau@foss.arm.com> wrote: >> > >> > On Tue, Sep 18, 2018 at 04:06:13AM +0200, Simon Glass wrote: >> > > On 17 September 2018 at 10:44, Liviu Dudau <Liviu.Dudau@foss.arm.com> wrote: >> > > > Use the uclass_foreach_dev() macro instead of the open coded version. >> > > > >> > > > Signed-off-by: Liviu Dudau <liviu.dudau@foss.arm.com> >> > > > --- >> > > > drivers/core/uclass.c | 2 +- >> > > > 1 file changed, 1 insertion(+), 1 deletion(-) >> > > >> > > Reviewed-by: Simon Glass <sjg@chromium.org> >> > > >> > > 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". 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. Reviewed-by: Simon Glass <sjg@chromium.org> Regards, Simon
diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c index 3113d6a56b..081571951d 100644 --- a/drivers/core/uclass.c +++ b/drivers/core/uclass.c @@ -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)) {
Use the uclass_foreach_dev() macro instead of the open coded version. Signed-off-by: Liviu Dudau <liviu.dudau@foss.arm.com> --- drivers/core/uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)