Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3708566ybv; Tue, 25 Feb 2020 06:03:32 -0800 (PST) X-Google-Smtp-Source: APXvYqzg9f9vMOuwvOeeSAiAyo3gGRTDGnYrYUKgYGx6diaOKBR9enX1JOKdiyTSsH05wIzzCShV X-Received: by 2002:a9d:6f0a:: with SMTP id n10mr46508030otq.54.1582639412008; Tue, 25 Feb 2020 06:03:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582639412; cv=none; d=google.com; s=arc-20160816; b=IJTZ9DHzPE/euFG8+BM2z58poAc1300y1D9n6ANAboXtj2ueombbjbsgbd/uiahNbz JW21safQOo9pUV8EuRZNXHA9CHdkQPKrw3MQOz2X1SixjghyTvOp7upGsqe7lVQzBXKX Iszlsn3ZPHKX9T/bL0ff3h/shrQuyHp7qzyowofx+w+LW7oZHds2gQjvfkvL2B8mNFZi WPAiZwk0dmcSELvjpRMMzQbpnIs7jZRVWlS3HmbtxpmqQ/OHusgRe3Md44y9wBMhTrq+ AwqmpwpRUUpPvNIhYYF4Q88TnWhF2GBzhddniar+z1xPJ9Lv/vO3t29AJBzmxEnxT2DX 1Q9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=oDYAxm/L6Wp4BXnfhcVkRnFrFp5MSgXwLmCH4ZxIaAA=; b=AU+sEWZ/vZxrqXyfWzN4DcOzW0C9SEx10RQqOxTNzCBVgpUYvOfBCpZAk7SNjS6AOK asBx7txKoswst+ipfOCYLG4IP+6/Z7m4dtrMAnk2dCW55691N4TE+oW22jk/R05g0jVC ep7NgAswVEUsv696ZYGHYnzjCW9AqoeBrJS+mWNM8D9UuZIeAKTLRJVTP+2aYunRB+NA TmopNLRX09s0xbj2DzJYud+vBpAmwh+/lA2V6t/kSfneGbKezpF8Tmd0zNJEaMcrbysE PmOBKK63yNRzmEfF+PSlJCME7HwBRoQoIT3mV2ntiGS/uY7Ru0wgm8odI7SrvDg21nAz 5D/w== 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 t10si8723895otd.219.2020.02.25.06.03.10; Tue, 25 Feb 2020 06:03:31 -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 S1730477AbgBYOCR (ORCPT + 99 others); Tue, 25 Feb 2020 09:02:17 -0500 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:31526 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729952AbgBYOCQ (ORCPT ); Tue, 25 Feb 2020 09:02:16 -0500 Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id 01PE27FN031971; Tue, 25 Feb 2020 15:02:07 +0100 Date: Tue, 25 Feb 2020 15:02:07 +0100 From: Willy Tarreau To: Denis Efremov Cc: Jens Axboe , Linux Kernel Mailing List , linux-block , Linus Torvalds Subject: Re: [PATCH 01/10] floppy: cleanup: expand macro FDCS Message-ID: <20200225140207.GA31782@1wt.eu> References: <20200224212352.8640-1-w@1wt.eu> <20200224212352.8640-2-w@1wt.eu> <28e72058-021d-6de0-477e-6038a10d96da@linux.com> <20200225034529.GA8908@1wt.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.1 (2016-04-27) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 25, 2020 at 10:14:40AM +0300, Denis Efremov wrote: > > > On 2/25/20 6:45 AM, Willy Tarreau wrote: > > On Tue, Feb 25, 2020 at 02:13:42AM +0300, Denis Efremov wrote: > >> On 2/25/20 12:53 AM, Linus Torvalds wrote: > >>> So I'd like to see that second step that does the > >>> > >>> -static int fdc; /* current fdc */ > >>> +static int current_fdc; > >>> > >>> change. > >>> > >>> We already call the global 'drive' variable 'current_drive', so it > >>> really is 'fdc' that is misnamed and ambiguous because it then has two > >>> different cases: the global 'fdc' and then the various shadowing local > >>> 'fdc' variables (or function arguments). > >>> > >>> Mind adding that too? Slightly less automatic, I agree, because then > >>> you really do have to disambiguate between the "is this the shadowed > >>> use of a local 'fdc'" case or the "this is the global 'fdc' use" case. > > > > I definitely agree. I first wanted to be sure the patches were acceptable > > as a principle, but disambiguating the variables is easy to do now. > > Ok, I don't want to break in the middle of your changes in this case. So I started this and discovered the nice joke you were telling me about regarding FD_IOPORT which references fdc. Then the address registers FD_STATUS, FD_DATA, FD_DOR, FD_DIR, FD_DCR which are based on FD_IOPORT also depend on it. These ones are used by fd_outb() which is arch-dependent, so if we want to pass a third argument we have to change them all and make sure not to break them too much. In addition the FD_* macros defined above are used by x86, and FD_DOR is also used by arm while all other archs hard-code all the values. ARM also uses floppy_selects[fdc] and new_dor... I'm starting to feel the trap here! I also feel a bit concerned that these are exported in uapi with a hard-coded 0x3f0 base address. I'm just not sure how portable all of this is in the end :-/ Now I'm wondering, how far should we go and how much is it acceptable to change ? I'd rather not have "#define fdc current_fdc" just so that it builds, but on the other hand this problem clearly outlights the roots of the issue, which lies in "fdc" being silently accessed by macros with nobody noticing! Willy