Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2887958ybv; Mon, 24 Feb 2020 13:44:06 -0800 (PST) X-Google-Smtp-Source: APXvYqz8sNiJbBQCXm0x+BrPpXndBd/t/Bs5t3tKPjY4oopuavYKDibvdf+b0F6u+GKJIadr7mZO X-Received: by 2002:aca:ec46:: with SMTP id k67mr888005oih.43.1582580646692; Mon, 24 Feb 2020 13:44:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582580646; cv=none; d=google.com; s=arc-20160816; b=QD0+X4ySotZrX7AUTthgXC4hRrVCGO2HcISKbGw9AjQMXl46RZq8/rLhoqsYwB/JXC aIIIRG7hwFLgg9a8teM/npePhXupVZZz2wPVbioC2ycPfJ8vFNwWt8LL/pLA2kk5D/iM GAm8O1ETnMrf/gF7yU3alth/7T8/S/4wceXG3GTfgZZoasuILRDjxgj9/W6MvDxhv2OD Ynk01DTZwyikZ9jXVLGTQ4f0eqJ7BD5n4OGJNgWu3Kw/mJLPMsYvgIWFxqXIkoT9ua2A lx9bE84jbTbHWKBEdry9dzYxieqEMonIlcVkAQbzBKcK+HoMb1DKkzIQwyIGpauHwNOf NhKg== 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=ftlDv5+YDjQKvItm2iRn5YHQxAOqMfHr2STPuak10J8=; b=suvQNLhlIs8kXVULFaz2167UZ9NsntOGVjlqkXfNXpDmHDW9AFGpC/A/T2lHBLV11k QwCMxWaxMJNnc+1pkdGSoJLuhrBWVmOsvdfXqj+U3v2VHAlb7QEEQzLdOxCHTwXYvUtx K6sxWL6l0D+xqsJxUly6YKrVsXZMNWKQwtGi7Uq16JrsAodNUvmcdSG+wXZfxQK+cq57 kRPpfi3DyiWLXuqgeb1oNIGgEIT4aWLXSKA7G/ga62lPOEHp044iCV0QLmH5f3ZzQ15p 8JFXws5iWwRqCiL8PO0lJ1Df8ELveL+M8uYEelHzd9VT0jCe/mBhP241eNlPxV9pre1t Wdtg== 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.43.53; Mon, 24 Feb 2020 13:44:06 -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 S1728343AbgBXVle (ORCPT + 99 others); Mon, 24 Feb 2020 16:41:34 -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 S1727459AbgBXVkk (ORCPT ); Mon, 24 Feb 2020 16:40:40 -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 01OLO4Ms008693; Mon, 24 Feb 2020 22:24:04 +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 02/10] floppy: cleanup: expand macro UFDCS Date: Mon, 24 Feb 2020 22:23:44 +0100 Message-Id: <20200224212352.8640-3-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 | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 93e0840..182148a 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -313,7 +313,6 @@ static bool initialized; #define UDP (&drive_params[drive]) #define UDRS (&drive_state[drive]) #define UDRWE (&write_errors[drive]) -#define UFDCS (&fdc_state[FDC(drive)]) #define PH_HEAD(floppy, head) (((((floppy)->stretch & 2) >> 1) ^ head) << 2) #define STRETCH(floppy) ((floppy)->stretch & FD_STRETCH) @@ -3549,7 +3548,7 @@ static int fd_locked_ioctl(struct block_device *bdev, fmode_t mode, unsigned int case FDRESET: return user_reset_fdc(drive, (int)param, true); case FDGETFDCSTAT: - outparam = UFDCS; + outparam = &fdc_state[FDC(drive)]; break; case FDWERRORCLR: memset(UDRWE, 0, sizeof(*UDRWE)); @@ -3833,7 +3832,7 @@ static int compat_getfdcstat(int drive, struct floppy_fdc_state v; mutex_lock(&floppy_mutex); - v = *UFDCS; + v = fdc_state[FDC(drive)]; mutex_unlock(&floppy_mutex); memset(&v32, 0, sizeof(struct compat_floppy_fdc_state)); @@ -4062,8 +4061,8 @@ static int floppy_open(struct block_device *bdev, fmode_t mode) buffer_track = -1; } - if (UFDCS->rawcmd == 1) - UFDCS->rawcmd = 2; + if (fdc_state[FDC(drive)].rawcmd == 1) + fdc_state[FDC(drive)].rawcmd = 2; if (!(mode & FMODE_NDELAY)) { if (mode & (FMODE_READ|FMODE_WRITE)) { -- 2.9.0