From patchwork Wed Jan 18 11:58:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 45231 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2313867wrn; Wed, 18 Jan 2023 04:41:55 -0800 (PST) X-Google-Smtp-Source: AMrXdXvWaIt6mTPyqIq8TGQbsLblMrO1nj5y5JY4etdzr6SsLRo1CUIh88OTPaEEaBW1izpOgAOj X-Received: by 2002:a05:6402:4025:b0:49b:67c3:39ae with SMTP id d37-20020a056402402500b0049b67c339aemr7663150eda.33.1674045715323; Wed, 18 Jan 2023 04:41:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674045715; cv=none; d=google.com; s=arc-20160816; b=XkefxoKDLJBzBrs1Fi4ShrNlP5un76VajC+/s0SSuKZFx0jDozckXiwNgigfS8BU4g hKOHD4YSKleWfYFFzMu5xsqKTCeNToPMYWox1hbSlqxKwj9AQcDN3XRJmUNZI3VKtw6O x6DkAjboMANabXcVO5Snluhi58+re6uRDlhx+PBQZzlMmFjrfJuayOjDV87bB9sxalnm zspLvZpeWqL5g6nwAvogaL1KcJB9xxg/22610hKs+JiCIZBgKDKfPMFHmnQTDf323CWL eUnO3a7K0oPjTmX6DTLleYhIalfx3ToosNPJ1DlJHWkhmriZV4JjxIwOlj+8qfE1aecF 8fkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+a9auXGgkAw8hQCrfhfIH0SE8csp6gsFof3V3n1AZgI=; b=lzG3INMc6rVApp8+te0Whcac6MJhoCbSjPSDLSzwEkYKcz0je1tq3uwDZ47hCwVjvu lPMZf5JolBGX20fXf9wjykSelb5u4IRN+mTbRunjvHjSPF4LirSuUApBwpzshOhQsO1B 64kecS/uL934NyBYKUMoyERGbM8nVavwdCPLBwAuKFgcvpUBsGJCVqg3JS1PCnqGh0hC 9Ej5+ZedAxJi9WnvnMNRbRxJb48lemvFVFEIkeMBXgXSVPeQu88H4J7M/6OJ0QLdu+9a zuLNVFSn7bPaQVfl8Vzht64x2OWpUwR7nKNNuRv27hQCwsFR4f0Mj/6Z/KjaBz/AZf0w 9jOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=DIKCMGmT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t10-20020aa7d70a000000b00499b335829bsi11306139edq.447.2023.01.18.04.41.29; Wed, 18 Jan 2023 04:41:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=DIKCMGmT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229511AbjARMfl (ORCPT + 99 others); Wed, 18 Jan 2023 07:35:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230503AbjARMfA (ORCPT ); Wed, 18 Jan 2023 07:35:00 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCD6836FC1; Wed, 18 Jan 2023 03:58:36 -0800 (PST) Received: from umang.jainideasonboard.com (unknown [103.86.18.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 51AF21643; Wed, 18 Jan 2023 12:58:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1674043115; bh=54fyp56C8zG+m4xs/lXWL4IFVTrJQGYK0w0NLdazNA0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DIKCMGmT0gK+neJMDeYe3e+bJPBEPsNophIC7vZTWTBTDC9aXoIE9o9WIj4yq3vjM KYI9EyYV1uSmnfDoqyMdTAjD/Th/1NCuxKbdh8hPKniBiLIVR53q4Nuf+Qeyi/Hd8L P94O+pBocuMLGzdriH8BfUyQWJXQWhaw+XvU0ueE= From: Umang Jain To: linux-staging@lists.linux.dev, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Stefan Wahren , Greg Kroah-Hartman , Florian Fainelli , Adrien Thierry , Dan Carpenter , Dave Stevenson , Kieran Bingham , Laurent Pinchart , Umang Jain Subject: [RFC PATCH 4/4] staging: vc04_services: Drop remnants of custom logging Date: Wed, 18 Jan 2023 17:28:10 +0530 Message-Id: <20230118115810.21979-5-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230118115810.21979-1-umang.jain@ideasonboard.com> References: <20230118115810.21979-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755364160012030332?= X-GMAIL-MSGID: =?utf-8?q?1755364160012030332?= Drop remnants of custom logging such as header definitions and such. Also migrate the vchiq_debugfs to use the log levels coming from include/linux/kern_levels.h instead. Signed-off-by: Umang Jain --- .../interface/vchiq_arm/vchiq_arm.c | 4 -- .../interface/vchiq_arm/vchiq_core.c | 39 +++++++------------ .../interface/vchiq_arm/vchiq_core.h | 39 ------------------- .../interface/vchiq_arm/vchiq_debugfs.c | 26 ++++++++----- 4 files changed, 31 insertions(+), 77 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 ed3773b996a3..45e28ca368ee 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -60,10 +60,6 @@ #define KEEPALIVE_VER 1 #define KEEPALIVE_VER_MIN KEEPALIVE_VER -/* Run time control of log level, based on KERN_XXX level. */ -int vchiq_arm_log_level = VCHIQ_LOG_DEFAULT; -int vchiq_susp_log_level = VCHIQ_LOG_ERROR; - DEFINE_SPINLOCK(msg_queue_spinlock); struct vchiq_state g_state; 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 7b3c57326d28..4cf710a3ca28 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -103,10 +104,8 @@ static_assert((unsigned int)VCHIQ_PORT_MAX < #define BULK_INDEX(x) ((x) & (VCHIQ_NUM_SERVICE_BULKS - 1)) -#define SRVTRACE_LEVEL(srv) \ - (((srv) && (srv)->trace) ? VCHIQ_LOG_TRACE : vchiq_core_msg_log_level) #define SRVTRACE_ENABLED(srv, lev) \ - (((srv) && (srv)->trace) || (vchiq_core_msg_log_level >= (lev))) + (((srv) && (srv)->trace) || (LOGLEVEL_DEFAULT >= (lev))) #define NO_CLOSE_RECVD 0 #define CLOSE_RECVD 1 @@ -154,11 +153,6 @@ static inline void check_sizes(void) BUILD_BUG_ON_NOT_POWER_OF_2(VCHIQ_MAX_SERVICES); } -/* Run time control of log level, based on KERN_XXX level. */ -int vchiq_core_log_level = VCHIQ_LOG_DEFAULT; -int vchiq_core_msg_log_level = VCHIQ_LOG_DEFAULT; -int vchiq_sync_log_level = VCHIQ_LOG_DEFAULT; - DEFINE_SPINLOCK(bulk_waiter_spinlock); static DEFINE_SPINLOCK(quota_spinlock); @@ -1035,8 +1029,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service, return -EINVAL; } - if (SRVTRACE_ENABLED(service, - VCHIQ_LOG_INFO)) + if (SRVTRACE_ENABLED(service, LOGLEVEL_INFO)) vchiq_log_dump_mem("Sent", 0, header->data, min_t(size_t, 16, callback_result)); @@ -1144,6 +1137,7 @@ queue_message_sync(struct vchiq_state *state, struct vchiq_service *service, struct vchiq_shared_state *local; struct vchiq_header *header; ssize_t callback_result; + int svc_fourcc; local = state->local; @@ -1184,8 +1178,7 @@ queue_message_sync(struct vchiq_state *state, struct vchiq_service *service, } if (service) { - if (SRVTRACE_ENABLED(service, - VCHIQ_LOG_INFO)) + if (SRVTRACE_ENABLED(service, LOGLEVEL_INFO)) vchiq_log_dump_mem("Sent", 0, header->data, min_t(size_t, 16, callback_result)); @@ -1199,19 +1192,15 @@ queue_message_sync(struct vchiq_state *state, struct vchiq_service *service, header->size = size; header->msgid = msgid; - if (vchiq_sync_log_level >= VCHIQ_LOG_TRACE) { - int svc_fourcc; - svc_fourcc = service - ? service->base.fourcc - : VCHIQ_MAKE_FOURCC('?', '?', '?', '?'); + svc_fourcc = service ? service->base.fourcc + : VCHIQ_MAKE_FOURCC('?', '?', '?', '?'); - dev_dbg(state->dev, - "Sent Sync Msg %s(%u) to %c%c%c%c s:%u d:%d len:%d", - msg_type_str(VCHIQ_MSG_TYPE(msgid)), VCHIQ_MSG_TYPE(msgid), - VCHIQ_FOURCC_AS_4CHARS(svc_fourcc), VCHIQ_MSG_SRCPORT(msgid), - VCHIQ_MSG_DSTPORT(msgid), size); - } + dev_dbg(state->dev, + "Sent Sync Msg %s(%u) to %c%c%c%c s:%u d:%d len:%d", + msg_type_str(VCHIQ_MSG_TYPE(msgid)), VCHIQ_MSG_TYPE(msgid), + VCHIQ_FOURCC_AS_4CHARS(svc_fourcc), VCHIQ_MSG_SRCPORT(msgid), + VCHIQ_MSG_DSTPORT(msgid), size); remote_event_signal(&state->remote->sync_trigger); @@ -1624,7 +1613,7 @@ parse_message(struct vchiq_state *state, struct vchiq_header *header) break; } - if (SRVTRACE_ENABLED(service, VCHIQ_LOG_INFO)) { + if (SRVTRACE_ENABLED(service, LOGLEVEL_INFO)) { int svc_fourcc; svc_fourcc = service @@ -2031,7 +2020,7 @@ sync_func(void *v) continue; } - if (vchiq_sync_log_level >= VCHIQ_LOG_TRACE) { + if (vchiq_sync_log_level >= LOGLEVEL_DEBUG) { int svc_fourcc; svc_fourcc = service 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 ec3505424718..960bf4efeab5 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h @@ -30,39 +30,6 @@ #define VCHIQ_SLOT_SIZE 4096 #define VCHIQ_MAX_MSG_SIZE (VCHIQ_SLOT_SIZE - sizeof(struct vchiq_header)) -/* Run time control of log level, based on KERN_XXX level. */ -#define VCHIQ_LOG_DEFAULT 4 -#define VCHIQ_LOG_ERROR 3 -#define VCHIQ_LOG_WARNING 4 -#define VCHIQ_LOG_INFO 6 -#define VCHIQ_LOG_TRACE 7 - -#define VCHIQ_LOG_PREFIX KERN_INFO "vchiq: " - -#ifndef vchiq_log_error -#define vchiq_log_error(cat, fmt, ...) \ - do { if (cat >= VCHIQ_LOG_ERROR) \ - printk(VCHIQ_LOG_PREFIX fmt "\n", ##__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) -#endif -#ifndef vchiq_log_info -#define vchiq_log_info(cat, fmt, ...) \ - do { if (cat >= VCHIQ_LOG_INFO) \ - printk(VCHIQ_LOG_PREFIX fmt "\n", ##__VA_ARGS__); } while (0) -#endif -#ifndef vchiq_log_trace -#define vchiq_log_trace(cat, fmt, ...) \ - do { if (cat >= VCHIQ_LOG_TRACE) \ - printk(VCHIQ_LOG_PREFIX fmt "\n", ##__VA_ARGS__); } while (0) -#endif - -#define vchiq_loud_error(...) \ - vchiq_log_error(vchiq_core_log_level, "===== " __VA_ARGS__) - #define VCHIQ_SLOT_MASK (VCHIQ_SLOT_SIZE - 1) #define VCHIQ_SLOT_QUEUE_MASK (VCHIQ_MAX_SLOTS_PER_SIDE - 1) #define VCHIQ_SLOT_ZERO_SLOTS DIV_ROUND_UP(sizeof(struct vchiq_slot_zero), \ @@ -496,12 +463,6 @@ vchiq_dump_state(void *dump_context, struct vchiq_state *state); extern int vchiq_dump_service_state(void *dump_context, struct vchiq_service *service); -extern void -vchiq_loud_error_header(void); - -extern void -vchiq_loud_error_footer(void); - extern void request_poll(struct vchiq_state *state, struct vchiq_service *service, int poll_type); diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c index dc667afd1f8c..1d142752351d 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c @@ -5,6 +5,8 @@ */ #include +#include + #include "vchiq_core.h" #include "vchiq_arm.h" #include "vchiq_debugfs.h" @@ -22,6 +24,12 @@ static struct dentry *vchiq_dbg_dir; static struct dentry *vchiq_dbg_clients; +int vchiq_arm_log_level = LOGLEVEL_DEFAULT; +int vchiq_susp_log_level = LOGLEVEL_ERR; +int vchiq_core_log_level = LOGLEVEL_DEFAULT; +int vchiq_core_msg_log_level = LOGLEVEL_DEFAULT; +int vchiq_sync_log_level = LOGLEVEL_DEFAULT; + /* Log category debugfs entries */ struct vchiq_debugfs_log_entry { const char *name; @@ -42,16 +50,16 @@ static int debugfs_log_show(struct seq_file *f, void *offset) char *log_value = NULL; switch (*levp) { - case VCHIQ_LOG_ERROR: + case LOGLEVEL_ERR: log_value = VCHIQ_LOG_ERROR_STR; break; - case VCHIQ_LOG_WARNING: + case LOGLEVEL_WARNING: log_value = VCHIQ_LOG_WARNING_STR; break; - case VCHIQ_LOG_INFO: + case LOGLEVEL_INFO: log_value = VCHIQ_LOG_INFO_STR; break; - case VCHIQ_LOG_TRACE: + case LOGLEVEL_DEBUG: log_value = VCHIQ_LOG_TRACE_STR; break; default: @@ -85,15 +93,15 @@ static ssize_t debugfs_log_write(struct file *file, kbuf[count - 1] = 0; if (strncmp("error", kbuf, strlen("error")) == 0) - *levp = VCHIQ_LOG_ERROR; + *levp = LOGLEVEL_ERR; else if (strncmp("warning", kbuf, strlen("warning")) == 0) - *levp = VCHIQ_LOG_WARNING; + *levp = LOGLEVEL_WARNING; else if (strncmp("info", kbuf, strlen("info")) == 0) - *levp = VCHIQ_LOG_INFO; + *levp = LOGLEVEL_INFO; else if (strncmp("trace", kbuf, strlen("trace")) == 0) - *levp = VCHIQ_LOG_TRACE; + *levp = LOGLEVEL_DEBUG; else - *levp = VCHIQ_LOG_DEFAULT; + *levp = LOGLEVEL_DEFAULT; *ppos += count;