From 1d8bbd76f097a2be4021668ce379f9c88a5d38fc Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 12 Jan 2022 19:26:20 -0700 Subject: [PATCH] bloblist: Use LOG_CATEGORY to simply logging Use the convenience functions to improve readability. Signed-off-by: Simon Glass --- common/bloblist.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/common/bloblist.c b/common/bloblist.c index baf1d371b7..b5fea12b69 100644 --- a/common/bloblist.c +++ b/common/bloblist.c @@ -4,6 +4,8 @@ * Written by Simon Glass */ +#define LOG_CATEGORY LOGC_BLOBLIST + #include #include #include @@ -133,9 +135,8 @@ static int bloblist_addrec(uint tag, int size, int align, new_alloced = data_start + ALIGN(size, align); if (new_alloced > hdr->size) { - log(LOGC_BLOBLIST, LOGL_ERR, - "Failed to allocate %x bytes size=%x, need size=%x\n", - size, hdr->size, new_alloced); + log_err("Failed to allocate %x bytes size=%x, need size=%x\n", + size, hdr->size, new_alloced); return log_msg_ret("bloblist add", -ENOSPC); } rec = (void *)hdr + hdr->alloced; @@ -249,14 +250,13 @@ static int bloblist_resize_rec(struct bloblist_hdr *hdr, expand_by = ALIGN(new_size - rec->size, BLOBLIST_ALIGN); new_alloced = ALIGN(hdr->alloced + expand_by, BLOBLIST_ALIGN); if (new_size < 0) { - log(LOGC_BLOBLIST, LOGL_DEBUG, - "Attempt to shrink blob size below 0 (%x)\n", new_size); + log_debug("Attempt to shrink blob size below 0 (%x)\n", + new_size); return log_msg_ret("size", -EINVAL); } if (new_alloced > hdr->size) { - log(LOGC_BLOBLIST, LOGL_ERR, - "Failed to allocate %x bytes size=%x, need size=%x\n", - new_size, hdr->size, new_alloced); + log_err("Failed to allocate %x bytes size=%x, need size=%x\n", + new_size, hdr->size, new_alloced); return log_msg_ret("alloc", -ENOSPC); } @@ -347,8 +347,7 @@ int bloblist_check(ulong addr, uint size) return log_msg_ret("Bad size", -EFBIG); chksum = bloblist_calc_chksum(hdr); if (hdr->chksum != chksum) { - log(LOGC_BLOBLIST, LOGL_ERR, "Checksum %x != %x\n", hdr->chksum, - chksum); + log_err("Checksum %x != %x\n", hdr->chksum, chksum); return log_msg_ret("Bad checksum", -EIO); } gd->bloblist = hdr; @@ -446,7 +445,7 @@ int bloblist_init(void) } ret = bloblist_new(addr, CONFIG_BLOBLIST_SIZE, 0); } else { - log(LOGC_BLOBLIST, LOGL_DEBUG, "Found existing bloblist\n"); + log_debug("Found existing bloblist\n"); } return ret; -- 2.39.5