mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Willy Tarreau <w@1wt.eu>
To: Denis Efremov <efremov@linux.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	Willy Tarreau <w@1wt.eu>
Subject: [PATCH 13/23] floppy: cleanup: make output_byte() not rely on current_fdc anymore
Date: Tue, 31 Mar 2020 11:40:44 +0200	[thread overview]
Message-ID: <20200331094054.24441-14-w@1wt.eu> (raw)
In-Reply-To: <20200331094054.24441-1-w@1wt.eu>

Now the fdc is passed in argument so that the function does not
use current_fdc anymore.

Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/block/floppy.c | 64 +++++++++++++++++++++---------------------
 1 file changed, 32 insertions(+), 32 deletions(-)

diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 5dfddd4726fb..81fd06eaea7d 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -1128,26 +1128,26 @@ static int wait_til_ready(int fdc)
 }
 
 /* sends a command byte to the fdc */
-static int output_byte(char byte)
+static int output_byte(int fdc, char byte)
 {
-	int status = wait_til_ready(current_fdc);
+	int status = wait_til_ready(fdc);
 
 	if (status < 0)
 		return -1;
 
 	if (is_ready_state(status)) {
-		fdc_outb(byte, current_fdc, FD_DATA);
+		fdc_outb(byte, fdc, FD_DATA);
 		output_log[output_log_pos].data = byte;
 		output_log[output_log_pos].status = status;
 		output_log[output_log_pos].jiffies = jiffies;
 		output_log_pos = (output_log_pos + 1) % OLOGSIZE;
 		return 0;
 	}
-	fdc_state[current_fdc].reset = 1;
+	fdc_state[fdc].reset = 1;
 	if (initialized) {
 		DPRINT("Unable to send byte %x to FDC. Fdc=%x Status=%x\n",
-		       byte, current_fdc, status);
-		show_floppy(current_fdc);
+		       byte, fdc, status);
+		show_floppy(fdc);
 	}
 	return -1;
 }
@@ -1229,8 +1229,8 @@ static void perpendicular_mode(void)
 	if (fdc_state[current_fdc].perp_mode == perp_mode)
 		return;
 	if (fdc_state[current_fdc].version >= FDC_82077_ORIG) {
-		output_byte(FD_PERPENDICULAR);
-		output_byte(perp_mode);
+		output_byte(current_fdc, FD_PERPENDICULAR);
+		output_byte(current_fdc, perp_mode);
 		fdc_state[current_fdc].perp_mode = perp_mode;
 	} else if (perp_mode) {
 		DPRINT("perpendicular mode not supported by this FDC.\n");
@@ -1243,12 +1243,12 @@ static int no_fifo;
 static int fdc_configure(void)
 {
 	/* Turn on FIFO */
-	output_byte(FD_CONFIGURE);
+	output_byte(current_fdc, FD_CONFIGURE);
 	if (need_more_output() != MORE_OUTPUT)
 		return 0;
-	output_byte(0);
-	output_byte(0x10 | (no_fifo & 0x20) | (fifo_depth & 0xf));
-	output_byte(0);		/* pre-compensation from track
+	output_byte(current_fdc, 0);
+	output_byte(current_fdc, 0x10 | (no_fifo & 0x20) | (fifo_depth & 0xf));
+	output_byte(current_fdc, 0);		/* pre-compensation from track
 				   0 upwards */
 	return 1;
 }
@@ -1301,10 +1301,10 @@ static void fdc_specify(void)
 		if (fdc_state[current_fdc].version >= FDC_82078) {
 			/* chose the default rate table, not the one
 			 * where 1 = 2 Mbps */
-			output_byte(FD_DRIVESPEC);
+			output_byte(current_fdc, FD_DRIVESPEC);
 			if (need_more_output() == MORE_OUTPUT) {
-				output_byte(UNIT(current_drive));
-				output_byte(0xc0);
+				output_byte(current_fdc, UNIT(current_drive));
+				output_byte(current_fdc, 0xc0);
 			}
 		}
 		break;
@@ -1349,9 +1349,9 @@ static void fdc_specify(void)
 	if (fdc_state[current_fdc].spec1 != spec1 ||
 	    fdc_state[current_fdc].spec2 != spec2) {
 		/* Go ahead and set spec1 and spec2 */
-		output_byte(FD_SPECIFY);
-		output_byte(fdc_state[current_fdc].spec1 = spec1);
-		output_byte(fdc_state[current_fdc].spec2 = spec2);
+		output_byte(current_fdc, FD_SPECIFY);
+		output_byte(current_fdc, fdc_state[current_fdc].spec1 = spec1);
+		output_byte(current_fdc, fdc_state[current_fdc].spec2 = spec2);
 	}
 }				/* fdc_specify */
 
