From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1733C433EF for ; Fri, 25 Feb 2022 17:22:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243587AbiBYRXD (ORCPT ); Fri, 25 Feb 2022 12:23:03 -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 Precedence: bulk List-ID: X-Mailing-List: linux-pci@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