All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Wahren <wahrenst@gmx.net>
To: Umang Jain <umang.jain@ideasonboard.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Florian Fainelli <florian.fainelli@broadcom.com>,
	Dan Carpenter <dan.carpenter@linaro.org>,
	Phil Elwell <phil@raspberrypi.com>,
	Dave Stevenson <dave.stevenson@raspberrypi.com>,
	Kieran Bingham <kieran.bingham@ideasonboard.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	linux-staging@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-media@vger.kernel.org, Stefan Wahren <wahrenst@gmx.net>
Subject: [PATCH V2 2/3] staging: vchiq_core: Shorten bulk TX/RX pending dump
Date: Sun, 29 Oct 2023 13:48:36 +0100	[thread overview]
Message-ID: <20231029124837.119832-3-wahrenst@gmx.net> (raw)
In-Reply-To: <20231029124837.119832-1-wahrenst@gmx.net>

The calculation for the bulk TX/RX pending is complex and
reaches 99 chars per line. So move the size determination
below the pending calculation and get the rid of the
ternary operator.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 .../interface/vchiq_arm/vchiq_core.c          | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

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 94073f92651a..36c742a2f3b2 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -3447,7 +3447,7 @@ vchiq_dump_service_state(void *dump_context, struct vchiq_service *service)
 		struct vchiq_service_quota *quota =
 			&service->state->service_quotas[service->localport];
 		int fourcc = service->base.fourcc;
