All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] dm: core: Update log method for uclass_find_device_by_seq
@ 2019-10-16  9:14 Kever Yang
  2019-10-21 23:47 ` Simon Glass
  0 siblings, 1 reply; 2+ messages in thread
From: Kever Yang @ 2019-10-16  9:14 UTC (permalink / raw)
  To: u-boot

Use log() insted of debug() for uclass_find_device_by_seq function,
since this print is very much and we can filter it out with log()
interface.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---

 drivers/core/uclass.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index b33296542f..ea8b16d5ac 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -301,7 +301,8 @@ int uclass_find_device_by_seq(enum uclass_id id, int seq_or_req_seq,
 	int ret;
 
 	*devp = NULL;
-	debug("%s: %d %d\n", __func__, find_req_seq, seq_or_req_seq);
+	log(LOGC_DM, LOGL_DEBUG, "%s: %d %d\n",
+	    __func__, find_req_seq, seq_or_req_seq);
 	if (seq_or_req_seq == -1)
 		return -ENODEV;
 	ret = uclass_get(id, &uc);
@@ -309,15 +310,16 @@ int uclass_find_device_by_seq(enum uclass_id id, int seq_or_req_seq,
 		return ret;
 
 	uclass_foreach_dev(dev, uc) {
-		debug("   - %d %d '%s'\n", dev->req_seq, dev->seq, dev->name);
+		log(LOGC_DM, LOGL_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) {
 			*devp = dev;
-			debug("   - found\n");
+			log(LOGC_DM, LOGL_DEBUG, "   - found\n");
 			return 0;
 		}
 	}
-	debug("   - not found\n");
+	log(LOGC_DM, LOGL_DEBUG, "   - not found\n");
 
 	return -ENODEV;
 }
-- 
2.17.1

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

* [U-Boot] [PATCH] dm: core: Update log method for uclass_find_device_by_seq
  2019-10-16  9:14 [U-Boot] [PATCH] dm: core: Update log method for uclass_find_device_by_seq Kever Yang
@ 2019-10-21 23:47 ` Simon Glass
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Glass @ 2019-10-21 23:47 UTC (permalink / raw)
  To: u-boot

Hi Kever,

On Wed, 16 Oct 2019 at 03:14, Kever Yang <kever.yang@rock-chips.com> wrote:
>
> Use log() insted of debug() for uclass_find_device_by_seq function,
> since this print is very much and we can filter it out with log()
> interface.
>
> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
> ---
>
>  drivers/core/uclass.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
> index b33296542f..ea8b16d5ac 100644
> --- a/drivers/core/uclass.c
> +++ b/drivers/core/uclass.c
> @@ -301,7 +301,8 @@ int uclass_find_device_by_seq(enum uclass_id id, int seq_or_req_seq,
>         int ret;
>
>         *devp = NULL;
> -       debug("%s: %d %d\n", __func__, find_req_seq, seq_or_req_seq);
> +       log(LOGC_DM, LOGL_DEBUG, "%s: %d %d\n",
> +           __func__, find_req_seq, seq_or_req_seq);

Note that you should not use __func__ with logs. It handles collecting
that automatically.

One option is to put this at the top of the file:

#define LOG_CATEGORY LOGC_DM

then you can use

log_debug("...", ...)

which is shorter.

>         if (seq_or_req_seq == -1)
>                 return -ENODEV;
>         ret = uclass_get(id, &uc);
> @@ -309,15 +310,16 @@ int uclass_find_device_by_seq(enum uclass_id id, int seq_or_req_seq,
>                 return ret;
>
>         uclass_foreach_dev(dev, uc) {
> -               debug("   - %d %d '%s'\n", dev->req_seq, dev->seq, dev->name);
> +               log(LOGC_DM, LOGL_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) {
>                         *devp = dev;
> -                       debug("   - found\n");
> +                       log(LOGC_DM, LOGL_DEBUG, "   - found\n");
>                         return 0;
>                 }
>         }
> -       debug("   - not found\n");
> +       log(LOGC_DM, LOGL_DEBUG, "   - not found\n");
>
>         return -ENODEV;
>  }
> --
> 2.17.1
>

Regards,
Simon

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

end of thread, other threads:[~2019-10-21 23:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-16  9:14 [U-Boot] [PATCH] dm: core: Update log method for uclass_find_device_by_seq Kever Yang
2019-10-21 23:47 ` Simon Glass

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.