Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3948823ybv; Tue, 25 Feb 2020 10:12:24 -0800 (PST) X-Google-Smtp-Source: APXvYqy03zA+/2fdNBS2XHiQRCEtLkVbhsuaeyP+w6syvPaEI4E5dkipLutD8iNyVRekxUHWEto2 X-Received: by 2002:a05:6808:289:: with SMTP id z9mr179170oic.48.1582654343966; Tue, 25 Feb 2020 10:12:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582654343; cv=none; d=google.com; s=arc-20160816; b=fLBTa64VAukUJXFLqDDumnWh6U3NWzZcs4Yey7YCDFQtKJaiZagQE/wvUCXIN3KQ6+ WwSLiu21ir2bSRNc1n9DGjniqFYOP3syQGDKVKZJ8ZMYmRHpkMH4lsxuIdx2UZDwMkdW UOJyW5P7C9T7C0OZtpvW3xqcRSu4tVa/Ms/yy4bNoAQZwFj4E/iW/0J5/OREWtEe4Dxg CzbKI4TlpN8gB7tunoY3Eq6H4lC7X7wLVcfTirjXt6aRUnflCyMaWesM4P47Kd5f/Oix il8f/j1KlRK19Ys+NzWhuyho+2k5VncgZX+ipvp+ly9aqBBJH4d6YOKL1NMCmsUa2xpT szIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=KZj7OE/AEXTNTWMBPQHvBKDqkcJwx1C7Z4An7x1Nm6U=; b=KrFjLBPhLLOGRHYTrpuOKqNlTn953GbhAdYFExgwWJgP1rBe1KvLGYnXE/OaCZoQvn f+6Ti+hRCfxbDFApxkQQHVtyvd9r6Qqaxw0EFk2ZLhthCUUyeBJo0zw/A/8hVxQ5UPUK Im4x2IQ9F10W2JIDfEyqP5Sql+vOSf0q9HpQ5QGh3rCcbDTeDCvPx2VdKGL5cBm2bT9a 5vM61D1TEdNbpFp06kJUmwethG4m76AYz/nRLd9GubU6GM71i91N/JYkM5fdb7CwQf5n 5D4BhEl8xe7x+JF/XpCh5yQyFha3Fde6WQhLKFCwBg5U+nXQUTA/eT7mDMtEpsWl70Wo BGOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=hHcBd9t2; 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 t3si6836344oig.25.2020.02.25.10.12.10; Tue, 25 Feb 2020 10:12:23 -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; dkim=pass header.i=@linux-foundation.org header.s=google header.b=hHcBd9t2; 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 S1731337AbgBYSJM (ORCPT + 99 others); Tue, 25 Feb 2020 13:09:12 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:46045 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731278AbgBYSJL (ORCPT ); Tue, 25 Feb 2020 13:09:11 -0500 Received: by mail-lj1-f195.google.com with SMTP id e18so15052048ljn.12 for ; Tue, 25 Feb 2020 10:09:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=KZj7OE/AEXTNTWMBPQHvBKDqkcJwx1C7Z4An7x1Nm6U=; b=hHcBd9t2SzG6GRzXGR/mlF1Hw96u3fivqizE/4XEZF2XKT3vjc/66UmfCvsIAK8miD Er1UoTiiGLOhLDhtdaN5nX8PUWHYXn2CoVpux4hudCe/PVSGle1Ey1idxU70dMRG02qq vUEKlXCx3wt7cMV6NOJo8//NTEdOol4kRReL8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=KZj7OE/AEXTNTWMBPQHvBKDqkcJwx1C7Z4An7x1Nm6U=; b=m6DhYiTyMfS/j3evqDVS60oCHToHteU0SuvREQVUJZlbJu4lgpa0b7HUxPC9+wz1ys ycq9Jbh7LGyXWpzcNcM+tkmfSwT/KpZPyRDAPXRcT8n47Y3PPL6gheAXqHoC+NmdHOA5 ucdWh1bxWEV59k4mwto9DKlNpk2k29YNl0cOpI1j+5DAVfsQ/z83UFhhMe8AP62F3gqX 04fpa/mHq4yB144JkeUQOwvf5R1cOiZwXXb2SMdoviq8ARnAJrznZ6h8uKKs22pMRrP2 N1CLOAb6Md5vYCASSaUDIYbg3ssa40TSCiQZsN7bqFaZY3gL8/tV6H+RWargkJldRG7G kmWA== X-Gm-Message-State: APjAAAWqwfph85rMh13VaauimiugZXyzgGRq9/BlAbK5buDz9D2L3DTP doa2T94NFl9ochTfoZyxtdRAiqx/qH4= X-Received: by 2002:a2e:7d0c:: with SMTP id y12mr173826ljc.39.1582654148970; Tue, 25 Feb 2020 10:09:08 -0800 (PST) Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com. [209.85.208.169]) by smtp.gmail.com with ESMTPSA id y29sm8267109ljd.88.2020.02.25.10.09.07 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 25 Feb 2020 10:09:08 -0800 (PST) Received: by mail-lj1-f169.google.com with SMTP id x14so15045600ljd.13 for ; Tue, 25 Feb 2020 10:09:07 -0800 (PST) X-Received: by 2002:a2e:580c:: with SMTP id m12mr188557ljb.150.1582654147202; Tue, 25 Feb 2020 10:09:07 -0800 (PST) MIME-Version: 1.0 References: <20200224212352.8640-1-w@1wt.eu> <20200224212352.8640-2-w@1wt.eu> <28e72058-021d-6de0-477e-6038a10d96da@linux.com> <20200225034529.GA8908@1wt.eu> <20200225140207.GA31782@1wt.eu> <10bc7df1-7a80-a05a-3434-ed0d668d0c6c@linux.com> In-Reply-To: <10bc7df1-7a80-a05a-3434-ed0d668d0c6c@linux.com> From: Linus Torvalds Date: Tue, 25 Feb 2020 10:08:51 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 01/10] floppy: cleanup: expand macro FDCS To: Denis Efremov Cc: Willy Tarreau , Jens Axboe , Linux Kernel Mailing List , linux-block Content-Type: text/plain; charset="UTF-8" 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 7:22 AM Denis Efremov wrote: > > I think that for the first attempt changing will be enough: > -static int fdc; /* current fdc */ > +static int current_fdc; /* current fdc */ > and > -#define FD_IOPORT fdc_state[fdc].address > +#define FD_IOPORT fdc_state[current_fdc].address Please don't do this blindly - ie without verifying that there are no cases of that "local fdc variable shadowing" issue. Of course, such a verification might be as easy as "generates exact same code" rather than looking at every use. And btw, don't worry too much about this being in an UAPI file. I'm pretty sure that's because of specialty programs that use the magical ioctls to do special formatting. They want the special commands (FD_FORMAT etc), but I don't think they really use the port addresses. So I think it's in a UAPI file entirely by mistake. We should at least try moving those bits to the floppy.c file and remove it from the header file. For example, doing a Debian code search on "FDPATCHES" doesn't find any user space hits. Searching for "FD_STATUS" gets a lot of hits, but thos all seem to be because it's a symbol used by user space programs, ("file descriptor status"), not because those hits actually used the fdreg.h header file. So we can remove at least the FD_IOPORT mess from the header file, I bet. Worst case - if somebody finds some case that uses them, we can put it back. Linus