aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh
diff options
context:
space:
mode:
authorFinn Thain <fthain@telegraphics.com.au>2016-12-31 19:56:26 -0500
committerMichael Ellerman <mpe@ellerman.id.au>2017-02-07 00:56:23 -0500
commit97ced1aac07e7b5348a560512b287af69f863917 (patch)
treec67756da71b430cdad3440439367398a35e08551 /drivers/macintosh
parentac39452e942af6a212e8f89e8a36b71354323845 (diff)
via-cuda: Initialize data_index early and increment consistently
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> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'drivers/macintosh')
-rw-r--r--drivers/macintosh/via-cuda.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/macintosh/via-cuda.c b/drivers/macintosh/via-cuda.c
index e3763cb4184b..57fb20dcb9dd 100644
--- a/drivers/macintosh/via-cuda.c
+++ b/drivers/macintosh/via-cuda.c
@@ -446,12 +446,13 @@ cuda_start(void)
446 /* assert cuda_state == idle */ 446 /* assert cuda_state == idle */
447 if (current_req == NULL) 447 if (current_req == NULL)
448 return; 448 return;
449 data_index = 0;
449 if (TREQ_asserted(in_8(&via[B]))) 450 if (TREQ_asserted(in_8(&via[B])))
450 return; /* a byte is coming in from the CUDA */ 451 return; /* a byte is coming in from the CUDA */
451 452
452 /* set the shift register to shift out and send a byte */ 453 /* set the shift register to shift out and send a byte */
453 out_8(&via[ACR], in_8(&via[ACR]) | SR_OUT); 454 out_8(&via[ACR], in_8(&via[ACR]) | SR_OUT);
454 out_8(&via[SR], current_req->data[0]); 455 out_8(&via[SR], current_req->data[data_index++]);
455 assert_TIP(); 456 assert_TIP();
456 cuda_state = sent_first_byte; 457 cuda_state = sent_first_byte;
457} 458}
@@ -524,9 +525,8 @@ cuda_interrupt(int irq, void *arg)
524 negate_TIP_and_TACK(); 525 negate_TIP_and_TACK();
525 cuda_state = idle; 526 cuda_state = idle;
526 } else { 527 } else {
527 out_8(&via[SR], current_req->data[1]); 528 out_8(&via[SR], current_req->data[data_index++]);
528 toggle_TACK(); 529 toggle_TACK();
529 data_index = 2;
530 cuda_state = sending; 530 cuda_state = sending;
531 } 531 }
532 break; 532 break;