public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Kieran Bingham <kieran.bingham@ideasonboard.com>
To: Umang Jain <umang.jain@ideasonboard.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-media@vger.kernel.org,
	linux-rpi-kernel@lists.infradead.org,
	linux-staging@lists.linux.dev
Cc: Stefan Wahren <stefan.wahren@i2se.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Dave Stevenson <dave.stevenson@raspberrypi.com>,
	Dan Carpenter <error27@gmail.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Umang Jain <umang.jain@ideasonboard.com>,
	Phil Elwell <phil@raspberrypi.com>
Subject: Re: [PATCH v1 2/4] staging: vc04: Convert vchiq_log_warning() to use dynamic debug
Date: Thu, 19 Oct 2023 14:50:34 +0100	[thread overview]
Message-ID: <169772343491.630990.5915300826397445052@ping.linuxembedded.co.uk> (raw)
In-Reply-To: <20231019082147.384723-3-umang.jain@ideasonboard.com>

Quoting Umang Jain (2023-10-19 09:21:45)
> Move vchiq_log_warning() custom logging wrapper based on printk to use
> dynamic debug. The log category is dictated by vchiq_log_category
> which will become the part of the warning string format that will be
> logged to dynamic debug (for grep).
> 
> All the vchiq_log_warning() calls are adjusted to use the
> modified wrapper.
> 
> While at that, remove the extraneous "----" from few of the
> warning string text.
> 
> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
> ---
>  .../interface/vchiq_arm/vchiq_arm.c              | 16 +++++++++-------
>  .../interface/vchiq_arm/vchiq_core.c             |  8 ++++----
>  .../interface/vchiq_arm/vchiq_core.h             |  5 ++---
>  3 files changed, 15 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> index fa4463bfc117..cfc06ca2e228 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> @@ -695,7 +695,7 @@ int vchiq_initialise(struct vchiq_instance **instance_out)
>                 ret = -ENOTCONN;
>                 goto failed;
>         } else if (i > 0) {
> -               vchiq_log_warning(vchiq_core_log_level,
> +               vchiq_log_warning(state->dev, VCHIQ_CORE,
>                                   "%s: videocore initialized after %d retries\n", __func__, i);
>         }
>  
> @@ -1696,17 +1696,19 @@ vchiq_dump_service_use_state(struct vchiq_state *state)
>         read_unlock_bh(&arm_state->susp_res_lock);
>  
>         if (only_nonzero)
> -               vchiq_log_warning(vchiq_susp_log_level, "Too many active services (%d). Only dumping up to first %d services with non-zero use-count",
> +               vchiq_log_warning(state->dev, VCHIQ_SUSPEND,
> +                                 "Too many active services (%d). Only dumping up to first %d services with non-zero use-count",
>                                   active_services, found);
>  
>         for (i = 0; i < found; i++) {
> -               vchiq_log_warning(vchiq_susp_log_level, "----- %c%c%c%c:%d service count %d %s",
> +               vchiq_log_warning(state->dev, VCHIQ_SUSPEND,
> +                                 "%c%c%c%c:%d service count %d %s",
>                                   VCHIQ_FOURCC_AS_4CHARS(service_data[i].fourcc),

I suspect VCHIQ_FOURCC_AS_4CHARS can now be replaced by "%p4cc"

vchiq_log_warning(state->dev, VCHIQ_SUSPEND, "%p4cc:%d service count %d %s",
		  service_data[i].fourcc, service_data[i].clientid, ...

But that can be a patch on top of this I think (including the removal of
VCHIQ_FOURCC_AS_4CHARS).


Otherwise, this is following the same pattern as before and looks ok to
me. I suspect an ack from Phil Elwell on the approach here would be
welcome, as looking back at the RFC that's where the concerns were on
the categories.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>


>                                   service_data[i].clientid, service_data[i].use_count,
>                                   service_data[i].use_count ? nz : "");
>         }
> -       vchiq_log_warning(vchiq_susp_log_level, "----- VCHIQ use count %d", peer_count);
> -       vchiq_log_warning(vchiq_susp_log_level, "--- Overall vchiq instance use count %d",
> +       vchiq_log_warning(state->dev, VCHIQ_SUSPEND, "VCHIQ use count %d", peer_count);
> +       vchiq_log_warning(state->dev, VCHIQ_SUSPEND, "Overall vchiq instance use count %d",
>                           vc_use_count);
>  
>         kfree(service_data);
> @@ -1822,7 +1824,7 @@ static int vchiq_probe(struct platform_device *pdev)
>          */
>         err = vchiq_register_chrdev(&pdev->dev);
>         if (err) {
> -               vchiq_log_warning(vchiq_arm_log_level,
> +               vchiq_log_warning(&pdev->dev, VCHIQ_ARM,
>                                   "Failed to initialize vchiq cdev");
>                 goto error_exit;
>         }
> @@ -1833,7 +1835,7 @@ static int vchiq_probe(struct platform_device *pdev)
>         return 0;
>  
>  failed_platform_init:
> -       vchiq_log_warning(vchiq_arm_log_level, "could not initialize vchiq platform");
> +       vchiq_log_warning(&pdev->dev, VCHIQ_ARM, "could not initialize vchiq platform");
>  error_exit:
>         return err;
>  }
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
> index f6032c6022cb..43e292512491 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
> @@ -475,7 +475,7 @@ make_service_callback(struct vchiq_service *service, enum vchiq_reason reason,
>         status = service->base.callback(service->instance, reason, header, service->handle,
>                                         bulk_userdata);
>         if (status && (status != -EAGAIN)) {
> -               vchiq_log_warning(vchiq_core_log_level,
> +               vchiq_log_warning(service->state->dev, VCHIQ_CORE,
>                                   "%d: ignoring ERROR from callback to service %x",
>                                   service->state->id, service->handle);
>                 status = 0;
> @@ -1622,7 +1622,7 @@ parse_message(struct vchiq_state *state, struct vchiq_header *header)
>                                 vchiq_service_put(service);
>                         service = get_connected_service(state, remoteport);
>                         if (service)
> -                               vchiq_log_warning(vchiq_core_log_level,
> +                               vchiq_log_warning(state->dev, VCHIQ_CORE,
>                                                   "%d: prs %s@%pK (%d->%d) - found connected service %d",
>                                                   state->id, msg_type_str(type), header,
>                                                   remoteport, localport, service->localport);
> @@ -2921,7 +2921,7 @@ vchiq_close_service(struct vchiq_instance *instance, unsigned int handle)
>                     (service->srvstate == VCHIQ_SRVSTATE_OPEN))
>                         break;
>  
> -               vchiq_log_warning(vchiq_core_log_level,
> +               vchiq_log_warning(service->state->dev, VCHIQ_CORE,
>                                   "%d: close_service:%d - waiting in state %s",
>                                   service->state->id, service->localport,
>                                   srvstate_names[service->srvstate]);
> @@ -2982,7 +2982,7 @@ vchiq_remove_service(struct vchiq_instance *instance, unsigned int handle)
>                     (service->srvstate == VCHIQ_SRVSTATE_OPEN))
>                         break;
>  
> -               vchiq_log_warning(vchiq_core_log_level,
> +               vchiq_log_warning(service->state->dev, VCHIQ_CORE,
>                                   "%d: remove_service:%d - waiting in state %s",
>                                   service->state->id, service->localport,
>                                   srvstate_names[service->srvstate]);
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
> index c74c3647ef60..3dbb1964839b 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
> @@ -69,9 +69,8 @@ static inline const char *log_category_str(enum vchiq_log_category c)
>                 pr_debug("%s error: " fmt, log_category_str(cat), ##__VA_ARGS__); } while (0)
>  #endif
>  #ifndef vchiq_log_warning
> -#define vchiq_log_warning(cat, fmt, ...) \
> -       do { if (cat >= VCHIQ_LOG_WARNING) \
> -                printk(VCHIQ_LOG_PREFIX fmt "\n", ##__VA_ARGS__); } while (0)
> +#define vchiq_log_warning(dev, cat, fmt, ...) \
> +       do { dev_dbg(dev, "%s warning: " fmt, log_category_str(cat), ##__VA_ARGS__); } while (0)
>  #endif
>  #ifndef vchiq_log_info
>  #define vchiq_log_info(cat, fmt, ...) \
> -- 
> 2.40.1
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-10-19 13:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-19  8:21 [PATCH v1 0/4] staging: vc04: Drop custom logging based on printk Umang Jain
2023-10-19  8:21 ` [PATCH v1 1/4] staging: vc04: Convert vchiq_log_error() to use dynamic debug Umang Jain
2023-10-19 13:32   ` Kieran Bingham
2023-10-21  9:59   ` Greg Kroah-Hartman
2023-10-19  8:21 ` [PATCH v1 2/4] staging: vc04: Convert vchiq_log_warning() " Umang Jain
2023-10-19 13:50   ` Kieran Bingham [this message]
2023-10-19  8:21 ` [PATCH v1 3/4] staging: vc04: Convert(and rename) vchiq_log_info() " Umang Jain
2023-10-19  8:21 ` [PATCH v1 4/4] staging: vc04: Convert vchiq_log_trace() " Umang Jain
2023-10-19 13:56   ` Kieran Bingham
2023-10-19 13:58 ` [PATCH v1 0/4] staging: vc04: Drop custom logging based on printk Kieran Bingham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=169772343491.630990.5915300826397445052@ping.linuxembedded.co.uk \
    --to=kieran.bingham@ideasonboard.com \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=error27@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=phil@raspberrypi.com \
    --cc=stefan.wahren@i2se.com \
    --cc=umang.jain@ideasonboard.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox