[04/29] net/sfc/base: improve code style in sensors decoding

Message ID 1560152324-20538-5-git-send-email-arybchenko@solarflare.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series net/sfc/base: update base driver |

Checks

Context Check Description
ci/Intel-compilation fail Compilation issues
ci/checkpatch warning coding style issues

Commit Message

Andrew Rybchenko June 10, 2019, 7:38 a.m. UTC
  From: Mark Spender <mspender@solarflare.com>

Add more comments to simplify code reading and understanding.

Signed-off-by: Mark Spender <mspender@solarflare.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/base/mcdi_mon.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)
  

Patch

diff --git a/drivers/net/sfc/base/mcdi_mon.c b/drivers/net/sfc/base/mcdi_mon.c
index d0247dc..824d9ca 100644
--- a/drivers/net/sfc/base/mcdi_mon.c
+++ b/drivers/net/sfc/base/mcdi_mon.c
@@ -63,34 +63,34 @@ 
 	for (sensor = 0; sensor < sensor_max; ++sensor) {
 		efx_mon_stat_t id;
 		efx_mon_stat_portmask_t stat_portmask = 0;
-		boolean_t decode_ok;
 		efx_mon_stat_unit_t stat_unit;
 
 		if ((sensor % (MC_CMD_SENSOR_PAGE0_NEXT + 1)) ==
 		    MC_CMD_SENSOR_PAGE0_NEXT) {
+			/* This sensor is one of the page boundary bits. */
 			page++;
 			continue;
-			/* This sensor is one of the page boundary bits. */
 		}
 
 		if (~(sensor_mask[page]) &
-		    (1U << (sensor % (sizeof (sensor_mask[page]) * 8))))
+		    (1U << (sensor % (sizeof (sensor_mask[page]) * 8)))) {
+			/* This sensor is not supported. */
 			continue;
-		/* This sensor not in DMA buffer */
+		}
 
+		/* Supported sensor, so it is present in the DMA buffer. */
 		idx++;
-		/*
-		 * Valid stat in DMA buffer that we need to increment over, even
-		 * if we couldn't look up the id
-		 */
 
-		decode_ok = efx_mon_mcdi_to_efx_stat(sensor, &id);
-		decode_ok =
-		    decode_ok && efx_mon_get_stat_portmap(id, &stat_portmask);
+		if ((efx_mon_mcdi_to_efx_stat(sensor, &id) != B_TRUE) ||
+		    (efx_mon_get_stat_portmap(id, &stat_portmask) != B_TRUE)){
+			/* The sensor is not known to the driver. */
+			continue;
+		}
 
-		if (!(decode_ok && (stat_portmask & port_mask)))
+		if ((stat_portmask & port_mask) == 0) {
+			/* The sensor is not for this port. */
 			continue;
-		/* Either bad decode, or don't know what port stat is on */
+		}
 
 		EFSYS_ASSERT(id < EFX_MON_NSTATS);