Received: by 2002:a17:90a:1609:0:0:0:0 with SMTP id n9csp3647497pja; Tue, 31 Mar 2020 02:45:21 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsA0jMlPWLpoikFO7YRKTp3eaD4araLNTMjqqb9H8/kLN2bDdJwe5bz3l/TaIGs3SxFK4ls X-Received: by 2002:a05:6830:23a3:: with SMTP id m3mr11971107ots.265.1585647921540; Tue, 31 Mar 2020 02:45:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585647921; cv=none; d=google.com; s=arc-20160816; b=WQipSBdygPdWdzbq/3kndhCZe1SoE+1v3SpAL42HHJlaO6HH0PGpJYbRqLroXOaIAh bsUKJz89nczaSMw9RhhCs/L8GqSA6JPA4W+/PG5rnrj084/h9q/WuGwyHVdbw/5IJhKy jYbrOOpdnND91cljbx7+ZPT+UMUW11X9znXX6ENznrnznul5DJfyDd0oPcDfBxhoacJb ypJYK9Frq+gcEW5sjPTy5nMCkZRyq7TwqblhhMTaH91TfYJiOHHt4v4UcoRspGTzzJJJ c20o2TZYNlBZ5XjLxHpVEe8IPwIWq2pN9DAKwi43nrQR8eq2aHR0xS2ORa64Zgm2b0Qu jVDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=+2MMaF06i6T6sC6Z4hvJzYRWA8d+ylrpwA8s+mpe1N4=; b=HzzFxoQ1/yb//OUCcJ7ExQre1uhAr4KXrR+xO524yFbcjc/yuHvFUgxrVEJ3nOKHOZ IRh0l80NGPyrDc7k5hGWEFjOo5JpAaynslzhfNQM6oB9RQJUDDCttd26WQqHXQBAR9/j gRRlkflex00IrZb5331n9CXjvxxVT7SCWwT0Fomgdnokfeqi7L9px3ABGJPuxye6w5dm lRSsoy7P9WG2B0Y4ZYz6wj1otf30P4zg26trlpH/i/Pa7Jar8L7ULhNFQm/WPSrJdcaN YtdN8yg0U1ixIEhgoccxiOoSmw6VGjePa6KCuJ4ROcDlx+jS0USxKLaMMkHd4K6Gielp 6H/g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u64si7020997oig.238.2020.03.31.02.45.09; Tue, 31 Mar 2020 02:45:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730700AbgCaJnN (ORCPT + 99 others); Tue, 31 Mar 2020 05:43:13 -0400 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:34180 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730273AbgCaJnM (ORCPT ); Tue, 31 Mar 2020 05:43:12 -0400 Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id 02V9f65m024527; Tue, 31 Mar 2020 11:41:06 +0200 From: Willy Tarreau To: Denis Efremov Cc: Jens Axboe , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Willy Tarreau Subject: [PATCH 20/23] floppy: cleanup: make next_valid_format() not rely on current_drive anymore Date: Tue, 31 Mar 2020 11:40:51 +0200 Message-Id: <20200331094054.24441-21-w@1wt.eu> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20200331094054.24441-1-w@1wt.eu> References: <20200331094054.24441-1-w@1wt.eu> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now the drive is passed in argument so that the function does not use current_drive anymore. Signed-off-by: Willy Tarreau --- drivers/block/floppy.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index b9a3a04c2636..f53810ba486d 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -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++; @@ -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); @@ -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); -- 2.20.1