Commit 197c7ffd authored by Willy Tarreau's avatar Willy Tarreau Committed by Denis Efremov

floppy: cleanup: make perpendicular_mode() not rely on current_fdc anymore

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

It's worth noting that there's still a single raw_cmd pointer
specific to the current fdc. It may make sense to have one per
fdc in the future. In addition, cont->done() still relies on the
current drive and current raw_cmd.

Link: https://lore.kernel.org/r/20200331094054.24441-17-w@1wt.euSigned-off-by: default avatarWilly Tarreau <w@1wt.eu>
Signed-off-by: default avatarDenis Efremov <efremov@linux.com>
parent 3ab12a18
...@@ -1200,7 +1200,7 @@ static int need_more_output(int fdc) ...@@ -1200,7 +1200,7 @@ static int need_more_output(int fdc)
/* Set perpendicular mode as required, based on data rate, if supported. /* Set perpendicular mode as required, based on data rate, if supported.
* 82077 Now tested. 1Mbps data rate only possible with 82077-1. * 82077 Now tested. 1Mbps data rate only possible with 82077-1.
*/ */
static void perpendicular_mode(void) static void perpendicular_mode(int fdc)
{ {
unsigned char perp_mode; unsigned char perp_mode;
...@@ -1215,7 +1215,7 @@ static void perpendicular_mode(void) ...@@ -1215,7 +1215,7 @@ static void perpendicular_mode(void)
default: default:
DPRINT("Invalid data rate for perpendicular mode!\n"); DPRINT("Invalid data rate for perpendicular mode!\n");
cont->done(0); cont->done(0);
fdc_state[current_fdc].reset = 1; fdc_state[fdc].reset = 1;
/* /*
* convenient way to return to * convenient way to return to
* redo without too much hassle * redo without too much hassle
...@@ -1226,12 +1226,12 @@ static void perpendicular_mode(void) ...@@ -1226,12 +1226,12 @@ static void perpendicular_mode(void)
} else } else
perp_mode = 0; perp_mode = 0;
if (fdc_state[current_fdc].perp_mode == perp_mode) if (fdc_state[fdc].perp_mode == perp_mode)
return; return;
if (fdc_state[current_fdc].version >= FDC_82077_ORIG) { if (fdc_state[fdc].version >= FDC_82077_ORIG) {
output_byte(current_fdc, FD_PERPENDICULAR); output_byte(fdc, FD_PERPENDICULAR);
output_byte(current_fdc, perp_mode); output_byte(fdc, perp_mode);
fdc_state[current_fdc].perp_mode = perp_mode; fdc_state[fdc].perp_mode = perp_mode;
} else if (perp_mode) { } else if (perp_mode) {
DPRINT("perpendicular mode not supported by this FDC.\n"); DPRINT("perpendicular mode not supported by this FDC.\n");
} }
...@@ -1946,7 +1946,7 @@ static void floppy_ready(void) ...@@ -1946,7 +1946,7 @@ static void floppy_ready(void)
#endif #endif
if (raw_cmd->flags & (FD_RAW_NEED_SEEK | FD_RAW_NEED_DISK)) { if (raw_cmd->flags & (FD_RAW_NEED_SEEK | FD_RAW_NEED_DISK)) {
perpendicular_mode(); perpendicular_mode(current_fdc);
fdc_specify(); /* must be done here because of hut, hlt ... */ fdc_specify(); /* must be done here because of hut, hlt ... */
seek_floppy(); seek_floppy();
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment