Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1513742ybh; Sun, 8 Mar 2020 06:14:27 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtcrh9U9+bprcIEbVB6U1Hff8ZZynsS0ATMSji5rdkESB/NzhM/0IzGNAJnF2dkZCtJyqBy X-Received: by 2002:a9d:2c69:: with SMTP id f96mr1653277otb.62.1583673267511; Sun, 08 Mar 2020 06:14:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583673267; cv=none; d=google.com; s=arc-20160816; b=bSGMseLtZJGlp5xrt8iPMIVr7IfT9iTuBaIGA7mtPe5JJg1yrQIpJcg8NFIHxEmYi1 nsy30DGZhcTrjb+xni6gX8le1UGQs85G0TfKGi5ffAYkmlC+iNZWurgu9Ihjz1AZLyzA X6kz3J9rvmOeJypFobWFFkmP5PKySblKA/SPHjYNsIkZmKtBoNjmdVvk7C79uCRnTc/c FSlo5CPqtrPhh3HIOe0mj4zgRG2aZXLZJauMai9VaB3hJaM32nexHIGhpiVAmQtLuhZG Cf5TwMaD6Gh4L9ve3bdJd46X67izhuFQuNVeKRHOdlEnkuF8RJZeJQcVtzxltPha9htL u8qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:subject:autocrypt:from:references:cc:to; bh=+Vaw8bBmhQ+Z1j0Ys0keo38e9WfzBC59wAMA1/zMo7M=; b=WAiCHhxOr7d6kw+4CFtxwVvwaCjGAyoEFB9DbnniAxsyR2civZD00SsEQcTeuH0Gnk khgQo+Z9/fWZmfF/7hbWjvlJkKfpq+Y6irSmys3ZWAkwsVTEZLtpWSkCQh9uOU/s82Zw ysyGPrwmVuc2wuAJRv824YXVOLcGGHTNoaFmAC8ATQuBMpOFufqX+smtsZ9/MbpGNWrw WIvfujERG1Qi8zymVzyYLW1Uy72G8kz2TMiMTd2PVPS62VVdGwrBql1OM91WS5eRAR86 pc/e9R82e15ka+1NGB+gWZZLG702ZJuES8xPcQBNWgwas7//9UdbSa7BScCWuBwkuozX yw+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 e24si2501251oii.259.2020.03.08.06.14.14; Sun, 08 Mar 2020 06:14:27 -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 S1726318AbgCHNM2 (ORCPT + 99 others); Sun, 8 Mar 2020 09:12:28 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:37611 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726267AbgCHNM2 (ORCPT ); Sun, 8 Mar 2020 09:12:28 -0400 Received: by mail-lf1-f67.google.com with SMTP id j11so5451777lfg.4; Sun, 08 Mar 2020 06:12:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:autocrypt:subject :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=+Vaw8bBmhQ+Z1j0Ys0keo38e9WfzBC59wAMA1/zMo7M=; b=Txy16obncE/vJyksDQoyAU5+AeUI405AcniLUMknR9DQrnwCnkl2/v3ySKnnRzJU4I N7A7vimXZRPokotJQPTEdBhSfnFDE4ihok5ooMK6bTyAdLKmpjyQgc+N3pZ/f5QBNGFP xLYzOhwTVez5oYqv8KXAufA+D9MQr4uRHLLznBqXbuPZSnIl70cPW9DuMjvLRxnlTWhN Rmautr+eMvtXFRkO2jcwzqTMBovqtDZuxV636ON/F3x7hRIIwT8OSAMB1qlvYZUByO49 Nb6ikfWUYqGLGaGpF1zgl37SZrcwto7HRDh11aXRkBWaBzVSa/tBX0PWQWwtt0SIeNQh W5CQ== X-Gm-Message-State: ANhLgQ07XQR3nSLyxpMv27t44gmdpAMUggv+44+AZUjNYsQkr4XCxYZg K/QeWyWdFnD3Nj4oiMzzBdQo4Tck X-Received: by 2002:ac2:4906:: with SMTP id n6mr6959117lfi.163.1583673144118; Sun, 08 Mar 2020 06:12:24 -0700 (PDT) Received: from [10.68.32.192] (broadband-188-32-48-208.ip.moscow.rt.ru. [188.32.48.208]) by smtp.gmail.com with ESMTPSA id z23sm17092713ljg.99.2020.03.08.06.12.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 08 Mar 2020 06:12:23 -0700 (PDT) To: Willy Tarreau Cc: Jens Axboe , linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Ian Molton , Russell King References: <20200301195555.11154-1-w@1wt.eu> From: Denis Efremov Autocrypt: addr=efremov@linux.com; keydata= mQINBFsJUXwBEADDnzbOGE/X5ZdHqpK/kNmR7AY39b/rR+2Wm/VbQHV+jpGk8ZL07iOWnVe1 ZInSp3Ze+scB4ZK+y48z0YDvKUU3L85Nb31UASB2bgWIV+8tmW4kV8a2PosqIc4wp4/Qa2A/ Ip6q+bWurxOOjyJkfzt51p6Th4FTUsuoxINKRMjHrs/0y5oEc7Wt/1qk2ljmnSocg3fMxo8+ y6IxmXt5tYvt+FfBqx/1XwXuOSd0WOku+/jscYmBPwyrLdk/pMSnnld6a2Fp1zxWIKz+4VJm QEIlCTe5SO3h5sozpXeWS916VwwCuf8oov6706yC4MlmAqsQpBdoihQEA7zgh+pk10sCvviX FYM4gIcoMkKRex/NSqmeh3VmvQunEv6P+h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d/s3N3j0hR2Uxsski8q6x+LxU1aHS0FFkSl0m8SiazA Gd1zy4pXC2HhCHstF24Nu5iVLPRwlxFS/+o3nB1ZWTwu8I6s2ZF5TAgBfEONV5MIYH3fOb5+ r/HYPye7puSmQ2LCXy7X5IIsnAoxSrcFYq9nGfHNcXhm5x6WjYC0Kz8l4lfwWo8PIpZ8x57v gTH1PI5R4WdRQijLxLCW/AaiuoEYuOLAoW481XtZb0GRRe+Tm9z/fCbkEveyPiDK7oZahBM7 QdWEEV8mqJoOZ3xxqMlJrxKM9SDF+auB4zWGz5jGzCDAx/0qMUrVn2+v8i4oEKW6IUdV7axW Nk9a+EF5JSTbfv0JBYeSHK3WRklSYLdsMRhaCKhSbwo8Xgn/m6a92fKd3NnObvRe76iIEMSw 60iagNE6AFFzuF/GvoIHb2oDUIX4z+/D0TBWH9ADNptmuE+LZnlPUAAEzRgUFtlN5LtJP8ph Subject: Re: [PATCH v2 0/6] floppy: make use of the local/global fdc explicit Message-ID: Date: Sun, 8 Mar 2020 16:12:22 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200301195555.11154-1-w@1wt.eu> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 3/1/20 10:55 PM, Willy Tarreau wrote: > 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): Applied, thanks! https://github.com/evdenis/linux-floppy/commits/floppy-next Ian, Russell, I hope you don't mind if these patches will go through the single tree. If you have any comments, please, write. Tested: [x] Eye-checked the changes [x] Checked that kernel builds after every commit on x86, arm (rpc_defconfig) [x] Checked that there is no binary difference on x86 > floppy: remove dead code for drives scanning on ARM [x] Checked that there is no dead code left unnoticed > 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(-) > Denis