From patchwork Wed Nov 22 05:30:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 10069685 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 86BCC6038F for ; Wed, 22 Nov 2017 05:36:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8132128B18 for ; Wed, 22 Nov 2017 05:36:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 76361297FE; Wed, 22 Nov 2017 05:36:35 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C5A0828B18 for ; Wed, 22 Nov 2017 05:36:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=1xe2VC2vzBzjMkNL/EyxTD7MbCqciXzEDs3ROW+OwxU=; b=qbdC8/gpuJAGMaitLSNNSjuxOb 3Qr6PsMooxPXSFvp5TP22UEhEq8FGpGYN3AvRnf+uD5RNPH6pFzvPP9/cHFM9xYFJrw5bSaNfhq40 8ZZpOGeIL02DF2BB9XC0hJkeSl5OfGP9zhss0FBZTqQ20lvgziJcMb9SIZ/N+ceONZNJVj+oQloNN XkDfLa6+qGO/N05PlN+AcAlj7R6XXvqSzHWVgQ4xKIEOjLMQkaSiV46SBS+7OllaY+yWbdgQ1JjnY 7U+JWJEjvvWF1+bIFuHwUQEEhFR8NDyg0nkeHNa7M1nMz7AGackO0znlwwibN9t1lbJ1dB110BhhJ 5ZfOXOFQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eHNi5-0002EM-0B; Wed, 22 Nov 2017 05:36:33 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eHNdw-0005mk-PT for linux-arm-kernel@lists.infradead.org; Wed, 22 Nov 2017 05:32:39 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 6F10F60A08; Wed, 22 Nov 2017 05:31:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1511328720; bh=F/f63j9lhHXV91mbCVA43TSrdOWKFJt0HoNSZjFuOZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bz1/1SXqGouoz52ltpsE10Qp5f2eS/3YZP7td2XVR/AVo1bZv0WtZSHZpTTOOXlQM UY1KtpBX/k2faye+7t72AKAUumf7bJGoUGCsnhgnyB3k5MFjqk4CzDQvjjipIhshwt a32HHRVGGDCkrsw7w4n1e5aFo5AKgFUPA0Z4CHLI= Received: from drakthul.qualcomm.com (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: okaya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 0F5D5608C6; Wed, 22 Nov 2017 05:31:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1511328714; bh=F/f63j9lhHXV91mbCVA43TSrdOWKFJt0HoNSZjFuOZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nON8klLkD82PO32DjoIQv8NxIurHoTMXwssRhsWUtf/vzY74YDyNwgvHr7v/f48UN rGNTKT3KDgHVfCLdVroZXJX0JL63YrOsuvm5kf7aHLUxcaoctLHxNWqeIjeS//HJay 2qfN79RFtJZ+XGGenCHODA3VY78f5vFm3wZR59Yc= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 0F5D5608C6 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=okaya@codeaurora.org From: Sinan Kaya To: linux-pci@vger.kernel.org, timur@codeaurora.org Subject: [PATCH 10/30] drm/nouveau: deprecate pci_get_bus_and_slot() Date: Wed, 22 Nov 2017 00:30:55 -0500 Message-Id: <1511328675-21981-11-git-send-email-okaya@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1511328675-21981-1-git-send-email-okaya@codeaurora.org> References: <1511328675-21981-1-git-send-email-okaya@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171121_213217_833979_F50B5D2D X-CRM114-Status: GOOD ( 11.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, David Airlie , linux-arm-msm@vger.kernel.org, open list , "open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS" , Sinan Kaya , Ben Skeggs , "open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS" , Ilia Mirkin MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as where a PCI device is present. This restricts the device drivers to be reused for other domain numbers. Use pci_get_domain_bus_and_slot() with a domain number of 0 where we can't extract the domain number. Other places, use the actual domain number from the device. Signed-off-by: Sinan Kaya --- drivers/gpu/drm/nouveau/dispnv04/arb.c | 3 ++- drivers/gpu/drm/nouveau/dispnv04/hw.c | 6 ++++-- drivers/gpu/drm/nouveau/nouveau_drm.c | 3 ++- drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv1a.c | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/nouveau/dispnv04/arb.c b/drivers/gpu/drm/nouveau/dispnv04/arb.c index 90075b6..729d7d0 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/arb.c +++ b/drivers/gpu/drm/nouveau/dispnv04/arb.c @@ -214,7 +214,8 @@ struct nv_sim_state { (dev->pdev->device & 0xffff) == 0x01f0 /*CHIPSET_NFORCE2*/) { uint32_t type; - pci_read_config_dword(pci_get_bus_and_slot(0, 1), 0x7c, &type); + pci_read_config_dword(pci_get_domain_bus_and_slot(0, 0, 1), + 0x7c, &type); sim_data.memory_type = (type >> 12) & 1; sim_data.memory_width = 64; diff --git a/drivers/gpu/drm/nouveau/dispnv04/hw.c b/drivers/gpu/drm/nouveau/dispnv04/hw.c index b985990..4b35093 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/hw.c +++ b/drivers/gpu/drm/nouveau/dispnv04/hw.c @@ -221,7 +221,8 @@ (dev->pdev->device & 0x0ff0) == CHIPSET_NFORCE) { uint32_t mpllP; - pci_read_config_dword(pci_get_bus_and_slot(0, 3), 0x6c, &mpllP); + pci_read_config_dword(pci_get_domain_bus_and_slot(0, 0, 3), + 0x6c, &mpllP); mpllP = (mpllP >> 8) & 0xf; if (!mpllP) mpllP = 4; @@ -232,7 +233,8 @@ (dev->pdev->device & 0xff0) == CHIPSET_NFORCE2) { uint32_t clock; - pci_read_config_dword(pci_get_bus_and_slot(0, 5), 0x4c, &clock); + pci_read_config_dword(pci_get_domain_bus_and_slot(0, 0, 5), + 0x4c, &clock); return clock / 1000; } diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 595630d..0b6c639 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -406,7 +406,8 @@ static int nouveau_drm_probe(struct pci_dev *pdev, } /* subfunction one is a hdmi audio device? */ - drm->hdmi_device = pci_get_bus_and_slot((unsigned int)pdev->bus->number, + drm->hdmi_device = pci_get_domain_bus_and_slot(pci_domain_nr(pdev->bus), + (unsigned int)pdev->bus->number, PCI_DEVFN(PCI_SLOT(pdev->devfn), 1)); if (!drm->hdmi_device) { diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv1a.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv1a.c index 3c6a871..3d2a203 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv1a.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv1a.c @@ -29,7 +29,7 @@ struct pci_dev *bridge; u32 mem, mib; - bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0, 1)); + bridge = pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(0, 1)); if (!bridge) { nvkm_error(&fb->subdev, "no bridge device\n"); return -ENODEV;