Skip to contentSkip to conversation

dm: core: Update log method for uclass_find_device_by_seq

PATCH Superseded Kever Yang 2 participants 2 messages Oct 16, 2019 – Oct 21, 2019

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Kever Yang

author
#0 lore raw

PATCH 1/1 dm: core: Update log method for uclass_find_device_by_seq

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.

---

 drivers/core/uclass.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/core/uclass.c +6 -4
index b33296542f..ea8b16d5ac 100644
@@ -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;
 }
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 dm: core: Update log method for uclass_find_device_by_seq

Hi Kever,

Quoted 16 lines · Kever Yang

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.

---

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

drivers/core/uclass.c int uclass_find_device_by_seq(enum uclass_id id, int seq_or_req_seq, · line 305

Quoted 6 lines
drivers/core/uclass.c +2 -1
@@ -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.

Quoted 24 lines
drivers/core/uclass.c +4 -4
        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;
 }
--
Quoted 2 lines

2.17.1

Regards,
Simon