Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp499862pxm; Fri, 25 Feb 2022 12:19:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJxaF2/tb0P5ZY/k2QObhZFMdy9h+r6pkYcJr3N+210XWtjwpArOwl86WHHydrTpFGbIvPi6 X-Received: by 2002:a17:903:2489:b0:14f:fe0b:554b with SMTP id p9-20020a170903248900b0014ffe0b554bmr9021815plw.113.1645820384352; Fri, 25 Feb 2022 12:19:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645820384; cv=none; d=google.com; s=arc-20160816; b=EDoqXpTceVHDeSDkj8Lk2j8K6dsd0TXExmhGMHUdrXuFG+s0BJbgG7gCabP98rB/Mu Yp1ANeKE6EypScENJ08e8mEu5uZO3TO53SKCmrzBIvbimEAMru+t1ZfoVmGTaL+fBknO x0s/9zpeBvkzCBt8voasErSrCS+Tql8yjf/5QSX7M3Eb6PmpZyaok1AvwE+P6dngPHLG 7ufXgbRMkjpNuDVehm/7AP8sEQ3K2VsPN365l14ArdHFS+fQlDI0v49wytwQkWRa16tt JObrEabnlLQUy2qKOSZWeWfihU+JqZE3C6DZc8D9ZQ0Y8A/5TDrFOVioFcjogtdK+a82 KVSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=L0Ys1RUIwCI0CMcbfH4sAvW8Ka/fQ9SfgZBjiuRQtZk=; b=Uw3HGeoQVhFSJf/BrDKqAAObqi6d09gPRks8VsV4UK8X+fIfjl6PJhjlV+YZXNn0P3 wBwHDc6XoKkIjFhAoZmVGJ6o6kmzXdJxCVm5SoLBPET9cuw9p3m4trtO64RpWT37d4ZT LfolZyTWZqanz3GfDluwaEyD74abLIkBhbThQN5JLlj2/Y3lNfEu7kyoVsx2cNCXXg4U 8UrPg6nN9sXl+hvLcFUq0iqQ12y7sccpZM+S26jDWhp3EEgMPxpGuMlZS5DzBSY+oWR4 2P6ki+Gs2Sl4lpHeQJOLDECkCFVQHb2UAhT5Cd2qwwDyHdyiFujv23N6rFGseQ1LYTf3 dHgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QneYLEGI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z6-20020a170902708600b00150199ac369si2452211plk.119.2022.02.25.12.19.29; Fri, 25 Feb 2022 12:19:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QneYLEGI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243615AbiBYRXE (ORCPT + 99 others); Fri, 25 Feb 2022 12:23:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243643AbiBYRW4 (ORCPT ); Fri, 25 Feb 2022 12:22:56 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAFDBDF5A; Fri, 25 Feb 2022 09:22:22 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 66FF661935; Fri, 25 Feb 2022 17:22:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E3FAC340F2; Fri, 25 Feb 2022 17:22:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645809741; bh=zcn7N2F1dnEdumd5LpYs9Ka1QOBnAbXy0YD0PxiiAd4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=QneYLEGIUqbVUmMs5dZF9b2NxGoFQQuDCrTf8gx39yIIw74pYOVlmGAA+fGvfH8Sf yOByX4/aTwqtROJKniZLlVdXAtDFB29cF3T43G7l4Agu3cZNsQe8JKiQMO5CgLTLAy 0ceGjMbAzU/5wVjfnHJMCSxZ/Hrd4BLeI9Yws+/aQkHqnIwRHgZEKKp7ohsqDDRUZh 9t+q2y1cPdj4XOosxgBS9+OFN3XpcedMeUKqIWGayp/dQwidHgl0NkhR7mKEcPvx6K 8h0dstzjYwhBFo14f1LWv/oSMpUPiWKimXTuCZ4oc+1GdNtW68qGO6ajm6u0zp6Eat VGRTZD+TIxr6A== Date: Fri, 25 Feb 2022 18:22:16 +0100 From: Marek =?UTF-8?B?QmVow7pu?= To: Bjorn Helgaas Cc: Pali =?UTF-8?B?Um9ow6Fy?= , Lorenzo Pieralisi , Bjorn Helgaas , Rob Herring , Andrew Lunn , Thomas Petazzoni , Krzysztof =?UTF-8?B?V2lsY3p5?= =?UTF-8?B?xYRza2k=?= , Russell King , Gregory Clement , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/6] PCI: Add PCI_EXP_SLTCAP_*_SHIFT macros Message-ID: <20220225182216.2fcf5455@thinkpad> In-Reply-To: <20220225153756.GA358517@bhelgaas> References: <20220225122451.fa2fiyzohwme2d66@pali> <20220225153756.GA358517@bhelgaas> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 25 Feb 2022 09:37:56 -0600 Bjorn Helgaas wrote: > On Fri, Feb 25, 2022 at 01:24:51PM +0100, Pali Roh=C3=A1r wrote: > > On Thursday 24 February 2022 14:28:43 Bjorn Helgaas wrote: =20 > > > On Tue, Feb 22, 2022 at 05:31:54PM +0100, Pali Roh=C3=A1r wrote: =20 > > > > These macros allows to easily compose and extract Slot Power Limit = and > > > > Physical Slot Number values from Slot Capability Register. > > > > > > > > Signed-off-by: Pali Roh=C3=A1r > > > > Signed-off-by: Marek Beh=C3=BAn > > > > --- > > > > include/uapi/linux/pci_regs.h | 3 +++ > > > > 1 file changed, 3 insertions(+) > > > >=20 > > > > diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci= _regs.h > > > > index 108f8523fa04..3fc9a4cac630 100644 > > > > --- a/include/uapi/linux/pci_regs.h > > > > +++ b/include/uapi/linux/pci_regs.h > > > > @@ -591,10 +591,13 @@ > > > > #define PCI_EXP_SLTCAP_HPS 0x00000020 /* Hot-Plug Surprise */ > > > > #define PCI_EXP_SLTCAP_HPC 0x00000040 /* Hot-Plug Capable */ > > > > #define PCI_EXP_SLTCAP_SPLV 0x00007f80 /* Slot Power Limit Value = */ > > > > +#define PCI_EXP_SLTCAP_SPLV_SHIFT 7 /* Slot Power Limit Value sh= ift */ =20 > > >=20 > > > Is there a way to use FIELD_PREP() and FIELD_GET() instead? It seems > > > like that's what the cool kids are doing now. =20 > >=20 > > This is possible too. > >=20 > > I have proposed a patch with _SHIFT macros as this is the way how are > > other macros in this file defined and used. =20 >=20 > Yes, it's a mix. For some recent additions, I've resisted adding the > _SHIFT macros on the theory that they clutter the file, they never > change, and the main point of the #defines is readability and so > grep/tags/etc can find things. >=20 > There are a *few* users of FIELD_PREP() and FIELD_GET(): >=20 > git grep -E "FIELD_(GET|PREP)\(PCI_EXP" >=20 > and I'm inclined to go that direction in the future. What do you > think? I am also pro that direction. Would you also like to convert current usages in the .c driver files? We can't remove the existing macros since they are in UAPI, but we can convert drivers so that they don't use _SHIFT macros. Marek