-		int tx_pending, rx_pending;
+		int tx_pending, rx_pending, tx_size = 0, rx_size = 0;

 		if (service->remoteport != VCHIQ_PORT_FREE) {
 			int len2 = scnprintf(remoteport, sizeof(remoteport),
@@ -3472,18 +3472,23 @@ vchiq_dump_service_state(void *dump_context, struct vchiq_service *service)

 		tx_pending = service->bulk_tx.local_insert -
 			service->bulk_tx.remote_insert;
+		if (tx_pending) {
+			unsigned int i = BULK_INDEX(service->bulk_tx.remove);
+
+			tx_size = service->bulk_tx.bulks[i].size;
+		}

 		rx_pending = service->bulk_rx.local_insert -
 			service->bulk_rx.remote_insert;
+		if (rx_pending) {
+			unsigned int i = BULK_INDEX(service->bulk_rx.remove);
+
+			rx_size = service->bulk_rx.bulks[i].size;
+		}

 		len = scnprintf(buf, sizeof(buf),
 				"  Bulk: tx_pending=%d (size %d), rx_pending=%d (size %d)",
-				tx_pending,
-				tx_pending ?
-				service->bulk_tx.bulks[BULK_INDEX(service->bulk_tx.remove)].size :
-				0, rx_pending, rx_pending ?
-				service->bulk_rx.bulks[BULK_INDEX(service->bulk_rx.remove)].size :
-				0);
+				tx_pending, tx_size, rx_pending, rx_size);

 		if (VCHIQ_ENABLE_STATS) {
 			err = vchiq_dump(dump_context, buf, len + 1);
--
2.34.1


WARNING: multiple messages have this Message-ID (diff)
From: Stefan Wahren <wahrenst@gmx.net>
To: Umang Jain <umang.jain@ideasonboard.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Florian Fainelli <florian.fainelli@broadcom.com>,
	Dan Carpenter <dan.carpenter@linaro.org>,
	Phil Elwell <phil@raspberrypi.com>,
	Dave Stevenson <dave.stevenson@raspberrypi.com>,
	Kieran Bingham <kieran.bingham@ideasonboard.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	linux-staging@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-media@vger.kernel.org, Stefan Wahren <wahrenst@gmx.net>
Subject: [PATCH V2 2/3] staging: vchiq_core: Shorten bulk TX/RX pending dump
Date: Sun, 29 Oct 2023 13:48:36 +0100	[thread overview]
Message-ID: <20231029124837.119832-3-wahrenst@gmx.net> (raw)
In-Reply-To: <20231029124837.119832-1-wahrenst@gmx.net>

The calculation for the bulk TX/RX pending is complex and
reaches 99 chars per line. So move the size determination
below the pending calculation and get the rid of the
ternary operator.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 .../interface/vchiq_arm/vchiq_core.c          | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

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 94073f92651a..36c742a2f3b2 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -3447,7 +3447,7 @@ vchiq_dump_service_state(void *dump_context, struct vchiq_service *service)
 		struct vchiq_service_quota *quota =
 			&service->state->service_quotas[service->localport];
 		int fourcc = service->base.fourcc;
-		int tx_pending, rx_pending;
+		int tx_pending, rx_pending, tx_size = 0, rx_size = 0;

 		if (service->remoteport != VCHIQ_PORT_FREE) {
 			int len2 = scnprintf(remoteport, sizeof(remoteport),
@@ -3472,18 +3472,23 @@ vchiq_dump_service_state(void *dump_context, struct vchiq_service *service)

 		tx_pending = service->bulk_tx.local_insert -
 			service->bulk_tx.remote_insert;
+		if (tx_pending) {
+			unsigned int i = BULK_INDEX(service->bulk_tx.remove);
+
+			tx_size = service->bulk_tx.bulks[i].size;
+		}

 		rx_pending = service->bulk_rx.local_insert -
 			service->bulk_rx.remote_insert;
+		if (rx_pending) {
+			unsigned int i = BULK_INDEX(service->bulk_rx.remove);
+
+			rx_size = service->bulk_rx.bulks[i].size;
+		}

 		len = scnprintf(buf, sizeof(buf),
 				"  Bulk: tx_pending=%d (size %d), rx_pending=%d (size %d)",
-				tx_pending,
-				tx_pending ?
-				service->bulk_tx.bulks[BULK_INDEX(service->bulk_tx.remove)].size :
-				0, rx_pending, rx_pending ?
-				service->bulk_rx.bulks[BULK_INDEX(service->bulk_rx.remove)].size :
-				0);
+				tx_pending, tx_size, rx_pending, rx_size);

 		if (VCHIQ_ENABLE_STATS) {
 			err = vchiq_dump(dump_context, buf, len + 1);
--
2.34.1


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

  parent reply	other threads:[~2023-10-29 12:49 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-29 12:48 [PATCH V2 0/3] staging: vchiq_arm: move state dump to debugfs Stefan Wahren
2023-10-29 12:48 ` Stefan Wahren
2023-10-29 12:48 ` [PATCH V2 1/3] staging: vchiq_core: Make vchiq_dump_service_state static Stefan Wahren
2023-10-29 12:48   ` Stefan Wahren
2023-10-29 23:44   ` Laurent Pinchart
2023-10-29 23:44     ` Laurent Pinchart
2023-10-29 12:48 ` Stefan Wahren [this message]
2023-10-29 12:48   ` [PATCH V2 2/3] staging: vchiq_core: Shorten bulk TX/RX pending dump Stefan Wahren
2023-10-29 23:46   ` Laurent Pinchart
2023-10-29 23:46     ` Laurent Pinchart
2023-10-29 12:48 ` [PATCH V2 3/3] staging: vchiq_arm: move state dump to debugfs Stefan Wahren
2023-10-29 12:48   ` Stefan Wahren
2023-10-29 15:03   ` Ricardo B. Marliere
2023-10-29 15:03     ` Ricardo B. Marliere
2023-11-22 12:17 ` [PATCH V2 0/3] " Stefan Wahren
2023-11-22 12:17   ` Stefan Wahren
2023-11-22 12:23   ` Greg Kroah-Hartman
2023-11-22 12:23     ` Greg Kroah-Hartman

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=20231029124837.119832-3-wahrenst@gmx.net \
    --to=wahrenst@gmx.net \
    --cc=dan.carpenter@linaro.org \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=phil@raspberrypi.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 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.