Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1624446yba; Thu, 25 Apr 2019 03:02:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqyypAfSZamxm8B3ZuYkZDuqDKDxMEwqMiEKqymu7+rxBc3+tuP//GN3jnPEj/Of+1ZrTTgq X-Received: by 2002:a63:360e:: with SMTP id d14mr36205412pga.188.1556186534359; Thu, 25 Apr 2019 03:02:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556186534; cv=none; d=google.com; s=arc-20160816; b=HP9/NIH+2SObwdtphzySqan64CtGa55gedNYXTDJpP9mq4IZcRt0+NzRGTUgQkoSt7 30h4PPIoEFfcIfsI/WBd7XVSNNw6OwO65fnYiwWOc269sRpHltAK+eUvtLz97iOCAAqr hW5gObVjRBPOk8cvFSN7yEQifw591AJxbHrLjeVzUSa8mQSIWHPTwyagJ27lhIqBLAPd 9BLS6ajOGAF52DUBLXwEHJ/bvt5Z7gVaE5ytrrNYzrh4WRgVDsG8a390WpQ6DB6a5ZEs PuELA6/XLrLF1xepWBClmO/W8D8I6lkSgPnbPNU65UAH0ISWIa2xbTtUkdKyonEAnsX2 o1aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject:dkim-signature; bh=kB/xsYXQ3pDchMWCMlizuJaQAcde2gxIfDs80kGqcvg=; b=REaTiaSin4MLMTnjUF4el/UknGXQ+UwDqFpqF3i26qjlXg/m+HjxX/rel0nZOfLLKl fZh66MahdFw36986aJcWAdChrD5IiO2DcEhWdnlVi/JejLb0uQK4EAXBpx3lDmCtSNro av8UyNieuwWJQpww0WksUHWSN7Bx1Tmjh3WczP2VFcBkGro5vq9BLTXMfvhEAYaw5qed y6ezLtELbXYDBYOVkgTXEKy+SQQxJRjPlZxkv6+zZ+H/pZQZBinL2efRucpGMfA1RE22 MMvD6h0zR62rIw2AUCGZDQBi+eGCk6zLIwCZ4e+rFV7h67Xv3y5X4mjLp1m37JQ1ZMhu G5oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CTBInYBe; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x24si11280907pln.314.2019.04.25.03.01.57; Thu, 25 Apr 2019 03:02:14 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=CTBInYBe; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733160AbfDXTRp (ORCPT + 99 others); Wed, 24 Apr 2019 15:17:45 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:51536 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727357AbfDXTRo (ORCPT ); Wed, 24 Apr 2019 15:17:44 -0400 Received: by mail-wm1-f66.google.com with SMTP id 4so6035691wmf.1; Wed, 24 Apr 2019 12:17:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=kB/xsYXQ3pDchMWCMlizuJaQAcde2gxIfDs80kGqcvg=; b=CTBInYBeuOjwDz9xKf2KWhzfLNI5mxAnUPPI4BWhAfkSOE+IcGDVUG/LTdlVKn0Ey3 kXb11SNQiqB+f2tzvApgE3K75ekW4vp4F4rKo2tfq2976kcwUhHVdM3czRnkLPBeL6j5 fdW4sKALm8HMDXeA4HSw9r/5mjk7UzIUoGIP/nv52R1glLBQr7mNguwP52EfgA+EyV2y UwEmJLPtOAif4lWOA8h/nDGbj6w+XyJdLKMvrB4c3zYVVXyhWbkJC4hJRXUZS/KfsJKR V6GztvWZ9hBzwOPVfQYlkGM8eQYmznplt3VVqTmyEvx37Zhusc47WL3zc9FIPbwplUOL lGcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=kB/xsYXQ3pDchMWCMlizuJaQAcde2gxIfDs80kGqcvg=; b=mPMvEe1RPpdvI10lVXGGChKzE9uz/wwMshyKA3OTItk+CQwrJIlXzfsxk1DWK62IHo ujMU2kFhMhozFDP3ECLB3McXpfVR8lhI7iGbecI9VCw/ASJbnawmGQftEq0KU1cPfoFS WyLxSVCrHu9FoMkuMGg9J8ImFeL69+x2qra9P4LtCFvVIGzuFcFfniQWrEM5/5krXp6r xybAnSZFHwTuy5ai4VBVPsQaplqRst7iuTkDYClWpljNu7AKRko6ulm9MQJlhSPZ6uhs UzYzpzxW5+FDQRhVEL5Kd/ZObHW3HZoaG76Nls+2Hl4N10IxKakDdO9NpMvI0Toz54IB mgOw== X-Gm-Message-State: APjAAAUacWiwai63TNH9NH198QDqo4tO+Y0GB5KmGTxxCMlr9NpcwrZg ozmJmqsito5xqXTy8QPJBa3YZ7c9IF1qKw== X-Received: by 2002:a1c:2087:: with SMTP id g129mr517222wmg.114.1556133461454; Wed, 24 Apr 2019 12:17:41 -0700 (PDT) Received: from ?IPv6:2003:ea:8bd4:5700:c498:ee8f:ff0a:13e5? (p200300EA8BD45700C498EE8FFF0A13E5.dip0.t-ipconnect.de. [2003:ea:8bd4:5700:c498:ee8f:ff0a:13e5]) by smtp.googlemail.com with ESMTPSA id x192sm30686484wmf.48.2019.04.24.12.17.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Apr 2019 12:17:40 -0700 (PDT) Subject: [PATCH v2 2/9] PCI: use helper pci_dev_id From: Heiner Kallweit To: Benjamin Herrenschmidt , Michael Ellerman , Oded Gabbay , Alex Deucher , =?UTF-8?Q?Christian_K=c3=b6nig?= , "David (ChunMing) Zhou" , David Airlie , Daniel Vetter , Joerg Roedel , David Woodhouse , Realtek linux nic maintainers , "David S. Miller" , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Bjorn Helgaas , Benson Leung , Enric Balletbo i Serra , Stephen Rothwell , Paul Mackerras Cc: open list , "open list:AMD KFD" , "open list:RADEON and AMDGPU DRM DRIVERS" , "open list:AMD IOMMU (AMD-VI)" , "open list:8169 10/100/1000 GIGABIT ETHERNET DRIVER" , "moderated list:ARM/STM32 ARCHITECTURE" , "moderated list:ARM/STM32 ARCHITECTURE" , "open list:PCI SUBSYSTEM" References: <2e1f9a57-6d08-d017-24da-3e6b97fa2449@gmail.com> Message-ID: <9cc03738-f664-3896-d8eb-48146772a655@gmail.com> Date: Wed, 24 Apr 2019 21:12:45 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <2e1f9a57-6d08-d017-24da-3e6b97fa2449@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use new helper pci_dev_id() to simplify the code. Signed-off-by: Heiner Kallweit --- drivers/pci/msi.c | 6 +++--- drivers/pci/search.c | 10 +++------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 73986825d..e039b740f 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -1338,7 +1338,7 @@ irq_hw_number_t pci_msi_domain_calc_hwirq(struct pci_dev *dev, struct msi_desc *desc) { return (irq_hw_number_t)desc->msi_attrib.entry_nr | - PCI_DEVID(dev->bus->number, dev->devfn) << 11 | + pci_dev_id(dev) << 11 | (pci_domain_nr(dev->bus) & 0xFFFFFFFF) << 27; } @@ -1508,7 +1508,7 @@ static int get_msi_id_cb(struct pci_dev *pdev, u16 alias, void *data) u32 pci_msi_domain_get_msi_rid(struct irq_domain *domain, struct pci_dev *pdev) { struct device_node *of_node; - u32 rid = PCI_DEVID(pdev->bus->number, pdev->devfn); + u32 rid = pci_dev_id(pdev); pci_for_each_dma_alias(pdev, get_msi_id_cb, &rid); @@ -1531,7 +1531,7 @@ u32 pci_msi_domain_get_msi_rid(struct irq_domain *domain, struct pci_dev *pdev) struct irq_domain *pci_msi_get_device_domain(struct pci_dev *pdev) { struct irq_domain *dom; - u32 rid = PCI_DEVID(pdev->bus->number, pdev->devfn); + u32 rid = pci_dev_id(pdev); pci_for_each_dma_alias(pdev, get_msi_id_cb, &rid); dom = of_msi_map_get_device_domain(&pdev->dev, rid); diff --git a/drivers/pci/search.c b/drivers/pci/search.c index 2b5f72086..5c7922612 100644 --- a/drivers/pci/search.c +++ b/drivers/pci/search.c @@ -33,7 +33,7 @@ int pci_for_each_dma_alias(struct pci_dev *pdev, struct pci_bus *bus; int ret; - ret = fn(pdev, PCI_DEVID(pdev->bus->number, pdev->devfn), data); + ret = fn(pdev, pci_dev_id(pdev), data); if (ret) return ret; @@ -88,9 +88,7 @@ int pci_for_each_dma_alias(struct pci_dev *pdev, return ret; continue; case PCI_EXP_TYPE_PCIE_BRIDGE: - ret = fn(tmp, - PCI_DEVID(tmp->bus->number, - tmp->devfn), data); + ret = fn(tmp, pci_dev_id(tmp), data); if (ret) return ret; continue; @@ -101,9 +99,7 @@ int pci_for_each_dma_alias(struct pci_dev *pdev, PCI_DEVID(tmp->subordinate->number, PCI_DEVFN(0, 0)), data); else - ret = fn(tmp, - PCI_DEVID(tmp->bus->number, - tmp->devfn), data); + ret = fn(tmp, pci_dev_id(tmp), data); if (ret) return ret; } -- 2.21.0