Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3728664rdg; Wed, 18 Oct 2023 04:33:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGP2jbdOgPlH0dJqYd4RjSphMtOIYaxOzYf7TEwYil5kw6e5wtaPypsE6kbpC0KlOXHXj0i X-Received: by 2002:a17:902:ecc4:b0:1c9:e765:e14a with SMTP id a4-20020a170902ecc400b001c9e765e14amr5941683plh.1.1697628839415; Wed, 18 Oct 2023 04:33:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697628839; cv=none; d=google.com; s=arc-20160816; b=ARs8Dq4FoF/C8ieTmt1ue7HT97XIx+FXKsAsGeKaHw5+ma5+ACf55n3nR/dVMF2V4d ruGW1rY5I1+pAC7s6S/hGvsxNn4qMInJgoAxiDzddYUdKFYKyK/TmMhQJogLtLCiSfO3 y0aWEu4NWYakMk1Hswhsar+gt9k+a2zoR8HBj78FD3o8Z1bV3rV2spDMwVY6+Np9a+jv WbyMFNAe1Yx/LtG4n1juOoNttZC5fax+FmcNqlOj8lz+jkKflzar7k51ZS01liqg3boZ Fpap33g5kXREwD2kx0sFhQbiJOHJ0elOv+j0Q/to2hu3SzsZ0hHXqvdRZbCqQx8LfRuu rB3Q== 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:date:subject:cc:to:from :dkim-signature; bh=IuAZIJQZv8Kqs1z9+CQHfhwUvm8AZvoYjYqB9FiFNj0=; fh=hqdHQ8S41oCa8L/udX19ypUuZYOg4T6NbsuLs3Zf04o=; b=poLrIbZUp0x1Ya2av2c0Q2rl8uwn1LntvI8VFwKpHjukmQooCIOPbu8ZE+oZ3hU/ts rEt9+S/k6gOId3kqdQy94tEOhn2gnXdYnkuFChFzzOqGKQc2usYasbxTGG4lw/QWo1TL uP2hzqTtWawWwN5OK51bB8/aFgFdnTgP8ui4YRvWb3q8jJRassv6Rkct6KOi30X52PKr ct46MAdJOtToxPQWqd1Muuc/eYPQv6fwTUsVq6GlKKnoG4pDwVdjwWtZfEZupXuawQK5 N1iZ8XJlMAqfwzoOSQGlgHvwJX/7jHl5xmkJ47kh1U62pg0fPo8KOSyEJGP085Nwy0zJ Rl2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lSWAU71a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id f4-20020a170902e98400b001c60502ccd4si3660545plb.642.2023.10.18.04.33.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 04:33:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lSWAU71a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id E89FA802AA28; Wed, 18 Oct 2023 04:33:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230265AbjJRLdr (ORCPT + 99 others); Wed, 18 Oct 2023 07:33:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229977AbjJRLdp (ORCPT ); Wed, 18 Oct 2023 07:33:45 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6D35115; Wed, 18 Oct 2023 04:33:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697628823; x=1729164823; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+IUgN6qDc3zy/7h4GNa/9YgQiOVwyIUTeR+n02SRwIM=; b=lSWAU71aIUaHqUWrMunRcy8XDUWNZfk9zGNWodVyf5ut3K/O4u+Zm9Zr fPQ3yfYnvExezMnkOeHDWAjb9BrWuPkOVclLh1oulpu4Xy1yNNJsDNisw cavOtF4jVJeI6AU5mosxapsU7uaLwjcRYjvOtjZt1VqqirxZNpTC2CbTw VmHgYDmtd8BGTo0vj8SxBlqoEbPSPyrKnFbgxpel9Xj7kDsgW6jLAq9Ya r2I9LDAYs4D0oLthtKRZzCgAZr+gLzqZKPh4ikta8hpNR+hWa9Wc1tAY+ ftPGWRsKQnKdCVXvS2hIMGV526o/7BKHa9XBvq/f6mXg3Xs+37QdrKEIK A==; X-IronPort-AV: E=McAfee;i="6600,9927,10866"; a="371056710" X-IronPort-AV: E=Sophos;i="6.03,234,1694761200"; d="scan'208";a="371056710" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2023 04:33:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10866"; a="930150801" X-IronPort-AV: E=Sophos;i="6.03,234,1694761200"; d="scan'208";a="930150801" Received: from suguccin-mobl1.amr.corp.intel.com (HELO localhost) ([10.252.44.63]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2023 04:33:39 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: Bjorn Helgaas , linux-pci@vger.kernel.org, Lorenzo Pieralisi , Rob Herring , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Jonathan Cameron , Tom Joseph , Lorenzo Pieralisi , linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 1/7] PCI: cadence: Use FIELD_GET() Date: Wed, 18 Oct 2023 14:32:48 +0300 Message-Id: <20231018113254.17616-2-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231018113254.17616-1-ilpo.jarvinen@linux.intel.com> References: <20231018113254.17616-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 18 Oct 2023 04:33:57 -0700 (PDT) Convert open-coded variants of PCI field access into FIELD_GET() to make the code easier to understand. Signed-off-by: Ilpo Järvinen --- drivers/pci/controller/cadence/pcie-cadence-ep.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/cadence/pcie-cadence-ep.c b/drivers/pci/controller/cadence/pcie-cadence-ep.c index b8b655d4047e..3142feb8ac19 100644 --- a/drivers/pci/controller/cadence/pcie-cadence-ep.c +++ b/drivers/pci/controller/cadence/pcie-cadence-ep.c @@ -3,6 +3,7 @@ // Cadence PCIe endpoint controller driver. // Author: Cyrille Pitchen +#include #include #include #include @@ -262,7 +263,7 @@ static int cdns_pcie_ep_get_msi(struct pci_epc *epc, u8 fn, u8 vfn) * Get the Multiple Message Enable bitfield from the Message Control * register. */ - mme = (flags & PCI_MSI_FLAGS_QSIZE) >> 4; + mme = FIELD_GET(PCI_MSI_FLAGS_QSIZE, flags); return mme; } @@ -394,7 +395,7 @@ static int cdns_pcie_ep_send_msi_irq(struct cdns_pcie_ep *ep, u8 fn, u8 vfn, return -EINVAL; /* Get the number of enabled MSIs */ - mme = (flags & PCI_MSI_FLAGS_QSIZE) >> 4; + mme = FIELD_GET(PCI_MSI_FLAGS_QSIZE, flags); msi_count = 1 << mme; if (!interrupt_num || interrupt_num > msi_count) return -EINVAL; @@ -449,7 +450,7 @@ static int cdns_pcie_ep_map_msi_irq(struct pci_epc *epc, u8 fn, u8 vfn, return -EINVAL; /* Get the number of enabled MSIs */ - mme = (flags & PCI_MSI_FLAGS_QSIZE) >> 4; + mme = FIELD_GET(PCI_MSI_FLAGS_QSIZE, flags); msi_count = 1 << mme; if (!interrupt_num || interrupt_num > msi_count) return -EINVAL; @@ -506,7 +507,7 @@ static int cdns_pcie_ep_send_msix_irq(struct cdns_pcie_ep *ep, u8 fn, u8 vfn, reg = cap + PCI_MSIX_TABLE; tbl_offset = cdns_pcie_ep_fn_readl(pcie, fn, reg); - bir = tbl_offset & PCI_MSIX_TABLE_BIR; + bir = FIELD_GET(PCI_MSIX_TABLE_BIR, tbl_offset); tbl_offset &= PCI_MSIX_TABLE_OFFSET; msix_tbl = epf->epf_bar[bir]->addr + tbl_offset; -- 2.30.2