From: Finn Thain <fthain@telegraphics.com.au>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-kernel@vger.kernel.org
Subject: [PATCH RESEND 08/10] via-cuda: Initialize data_index early and increment consistently
Date: Sat, 31 Dec 2016 19:56:26 -0500 (EST) [thread overview]
Message-ID: <cd02acbee18651e275a4bd8a5fdbf967b7abdd38.1483055859.git.fthain@telegraphics.com.au> (raw)
In-Reply-To: <cover.1483055859.git.fthain@telegraphics.com.au>
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 e3763cb..57fb20d 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.10.2
next prev parent reply other threads:[~2017-01-01 0:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-01 0:56 [PATCH RESEND 00/10] Replace via-maciisi with via-cuda driver Finn Thain
2017-01-01 0:56 ` Finn Thain [this message]
2017-01-01 0:56 ` [PATCH RESEND 10/10] m68k/mac: Replace via-maciisi driver " Finn Thain
2017-01-02 10:26 ` Geert Uytterhoeven
2017-01-03 0:33 ` Finn Thain
2017-01-01 0:56 ` [PATCH RESEND 09/10] via-cuda: Add support for Egret system controller Finn Thain
2017-01-01 0:56 ` [PATCH RESEND 02/10] via-cuda: Remove redundant temporary variable Finn Thain
2017-01-01 0:56 ` [PATCH RESEND 06/10] via-cuda: Avoid TREQ race condition Finn Thain
2017-01-01 0:56 ` [PATCH RESEND 05/10] via-cuda: Fix re-initialization of reply_ptr and reading_reply Finn Thain
2017-01-01 0:56 ` [PATCH RESEND 01/10] via-cuda: Cleanup printk calls Finn Thain
2017-02-09 13:17 ` [RESEND,01/10] " Michael Ellerman
2017-01-01 0:56 ` [PATCH RESEND 04/10] via-cuda: Prevent read buffer overflow Finn Thain
2017-01-01 0:56 ` [PATCH RESEND 03/10] via-cuda: Add TREQ, TIP and TACK signal helpers Finn Thain
2017-01-01 0:56 ` [PATCH RESEND 07/10] via-cuda: Use spinlock_irq_save/restore instead of enable/disable_irq Finn Thain
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=cd02acbee18651e275a4bd8a5fdbf967b7abdd38.1483055859.git.fthain@telegraphics.com.au \
--to=fthain@telegraphics.com.au \
--cc=benh@kernel.crashing.org \
--cc=geert@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).