Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2886208ybv; Mon, 24 Feb 2020 13:41:17 -0800 (PST) X-Google-Smtp-Source: APXvYqyELjjTfwZMctZYwKk5l1GM6TBoaL8Cyj0j3h2+OS8WEOxh8K95odE1XoGvfc+frHfg3UO4 X-Received: by 2002:aca:b608:: with SMTP id g8mr954134oif.142.1582580477314; Mon, 24 Feb 2020 13:41:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582580477; cv=none; d=google.com; s=arc-20160816; b=B7CdOF16yaIuj3rMxdcvYWAWR6MKzixDyIR+L7vVvafW05I1pikm0Ei0EHvx7kP0wk EMFo31ymmvskkWNkV5UXXPix30zOdlPrL1iibfxvX3q+Yol1iKESpKWmf78cVDzOCquU XsK/iJg2xUVALwJivQMiZyXXHfP462r8ye+Rbv4vFsegJg8trkf0+BxyejTqdiJncbf/ YHRfwx2a8b/+NT9+j0IJ/pDPbcDAXVT5o5q9AUYJPUYj0lkq1ZQgS/1Hi1GQgXpJ1gHO GmcCzi91YV00ujPw326STKywyRUxCbz+n808E9fnfjIAMW4IbTV74bYr1pbgu1gp4eRL HQNg== 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=42tkQ1mqAPcsrE3vpICHqMSKmKuDMpv+p2O//nT53iw=; b=Rtot6Tv7aDpuQfLhPI2ZniuvT4FGPUwW0WdtY/yhThjTWJ07Mz/eCJ+X4k/OC7piMM IcprWaI3VV2AIxzr3+ybbGl5FQ6q403sAS1Mn2tFP/Ahc3yutSWNsH0o1uGukLJGt22b ODeydVRyDl8YrtfFb65ZU/UlK/FDH2a+FIYjNZhvP/pTLR+PtCx/uJqEsjf1jAeGOC8c VYCuxOIUeedn+90QFBASH4juTG0IfimAEmQxF4QlA8DWkoOk3fvCiQxPQwo2V3bUljen j6jed0vuNqmm0u4L8Q173c0WHV2rdydxhJw3yobIp/lj0CH7TAfEfb2hN8Ke3anMdliQ iTlQ== 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 c18si9643935ots.317.2020.02.24.13.41.04; Mon, 24 Feb 2020 13:41:17 -0800 (PST) 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 S1728144AbgBXVkt (ORCPT + 99 others); Mon, 24 Feb 2020 16:40:49 -0500 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:31498 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728104AbgBXVkp (ORCPT ); Mon, 24 Feb 2020 16:40:45 -0500 X-Greylist: delayed 986 seconds by postgrey-1.27 at vger.kernel.org; Mon, 24 Feb 2020 16:40:39 EST Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id 01OLO5T6008699; Mon, 24 Feb 2020 22:24:05 +0100 From: Willy Tarreau To: Denis Efremov Cc: Jens Axboe , linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Linus Torvalds , Willy Tarreau Subject: [PATCH 08/10] floppy: cleanup: expand macro DRWE Date: Mon, 24 Feb 2020 22:23:50 +0100 Message-Id: <20200224212352.8640-9-w@1wt.eu> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20200224212352.8640-1-w@1wt.eu> References: <20200224212352.8640-1-w@1wt.eu> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This macro doesn't bring much value and only slightly obfuscates the code by silently using global variable "current_drive", let's expand it. Signed-off-by: Willy Tarreau --- drivers/block/floppy.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 6d4a2e1..d771579 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -306,8 +306,6 @@ static bool initialized; /* reverse mapping from unit and fdc to drive */ #define REVDRIVE(fdc, unit) ((unit) + ((fdc) << 2)) -#define DRWE (&write_errors[current_drive]) - #define PH_HEAD(floppy, head) (((((floppy)->stretch & 2) >> 1) ^ head) << 2) #define STRETCH(floppy) ((floppy)->stretch & FD_STRETCH) @@ -2069,7 +2067,7 @@ static void bad_flp_intr(void) return; } err_count = ++(*errors); - INFBOUND(DRWE->badness, err_count); + INFBOUND(write_errors[current_drive].badness, err_count); if (err_count > drive_params[current_drive].max_errors.abort) cont->done(0); if (err_count > drive_params[current_drive].max_errors.reset) @@ -2274,13 +2272,13 @@ static void request_done(int uptodate) } else { if (rq_data_dir(req) == WRITE) { /* record write error information */ - DRWE->write_errors++; - if (DRWE->write_errors == 1) { - DRWE->first_error_sector = blk_rq_pos(req); - DRWE->first_error_generation = drive_state[current_drive].generation; + write_errors[current_drive].write_errors++; + if (write_errors[current_drive].write_errors == 1) { + write_errors[current_drive].first_error_sector = blk_rq_pos(req); + write_errors[current_drive].first_error_generation = drive_state[current_drive].generation; } - DRWE->last_error_sector = blk_rq_pos(req); - DRWE->last_error_generation = drive_state[current_drive].generation; + write_errors[current_drive].last_error_sector = blk_rq_pos(req); + write_errors[current_drive].last_error_generation = drive_state[current_drive].generation; } floppy_end_request(req, BLK_STS_IOERR); } -- 2.9.0