Skip to content

Commit

Permalink
floppy: cleanup: make next_valid_format() not rely on current_drive a…
Browse files Browse the repository at this point in the history
…nymore

Now the drive is passed in argument so that the function does not
use current_drive anymore.

Link: https://lore.kernel.org/r/20200331094054.24441-21-w@1wt.eu
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Denis Efremov <efremov@linux.com>
  • Loading branch information
wtarreau authored and evdenis committed May 12, 2020
1 parent c7af70b commit 43d81bb
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions drivers/block/floppy.c
Original file line number Diff line number Diff line change
Expand Up @@ -2058,18 +2058,18 @@ static void success_and_wakeup(void)
* ==========================
*/

static int next_valid_format(void)
static int next_valid_format(int drive)
{
int probed_format;

probed_format = drive_state[current_drive].probed_format;
probed_format = drive_state[drive].probed_format;
while (1) {
if (probed_format >= 8 || !drive_params[current_drive].autodetect[probed_format]) {
drive_state[current_drive].probed_format = 0;
if (probed_format >= 8 || !drive_params[drive].autodetect[probed_format]) {
drive_state[drive].probed_format = 0;
return 1;
}
if (floppy_type[drive_params[current_drive].autodetect[probed_format]].sect) {
drive_state[current_drive].probed_format = probed_format;
if (floppy_type[drive_params[drive].autodetect[probed_format]].sect) {
drive_state[drive].probed_format = probed_format;
return 0;
}
probed_format++;
Expand All @@ -2082,7 +2082,7 @@ static void bad_flp_intr(void)

if (probing) {
drive_state[current_drive].probed_format++;
if (!next_valid_format())
if (!next_valid_format(current_drive))
return;
}
err_count = ++(*errors);
Expand Down Expand Up @@ -2884,7 +2884,7 @@ static void redo_fd_request(void)
if (!_floppy) { /* Autodetection */
if (!probing) {
drive_state[current_drive].probed_format = 0;
if (next_valid_format()) {
if (next_valid_format(current_drive)) {
DPRINT("no autodetectable formats\n");
_floppy = NULL;
request_done(0);
Expand Down

0 comments on commit 43d81bb

Please sign in to comment.