@@ -1513,7 +1513,7 @@ static void setup_rw_floppy(void)
 
 	r = 0;
 	for (i = 0; i < raw_cmd->cmd_count; i++)
-		r |= output_byte(raw_cmd->cmd[i]);
+		r |= output_byte(current_fdc, raw_cmd->cmd[i]);
 
 	debugt(__func__, "rw_command");
 
@@ -1566,8 +1566,8 @@ static void check_wp(void)
 {
 	if (test_bit(FD_VERIFY_BIT, &drive_state[current_drive].flags)) {
 					/* check write protection */
-		output_byte(FD_GETSTATUS);
-		output_byte(UNIT(current_drive));
+		output_byte(current_fdc, FD_GETSTATUS);
+		output_byte(current_fdc, UNIT(current_drive));
 		if (result() != 1) {
 			fdc_state[current_fdc].reset = 1;
 			return;
@@ -1639,9 +1639,9 @@ static void seek_floppy(void)
 	}
 
 	do_floppy = seek_interrupt;
-	output_byte(FD_SEEK);
-	output_byte(UNIT(current_drive));
-	if (output_byte(track) < 0) {
+	output_byte(current_fdc, FD_SEEK);
+	output_byte(current_fdc, UNIT(current_drive));
+	if (output_byte(current_fdc, track) < 0) {
 		reset_fdc();
 		return;
 	}
@@ -1748,7 +1748,7 @@ irqreturn_t floppy_interrupt(int irq, void *dev_id)
 	if (inr == 0) {
 		int max_sensei = 4;
 		do {
-			output_byte(FD_SENSEI);
+			output_byte(current_fdc, FD_SENSEI);
 			inr = result();
 			if (do_print)
 				print_result("sensei", inr);
@@ -1771,8 +1771,8 @@ static void recalibrate_floppy(void)
 {
 	debugt(__func__, "");
 	do_floppy = recal_interrupt;
-	output_byte(FD_RECALIBRATE);
-	if (output_byte(UNIT(current_drive)) < 0)
+	output_byte(current_fdc, FD_RECALIBRATE);
+	if (output_byte(current_fdc, UNIT(current_drive)) < 0)
 		reset_fdc();
 }
 
@@ -4302,7 +4302,7 @@ static char __init get_fdc_version(void)
 {
 	int r;
 
-	output_byte(FD_DUMPREGS);	/* 82072 and better know DUMPREGS */
+	output_byte(current_fdc, FD_DUMPREGS);	/* 82072 and better know DUMPREGS */
 	if (fdc_state[current_fdc].reset)
 		return FDC_NONE;
 	r = result();
@@ -4323,15 +4323,15 @@ static char __init get_fdc_version(void)
 		return FDC_82072;	/* 82072 doesn't know CONFIGURE */
 	}
 
-	output_byte(FD_PERPENDICULAR);
+	output_byte(current_fdc, FD_PERPENDICULAR);
 	if (need_more_output() == MORE_OUTPUT) {
-		output_byte(0);
+		output_byte(current_fdc, 0);
 	} else {
 		pr_info("FDC %d is an 82072A\n", current_fdc);
 		return FDC_82072A;	/* 82072A as found on Sparcs. */
 	}
 
-	output_byte(FD_UNLOCK);
+	output_byte(current_fdc, FD_UNLOCK);
 	r = result();
 	if ((r == 1) && (reply_buffer[0] == 0x80)) {
 		pr_info("FDC %d is a pre-1991 82077\n", current_fdc);
@@ -4343,7 +4343,7 @@ static char __init get_fdc_version(void)
 			current_fdc, r);
 		return FDC_UNKNOWN;
 	}
-	output_byte(FD_PARTID);
+	output_byte(current_fdc, FD_PARTID);
 	r = result();
 	if (r != 1) {
 		pr_info("FDC %d init: PARTID: unexpected return of %d bytes.\n",
-- 
2.20.1


  parent reply	other threads:[~2020-03-31  9:43 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-31  9:40 [PATCH 00/23] Floppy driver cleanups Willy Tarreau
2020-03-31  9:40 ` [PATCH 01/23] floppy: split the base port from the register in I/O accesses Willy Tarreau
2020-03-31  9:40 ` [PATCH 02/23] floppy: add references to 82077's extra registers Willy Tarreau
2020-03-31  9:40 ` [PATCH 03/23] floppy: use symbolic register names in the m68k port Willy Tarreau
2020-03-31  9:40 ` [PATCH 04/23] floppy: use symbolic register names in the parisc port Willy Tarreau
2020-03-31  9:40 ` [PATCH 05/23] floppy: use symbolic register names in the powerpc port Willy Tarreau
2020-03-31  9:40 ` [PATCH 06/23] floppy: use symbolic register names in the sparc32 port Willy Tarreau
2020-03-31  9:40 ` [PATCH 07/23] floppy: use symbolic register names in the sparc64 port Willy Tarreau
2020-04-14  9:20   ` Denis Efremov
2020-03-31  9:40 ` [PATCH 08/23] floppy: use symbolic register names in the x86 port Willy Tarreau
2020-03-31  9:40 ` [PATCH 09/23] floppy: cleanup: make twaddle() not rely on current_{fdc,drive} anymore Willy Tarreau
2020-03-31  9:40 ` [PATCH 10/23] floppy: cleanup: make reset_fdc_info() not rely on current_fdc anymore Willy Tarreau
2020-03-31  9:40 ` [PATCH 11/23] floppy: cleanup: make show_floppy() " Willy Tarreau
2020-03-31  9:40 ` [PATCH 12/23] floppy: cleanup: make wait_til_ready() " Willy Tarreau
2020-03-31  9:40 ` Willy Tarreau [this message]
2020-03-31  9:40 ` [PATCH 14/23] floppy: cleanup: make result() " Willy Tarreau
2020-03-31  9:40 ` [PATCH 15/23] floppy: cleanup: make need_more_output() " Willy Tarreau
2020-03-31  9:40 ` [PATCH 16/23] floppy: cleanup: make perpendicular_mode() " Willy Tarreau
2020-03-31  9:40 ` [PATCH 17/23] floppy: cleanup: make fdc_configure() " Willy Tarreau
2020-03-31  9:40 ` [PATCH 18/23] floppy: cleanup: make fdc_specify() not rely on current_{fdc,drive} anymore Willy Tarreau
2020-03-31  9:40 ` [PATCH 19/23] floppy: cleanup: make check_wp() " Willy Tarreau
2020-03-31  9:40 ` [PATCH 20/23] floppy: cleanup: make next_valid_format() not rely on current_drive anymore Willy Tarreau
2020-03-31  9:40 ` [PATCH 21/23] floppy: cleanup: make get_fdc_version() not rely on current_fdc anymore Willy Tarreau
2020-03-31  9:40 ` [PATCH 22/23] floppy: cleanup: do not iterate on current_fdc in DMA grab/release functions Willy Tarreau
2020-04-10  8:35   ` Denis Efremov
2020-04-10  8:45     ` Willy Tarreau
2020-04-10  8:48       ` Denis Efremov
2020-04-10  9:32         ` Willy Tarreau
2020-04-10  9:30   ` [PATCH 24/23] floppy: cleanup: do not iterate on current_fdc in do_floppy_init() Willy Tarreau
2020-04-10 10:19   ` [PATCH 25/23] floppy: make sure to reset all FDCs upon resume() Willy Tarreau
2020-04-10 10:19     ` [PATCH 26/23] floppy: cleanup: get rid of current_reqD in favor of current_drive Willy Tarreau
2020-04-10 10:19     ` [PATCH 27/23] floppy: cleanup: make set_fdc() always set current_drive and current_fd Willy Tarreau
2020-03-31  9:40 ` [PATCH 23/23] floppy: cleanup: add a few comments about expectations in certain functions Willy Tarreau
2020-03-31 10:10 ` [PATCH 00/23] Floppy driver cleanups Christoph Hellwig
2020-03-31 11:01   ` Willy Tarreau
2020-03-31 15:28     ` Christoph Hellwig
2020-03-31 15:49       ` Willy Tarreau
2020-04-13 22:46 ` Jens Axboe
2020-04-14  5:31   ` Willy Tarreau
2020-04-14 10:29     ` Denis Efremov
2020-04-14 16:12       ` Willy Tarreau
2020-04-21 13:15         ` Denis Efremov

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=20200331094054.24441-14-w@1wt.eu \
    --to=w@1wt.eu \
    --cc=axboe@kernel.dk \
    --cc=efremov@linux.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®