From patchwork Wed Apr 24 19:11:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 10916199 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2F3061805 for ; Thu, 25 Apr 2019 07:40:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 232EA28BA6 for ; Thu, 25 Apr 2019 07:40:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 173BD28BDE; Thu, 25 Apr 2019 07:40:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CB85D28BA6 for ; Thu, 25 Apr 2019 07:40:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1C2B4892BF; Thu, 25 Apr 2019 07:40:25 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1FDAD89179; Wed, 24 Apr 2019 19:17:40 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id y197so6667470wmd.0; Wed, 24 Apr 2019 12:17:40 -0700 (PDT) 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=vWfV/uLxHlKTCY8jgaOm/hsQsubaADZJKJWfjxs7Npo=; b=hwgX3KVWdM0ZUopANx12BCj2VN9CPvp0P8YA58MDnyYA0/L12uKfFpbmip//6bU1Sx BcleKvFCL7HBaZatMlsgyqCrspTtvh89UsyiBquPgX+v4rmLCmEtq85TmBqmlrGWB5Vg OiNRuxmIxf4KxIq2exnI3N/LI1VzEYUpCLHsPU1BJGpIzlHA0xZqe/g0reBMHhgns+3g hBBjnSdAP7yn2ImUW5IptxMAcaf7CKQ/m1S3In3AogxGV6Y6kfN9Y2Q3et3kxsPW0uHz TiJOJEUVuvbc08cJ4PnOnSDk+tX8NYROlXdK2WM+Zyzmmm7pfTjNNPBZgHcDhd8bTHrj 667w== X-Gm-Message-State: APjAAAW3kwT7Cf80T6AW7Q/uRDQIyCNCoYPz4OSjyQYGbu19LsCf8AWc vHM72iIdV6keO8urZodcsbw= X-Google-Smtp-Source: APXvYqy1cGZoaC1duyy6JSmEOesKryNZXcbz5ec5DLtsSEFpsU7HttVUGLgD8gDdtV6ofxfO1zXzUA== X-Received: by 2002:a05:600c:22d1:: with SMTP id 17mr449859wmg.62.1556133458836; Wed, 24 Apr 2019 12:17:38 -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 s18sm19261192wmc.41.2019.04.24.12.17.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Apr 2019 12:17:37 -0700 (PDT) Subject: [PATCH v2 1/9] PCI: add 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 References: <2e1f9a57-6d08-d017-24da-3e6b97fa2449@gmail.com> Message-ID: Date: Wed, 24 Apr 2019 21:11:58 +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-Language: en-US X-Mailman-Approved-At: Thu, 25 Apr 2019 07:40:15 +0000 X-Mailman-Original-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=vWfV/uLxHlKTCY8jgaOm/hsQsubaADZJKJWfjxs7Npo=; b=q/vVbZY/oSONQZN13xcosLByqm2O1DfMuokvB/Zs2CWi9b5hGXmvyq5jC9E3clmH+l mIkrlnMdfjyZvxDJ7sKt77zegqGhpIuSqQ+loZavowwQos0CAq4G8VuC2WsyZSU4w9eS FEpVZEGh+2MtbxAPoEBXG807GvXT+LbvdPixqZwaMbJnTUMyKK9cG9RgV7pugAkrGx0+ VlDqc1JKTGsHMFI/rNNYUesCgEfddgmbZ68Cmkgj3BJX0xcTRbEbCbMwco6Yc1n7sbDy tm3SLEuQ1Aojh+7gfxXY3GPDcxlsHmodwHLzy1agZwERBblJjhvLLUlBgvN1AxNgjjzB +NYQ== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "open list:8169 10/100/1000 GIGABIT ETHERNET DRIVER" , open list , "open list:RADEON and AMDGPU DRM DRIVERS" , "open list:AMD IOMMU \(AMD-VI\)" , "open list:AMD KFD" , "open list:PCI SUBSYSTEM" , "moderated list:ARM/STM32 ARCHITECTURE" , "moderated list:ARM/STM32 ARCHITECTURE" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP In several places in the kernel we find PCI_DEVID used like this: PCI_DEVID(dev->bus->number, dev->devfn) Therefore create a helper for it. Signed-off-by: Heiner Kallweit --- include/linux/pci.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/pci.h b/include/linux/pci.h index 2c056a7a7..28d0313a3 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -598,6 +598,11 @@ struct pci_bus { #define to_pci_bus(n) container_of(n, struct pci_bus, dev) +static inline u16 pci_dev_id(struct pci_dev *dev) +{ + return PCI_DEVID(dev->bus->number, dev->devfn); +} + /* * Returns true if the PCI bus is root (behind host-PCI bridge), * false otherwise