Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1533838

[PATCH 08/10] via-cuda: Initialize data_index early and increment consistently

From Finn Thain <fthain@telegraphics.com.au>
Newsgroups linux.kernel
Subject [PATCH 08/10] via-cuda: Initialize data_index early and increment consistently
Date 2016-12-01 07:20 +0100
Message-ID <sJsSS-7F-15@gated-at.bofh.it> (permalink)
References <sJsJc-8rI-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Initialize data_index where appropriate to improve readability and
assist debugging. This change doesn't affect driver behaviour.

I prefer to see
	current_req->data[data_index++]
in place of
	current_req->data[0]
or
	current_req->data[1]
inasmuchas it becomes obvious what the data_index variable does.

Moreover, the actual value of data_index when examined at any given moment
tells me something about prior events, which did prove helpful.

Tested-by: Stan Johnson <userm57@yahoo.com>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
---
 drivers/macintosh/via-cuda.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/macintosh/via-cuda.c b/drivers/macintosh/via-cuda.c
index b801c67..f1b2c5b 100644
--- a/drivers/macintosh/via-cuda.c
+++ b/drivers/macintosh/via-cuda.c
@@ -446,12 +446,13 @@ cuda_start(void)
     /* assert cuda_state == idle */
     if (current_req == NULL)
 	return;
+    data_index = 0;
     if (TREQ_asserted(in_8(&via[B])))
 	return;			/* a byte is coming in from the CUDA */
 
     /* set the shift register to shift out and send a byte */
     out_8(&via[ACR], in_8(&via[ACR]) | SR_OUT);
-    out_8(&via[SR], current_req->data[0]);
+    out_8(&via[SR], current_req->data[data_index++]);
     assert_TIP();
     cuda_state = sent_first_byte;
 }
@@ -524,9 +525,8 @@ cuda_interrupt(int irq, void *arg)
 	    negate_TIP_and_TACK();
 	    cuda_state = idle;
 	} else {
-	    out_8(&via[SR], current_req->data[1]);
+	    out_8(&via[SR], current_req->data[data_index++]);
 	    toggle_TACK();
-	    data_index = 2;
 	    cuda_state = sending;
 	}
 	break;
-- 
2.7.3

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/10] Replace via-maciisi with via-cuda driver Finn Thain <fthain@telegraphics.com.au> - 2016-12-01 07:10 +0100
  [PATCH 03/10] via-cuda: Add TREQ, TIP and TACK signal helpers Finn Thain <fthain@telegraphics.com.au> - 2016-12-01 07:10 +0100
  [PATCH 04/10] via-cuda: Prevent read buffer overflow Finn Thain <fthain@telegraphics.com.au> - 2016-12-01 07:10 +0100
  [PATCH 10/10] m68k/mac: Replace via-maciisi driver with via-cuda  driver Finn Thain <fthain@telegraphics.com.au> - 2016-12-01 07:10 +0100
  [PATCH 06/10] via-cuda: Avoid TREQ race condition Finn Thain <fthain@telegraphics.com.au> - 2016-12-01 07:20 +0100
  [PATCH 05/10] via-cuda: Fix re-initialization of reply_ptr and  reading_reply Finn Thain <fthain@telegraphics.com.au> - 2016-12-01 07:20 +0100
  [PATCH 09/10] via-cuda: Add support for Egret system controller Finn Thain <fthain@telegraphics.com.au> - 2016-12-01 07:20 +0100
  [PATCH 01/10] via-cuda: Cleanup printk calls Finn Thain <fthain@telegraphics.com.au> - 2016-12-01 07:20 +0100
  [PATCH 08/10] via-cuda: Initialize data_index early and increment  consistently Finn Thain <fthain@telegraphics.com.au> - 2016-12-01 07:20 +0100
  [PATCH 02/10] via-cuda: Remove redundant temporary variable Finn Thain <fthain@telegraphics.com.au> - 2016-12-01 07:20 +0100
  [PATCH 07/10] via-cuda: Use spinlock_irq_save/restore instead of  enable/disable_irq Finn Thain <fthain@telegraphics.com.au> - 2016-12-01 07:20 +0100

csiph-web