All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] uclass: Use uclass_foreach_dev() macro instead of open coding
@ 2018-09-17 16:44 Liviu Dudau
  2018-09-18  2:06 ` Simon Glass
  2018-09-18  4:14 ` [U-Boot] [PATCH] " Heiko Schocher
  0 siblings, 2 replies; 12+ messages in thread
From: Liviu Dudau @ 2018-09-17 16:44 UTC (permalink / raw)
  To: u-boot

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(-)

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)) {
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH] uclass: Use uclass_foreach_dev() macro instead of open coding
  2018-09-17 16:44 [U-Boot] [PATCH] uclass: Use uclass_foreach_dev() macro instead of open coding Liviu Dudau
@ 2018-09-18  2:06 ` Simon Glass
  2018-09-18  8:08   ` Liviu Dudau
  2018-09-18  4:14 ` [U-Boot] [PATCH] " Heiko Schocher
  1 sibling, 1 reply; 12+ messages in thread
From: Simon Glass @ 2018-09-18  2:06 UTC (permalink / raw)
  To: u-boot

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?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH] uclass: Use uclass_foreach_dev() macro instead of open coding
  2018-09-17 16:44 [U-Boot] [PATCH] uclass: Use uclass_foreach_dev() macro instead of open coding Liviu Dudau
  2018-09-18  2:06 ` Simon Glass
@ 2018-09-18  4:14 ` Heiko Schocher
  1 sibling, 0 replies; 12+ messages in thread
From: Heiko Schocher @ 2018-09-18  4:14 UTC (permalink / raw)
  To: u-boot

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
-- 
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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH] uclass: Use uclass_foreach_dev() macro instead of open coding
  2018-09-18  2:06 ` Simon Glass
@ 2018-09-18  8:08   ` Liviu Dudau
  2018-09-19 15:30     ` Simon Glass
  0 siblings, 1 reply; 12+ messages in thread
From: Liviu Dudau @ 2018-09-18  8:08 UTC (permalink / raw)
  To: u-boot

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


-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH] uclass: Use uclass_foreach_dev() macro instead of open coding
  2018-09-18  8:08   ` Liviu Dudau
@ 2018-09-19 15:30     ` Simon Glass
  2018-09-19 16:37       ` Liviu Dudau
  0 siblings, 1 reply; 12+ messages in thread
From: Simon Glass @ 2018-09-19 15:30 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH] uclass: Use uclass_foreach_dev() macro instead of open coding
  2018-09-19 15:30     ` Simon Glass
@ 2018-09-19 16:37       ` Liviu Dudau
  2018-09-26  5:41         ` Simon Glass
  0 siblings, 1 reply; 12+ messages in thread
From: Liviu Dudau @ 2018-09-19 16:37 UTC (permalink / raw)
  To: u-boot

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

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH] uclass: Use uclass_foreach_dev() macro instead of open coding
  2018-09-19 16:37       ` Liviu Dudau
@ 2018-09-26  5:41         ` Simon Glass
  2018-09-28 13:12           ` [U-Boot] [PATCH v2] " Liviu Dudau
  0 siblings, 1 reply; 12+ messages in thread
From: Simon Glass @ 2018-09-26  5:41 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v2] uclass: Use uclass_foreach_dev() macro instead of open coding
  2018-09-26  5:41         ` Simon Glass
@ 2018-09-28 13:12           ` Liviu Dudau
  2018-09-28 15:57             ` Simon Glass
  0 siblings, 1 reply; 12+ messages in thread
From: Liviu Dudau @ 2018-09-28 13:12 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Liviu Dudau <liviu.dudau@foss.arm.com>
---
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(-)

diff --git a/drivers/core/dump.c b/drivers/core/dump.c
index d7cdb1475d..9068084404 100644
--- a/drivers/core/dump.c
+++ b/drivers/core/dump.c
@@ -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++;
 		}
diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index 3113d6a56b..d90bdde54e 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -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);
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v2] uclass: Use uclass_foreach_dev() macro instead of open coding
  2018-09-28 13:12           ` [U-Boot] [PATCH v2] " Liviu Dudau
@ 2018-09-28 15:57             ` Simon Glass
  2018-09-28 16:02               ` Liviu Dudau
  0 siblings, 1 reply; 12+ messages in thread
From: Simon Glass @ 2018-09-28 15:57 UTC (permalink / raw)
  To: u-boot

On 28 September 2018 at 06:12, 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>
> ---
> 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(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

I wonder how you got that email address?!

- Simon

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v2] uclass: Use uclass_foreach_dev() macro instead of open coding
  2018-09-28 15:57             ` Simon Glass
@ 2018-09-28 16:02               ` Liviu Dudau
  2018-09-28 16:06                 ` Simon Glass
  2018-10-24 17:32                 ` sjg at google.com
  0 siblings, 2 replies; 12+ messages in thread
From: Liviu Dudau @ 2018-09-28 16:02 UTC (permalink / raw)
  To: u-boot

On Fri, Sep 28, 2018 at 09:57:49AM -0600, Simon Glass wrote:
> On 28 September 2018 at 06:12, 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>
> > ---
> > 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(-)
> 
> Reviewed-by: Simon Glass <sjg@chromium.org>
> 
> 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

> 
> - Simon

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v2] uclass: Use uclass_foreach_dev() macro instead of open coding
  2018-09-28 16:02               ` Liviu Dudau
@ 2018-09-28 16:06                 ` Simon Glass
  2018-10-24 17:32                 ` sjg at google.com
  1 sibling, 0 replies; 12+ messages in thread
From: Simon Glass @ 2018-09-28 16:06 UTC (permalink / raw)
  To: u-boot

Hi Livu,

On 28 September 2018 at 10:02, Liviu Dudau <Liviu.Dudau@foss.arm.com> wrote:
> On Fri, Sep 28, 2018 at 09:57:49AM -0600, Simon Glass wrote:
>> On 28 September 2018 at 06:12, 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>
>> > ---
>> > 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(-)
>>
>> Reviewed-by: Simon Glass <sjg@chromium.org>
>>
>> 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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v2] uclass: Use uclass_foreach_dev() macro instead of open coding
  2018-09-28 16:02               ` Liviu Dudau
  2018-09-28 16:06                 ` Simon Glass
@ 2018-10-24 17:32                 ` sjg at google.com
  1 sibling, 0 replies; 12+ messages in thread
From: sjg at google.com @ 2018-10-24 17:32 UTC (permalink / raw)
  To: u-boot

Hi Livu,

On 28 September 2018 at 10:02, Liviu Dudau <Liviu.Dudau@foss.arm.com> wrote:
> On Fri, Sep 28, 2018 at 09:57:49AM -0600, Simon Glass wrote:
>> On 28 September 2018 at 06:12, 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>
>> > ---
>> > 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(-)
>>
>> Reviewed-by: Simon Glass <sjg@chromium.org>
>>
>> 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!

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-10-24 17:32 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-17 16:44 [U-Boot] [PATCH] uclass: Use uclass_foreach_dev() macro instead of open coding Liviu Dudau
2018-09-18  2:06 ` Simon Glass
2018-09-18  8:08   ` Liviu Dudau
2018-09-19 15:30     ` Simon Glass
2018-09-19 16:37       ` Liviu Dudau
2018-09-26  5:41         ` Simon Glass
2018-09-28 13:12           ` [U-Boot] [PATCH v2] " Liviu Dudau
2018-09-28 15:57             ` Simon Glass
2018-09-28 16:02               ` Liviu Dudau
2018-09-28 16:06                 ` Simon Glass
2018-10-24 17:32                 ` sjg at google.com
2018-09-18  4:14 ` [U-Boot] [PATCH] " Heiko Schocher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.