Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1541448ybf; Sun, 1 Mar 2020 11:57:12 -0800 (PST) X-Google-Smtp-Source: APXvYqzu+2l1NJvfCuvErfRoddO2VSb6IHKetj8462Ng8RfvKldTM7vWK7vi+hq+OyfFonz0+pxA X-Received: by 2002:a05:6830:22ee:: with SMTP id t14mr10565740otc.236.1583092632197; Sun, 01 Mar 2020 11:57:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583092632; cv=none; d=google.com; s=arc-20160816; b=hz12pQHvKk0/LRqdCVvVa8dub7uZ0O0A/LxHyRt48bAHUEEWVyDiuqAFMz17TU1x/U MSfCiDBdxSOfgN1zwKpqmerjjZyZC3AnqcnpOoS373tlYDvfbnGxxvz+CuI1TM3PYUWA mIfxPymN+OBSGCFT9BHYZlDPgtPs8wkM1B36FVilZVvcK4tGJi/y6IkpMjy8CISWf3dA 4/QXZfo8DRcsajVvnhfNLzL8DiHi45vSlOZwaw/q6CBmN9tdOifUPZz24qqV35HqgT5I Cmtpp4dPUHL7qZ28RDtiVl8P84XAu9oovEAvuUNFDqqi1ljbY680mDEhprZc/h497x1c kviA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=pzu6yK8trEDUCvdHsC+9IBlMImXS6WXJr6f1V4GKotw=; b=yJvM/NU26Zv2D5s4a2i0I7byYEhkFNuQZLvrP79zuRtES6cHiSmmZpjENh63nj06KE 5CQsAViYPodfXewCkDiy4i1FJGTh/Yeg4dK4SGuc9kXsINB3RCFQkKSxBjyaQ2GP2o/K gPjmRVbuJsRDlIvSWhMjYr8BsZrT/+QuI54ONFDYDipWPoNe+kXaThP91AM5dP1Tzsqj e3ylZMCMwZDm0CFmaXZMwGy44qMyWz2ebnGHfaWTcr/HjI3nssYarFoYjwMF/iauv91Y zIV2TmszlUq60ZuK60ET/HG4O4twlnEh2UGQIxHTNQVSqhm20bYmM4bc5xmL6eGkTTEJ zEDQ== 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 j184si3865626oih.216.2020.03.01.11.57.00; Sun, 01 Mar 2020 11:57:12 -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 S1726695AbgCAT4N (ORCPT + 99 others); Sun, 1 Mar 2020 14:56:13 -0500 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:32048 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725895AbgCAT4N (ORCPT ); Sun, 1 Mar 2020 14:56:13 -0500 Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id 021Ju4b7011200; Sun, 1 Mar 2020 20:56:04 +0100 From: Willy Tarreau To: Denis Efremov Cc: Jens Axboe , linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Willy Tarreau Subject: [PATCH v2 0/6] floppy: make use of the local/global fdc explicit Date: Sun, 1 Mar 2020 20:55:49 +0100 Message-Id: <20200301195555.11154-1-w@1wt.eu> X-Mailer: git-send-email 2.9.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is an update to the first minimal cleanup of the floppy driver in order to make use of the FDC number explicit so as to avoid bugs like the one fixed by 2e90ca68 ("floppy: check FDC index for errors before assigning it"). The purpose of this patchset is to rename the "fdc" global variable to "current_fdc" as Linus suggested and adjust the macros which rely on it depending on their context. The most problematic part at this step are the FD_* macros derived from FD_IOPORT, itself referencing the fdc to get its base address. These are exclusively used by fd_outb() and fd_inb(). However on ARM FD_DOR is also used to compare the register based on the port, hence a small change in the ARM specific code to only check the register without relying on this hidden memory access. In order to avoid touching the fd_outb() and fd_inb() macros/functions on all supported architectures, a new set of fdc_outb()/fdc_inb() functions was added to the driver to call the former after adding the register to the FDC's base address. There are still opportunities for more cleanup, though it's uncertain they're welcome in this old driver : - the base address and register can be passed separately to fd_outb() and fd_inb() in order to simplify register retrieval in some archs; - a dozen of functions in the driver implicitly depend on current_fdc while passing it as an argument makes the driver a bit more readable but that represents less than half of the code and doesn't address all the readability concerns; - a test was done to limit support to a single FDC, but after these cleanups it doesn't provide any significant benefit in terms of code readability. These patches are to be applied on top of Denis' floppy-next branch. v2: - CC arch maintainers in ARM patches - fixed issues after Denis' review: - extra braces in floppy.h in declaration of floppy_selects[] - missing parenthesis in fd_outb() macro to silence a warning - used the swap() macro in driveswap() Willy Tarreau (6): floppy: remove dead code for drives scanning on ARM floppy: remove incomplete support for second FDC from ARM code floppy: prepare ARM code to simplify base address separation floppy: introduce new functions fdc_inb() and fdc_outb() floppy: separate the FDC's base address from its registers floppy: rename the global "fdc" variable to "current_fdc" arch/arm/include/asm/floppy.h | 88 ++----------- drivers/block/floppy.c | 284 ++++++++++++++++++++++-------------------- include/uapi/linux/fdreg.h | 18 +-- 3 files changed, 168 insertions(+), 222 deletions(-) -- 2.9.0