Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2886104ybv; Mon, 24 Feb 2020 13:41:09 -0800 (PST) X-Google-Smtp-Source: APXvYqzmhMNSf6V39C/9kRotqcVHoWRPDIJxnj62/aDKf6cHU6vkKlctH+DbQFDaTEvzeGF3IwqD X-Received: by 2002:aca:b60a:: with SMTP id g10mr885751oif.102.1582580468850; Mon, 24 Feb 2020 13:41:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582580468; cv=none; d=google.com; s=arc-20160816; b=FGdRm3cgZm11ZJdakB0DkuXqixbnvRzBXmaerlrSOFvZ0szaT2pRPFEjeyUqvdrPP0 1n62uC00xAJTy/bd3uq75GQjYf2oMwXUHNjGm387nogmmYFjkckFZizcdcpnfSsfXPNw MvjIiueDbpvJigYMDE4YiHTl9qJ9ruiR8Z9MDiwcQv56pKxk/3WwFgBzr3iShkjhN1pu gnQb6lLXdiaBuwwu2uM6IJROYD6CLAkZu+OmTcq6pLpLJK19mWPPbwkr2q+xDUhsxG/N dcik6w0N1v6ZJ0gYeZLq7A/tIq84b6SJ2RLTksMBhD8dYYmvwImXWHzqXDvmtCWfy4oC 7udg== 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=tvGaDAHkPY+5/usYSmtGsL4WosldMlW3h3ygboourlY=; b=IEfA3T75XlQgIK8WUsODP/tmYAk43qAzj6DoSltnv0sHSz/voxHDhTXqUk+TCTCMnb eChNTd1Xv0qHcNygr/vu4VqydQfsJ3csv4KKhgQVs21Jpa2edcXXikMvhPUQ7HaimhOt 5N9E9coMSbB/G17RvfVDakpZa9RLc+N+k//qj1KhA4rw4rwOgayWviPasPUexcOQDlmW LxJ5aQ0Ivzp8XW8CXjXRn7vS1KpdtbmzXaMDPPaoWhXxnfVa++E5TWzqi54rp7GW3rP3 DAg0dFCg4n9tpxJ5f4JiBim6R3jC5bHKV4bdPTVn2Lfu6GvdZ4bN3S8pyNpYYKONnnlk SGlQ== 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 g25si6657538otp.20.2020.02.24.13.40.56; Mon, 24 Feb 2020 13:41:08 -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 S1728116AbgBXVkq (ORCPT + 99 others); Mon, 24 Feb 2020 16:40:46 -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 S1728040AbgBXVkn (ORCPT ); Mon, 24 Feb 2020 16:40:43 -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 01OLO5UU008696; 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 05/10] floppy: cleanup: expand macro UDRWE Date: Mon, 24 Feb 2020 22:23:47 +0100 Message-Id: <20200224212352.8640-6-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 local variable "drive", let's expand it. Signed-off-by: Willy Tarreau --- drivers/block/floppy.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 522fbcc..a76a9bb 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -310,8 +310,6 @@ static bool initialized; #define DRS (&drive_state[current_drive]) #define DRWE (&write_errors[current_drive]) -#define UDRWE (&write_errors[drive]) - #define PH_HEAD(floppy, head) (((((floppy)->stretch & 2) >> 1) ^ head) << 2) #define STRETCH(floppy) ((floppy)->stretch & FD_STRETCH) @@ -3553,10 +3551,10 @@ static int fd_locked_ioctl(struct block_device *bdev, fmode_t mode, unsigned int outparam = &fdc_state[FDC(drive)]; break; case FDWERRORCLR: - memset(UDRWE, 0, sizeof(*UDRWE)); + memset(&write_errors[drive], 0, sizeof(write_errors[drive])); return 0; case FDWERRORGET: - outparam = UDRWE; + outparam = &write_errors[drive]; break; case FDRAWCMD: if (type) @@ -3867,7 +3865,7 @@ static int compat_werrorget(int drive, memset(&v32, 0, sizeof(struct compat_floppy_write_errors)); mutex_lock(&floppy_mutex); - v = *UDRWE; + v = write_errors[drive]; mutex_unlock(&floppy_mutex); v32.write_errors = v.write_errors; v32.first_error_sector = v.first_error_sector; @@ -4643,7 +4641,7 @@ static int __init do_floppy_init(void) /* initialise drive state */ for (drive = 0; drive < N_DRIVE; drive++) { memset(&drive_state[drive], 0, sizeof(drive_state[drive])); - memset(UDRWE, 0, sizeof(*UDRWE)); + memset(&write_errors[drive], 0, sizeof(write_errors[drive])); set_bit(FD_DISK_NEWCHANGE_BIT, &drive_state[drive].flags); set_bit(FD_DISK_CHANGED_BIT, &drive_state[drive].flags); set_bit(FD_VERIFY_BIT, &drive_state[drive].flags); -- 2.9.0