From patchwork Tue Dec 19 05:37:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 10122535 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 8A596603B5 for ; Tue, 19 Dec 2017 05:57:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 78E0B28D01 for ; Tue, 19 Dec 2017 05:57:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D1FE28DE5; Tue, 19 Dec 2017 05:57:51 +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 DE87928D01 for ; Tue, 19 Dec 2017 05:57:50 +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=IY+Tmo4tm5q2d5iDeKYt/izPRkhKdNlaDwadqJc+VuE=; b=QeLLKiN48ZolAKm3iqq1eTQokQ heL9syz15A6cruhP+xEzts6xhfnudZWABD7HFzzcI/yvK3mbi5L7nS0YfBpyYpxWHXEyWpKtkU55k hMHC3EHXEVG7UiaPQPSDO2V9Pa2mFqjZBeH6lAmJNbDi5bSNXWA2BP0HQX9y1sImAl2fqr5ZXY7k1 ldyzLkP6fZvWwSjYmMvwcb9dyQTV1T571coj1gz5FpyrJ9KhKeCwJ+N4ejiCquaAgLg3+RhdrCaxf 3rbIRPTm7iGSR/es1AwM4CfQjJQHSagZD4yAPxriNhfRVitUoDtyqe4rjrrWHNvrE8JxVEYdg5E0a c/QFUJgg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eRAuR-00025O-I8; Tue, 19 Dec 2017 05:57:47 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eRAsp-00014p-Cq for linux-arm-kernel@bombadil.infradead.org; Tue, 19 Dec 2017 05:56:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=V8IZP90KCa3U2EYfDQRMKDyZxr6TcMc2zzheP8vY5KI=; b=ORMrAXsoIDyH+msiQtHRcm9/3 vegnR2AdELkspWVRFJMUunWMQLvclgS3zsFPta++IASCdAkIQW07zjXbW53F2XyMhDGUhQgCbftak RVslOvXr76Jh/pEBO5vOxNbjcvXGgORUoASMJd+Ki5jhyzNcrXDU4eXTe0oQ/o5pkwql60MbxjFQZ OIioTuj4SjK6O91LMGeh/qcktf266gl7sC6/3OXRVSVWcRUfHhF43bkQW7fiX/AFfx5Hg9A4UUjb6 S2k8vxSA/dF4LSdEt6UwH6JGf2XU/9nMsBP3P3I8MteyNW0KruJzxclPNUXMSWybJcNhSLlHGBVcZ nUmSonWFg==; Received: from smtp.codeaurora.org ([198.145.29.96]) by casper.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eRAd7-0001Nw-74 for linux-arm-kernel@lists.infradead.org; Tue, 19 Dec 2017 05:39:55 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 2A10460B3B; Tue, 19 Dec 2017 05:39:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1513661976; bh=rxaD+yOaA/5Kqp2kvcCUhSGGmnPlcnSGvRo668SJ4U4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PKIOIbvHg9L7QPm+Q5bPrZR5ZkKjsyG2x4xRO/0OPb8yhDcEipdiAUe6cQPDiAl5G +m42hdhIKJha3nWamn5mrDzVuozupWXjHh2HI3TJbDYUq0bB4XdMts3nNLAJ5UZ73y pV9aGJgUzizOmPl4iFVGzt5knRwjpULjb09pfgJk= 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 632286024A; Tue, 19 Dec 2017 05:39:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1513661975; bh=rxaD+yOaA/5Kqp2kvcCUhSGGmnPlcnSGvRo668SJ4U4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R6yIWGIi4zAZwM2dWmlvp8YRlh6Rn/bi4UweU8taVHTbwMfd2yA9olyF71rpYrwpg prI9aIS95l/3h4rM31umc8esr2QCIohFYT/frYAU4dalHLtybxidooARJDXOd0mz7K zvOWUOMO5koUGqnwgDPc0MZcji1oX7UEvHp+sO1k= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 632286024A 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 V4 23/26] video: fbdev: nvidia: deprecate pci_get_bus_and_slot() Date: Tue, 19 Dec 2017 00:37:59 -0500 Message-Id: <1513661883-28662-24-git-send-email-okaya@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1513661883-28662-1-git-send-email-okaya@codeaurora.org> References: <1513661883-28662-1-git-send-email-okaya@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171219_053953_552058_DBD8FBB3 X-CRM114-Status: GOOD ( 16.42 ) 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: "open list:NVIDIA rivafb and nvidiafb FRAMEBUFFER DRIVER" , Antonino Daplas , Bartlomiej Zolnierkiewicz , linux-arm-msm@vger.kernel.org, open list , "open list:FRAMEBUFFER LAYER" , Sinan Kaya , linux-arm-kernel@lists.infradead.org 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. Getting ready to remove pci_get_bus_and_slot() function in favor of pci_get_domain_bus_and_slot(). struct nvidia_par has a pointer to struct pci_dev. Use the pci_dev member to extract the domain information and pass it to pci_get_domain_bus_and_slot() function. Signed-off-by: Sinan Kaya Acked-by: Bartlomiej Zolnierkiewicz --- drivers/video/fbdev/nvidia/nv_hw.c | 11 ++++++----- drivers/video/fbdev/nvidia/nv_setup.c | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/video/fbdev/nvidia/nv_hw.c b/drivers/video/fbdev/nvidia/nv_hw.c index 81c80ac..8335da4 100644 --- a/drivers/video/fbdev/nvidia/nv_hw.c +++ b/drivers/video/fbdev/nvidia/nv_hw.c @@ -683,10 +683,11 @@ static void nForceUpdateArbitrationSettings(unsigned VClk, nv10_sim_state sim_data; unsigned int M, N, P, pll, MClk, NVClk, memctrl; struct pci_dev *dev; + int domain = pci_domain_nr(par->pci_dev->bus); if ((par->Chipset & 0x0FF0) == 0x01A0) { unsigned int uMClkPostDiv; - dev = pci_get_bus_and_slot(0, 3); + dev = pci_get_domain_bus_and_slot(domain, 0, 3); pci_read_config_dword(dev, 0x6C, &uMClkPostDiv); uMClkPostDiv = (uMClkPostDiv >> 8) & 0xf; @@ -694,7 +695,7 @@ static void nForceUpdateArbitrationSettings(unsigned VClk, uMClkPostDiv = 4; MClk = 400000 / uMClkPostDiv; } else { - dev = pci_get_bus_and_slot(0, 5); + dev = pci_get_domain_bus_and_slot(domain, 0, 5); pci_read_config_dword(dev, 0x4c, &MClk); MClk /= 1000; } @@ -707,13 +708,13 @@ static void nForceUpdateArbitrationSettings(unsigned VClk, sim_data.pix_bpp = (char)pixelDepth; sim_data.enable_video = 0; sim_data.enable_mp = 0; - dev = pci_get_bus_and_slot(0, 1); + dev = pci_get_domain_bus_and_slot(domain, 0, 1); pci_read_config_dword(dev, 0x7C, &sim_data.memory_type); pci_dev_put(dev); sim_data.memory_type = (sim_data.memory_type >> 12) & 1; sim_data.memory_width = 64; - dev = pci_get_bus_and_slot(0, 3); + dev = pci_get_domain_bus_and_slot(domain, 0, 3); pci_read_config_dword(dev, 0, &memctrl); pci_dev_put(dev); memctrl >>= 16; @@ -721,7 +722,7 @@ static void nForceUpdateArbitrationSettings(unsigned VClk, if ((memctrl == 0x1A9) || (memctrl == 0x1AB) || (memctrl == 0x1ED)) { u32 dimm[3]; - dev = pci_get_bus_and_slot(0, 2); + dev = pci_get_domain_bus_and_slot(domain, 0, 2); pci_read_config_dword(dev, 0x40, &dimm[0]); dimm[0] = (dimm[0] >> 8) & 0x4f; pci_read_config_dword(dev, 0x44, &dimm[1]); diff --git a/drivers/video/fbdev/nvidia/nv_setup.c b/drivers/video/fbdev/nvidia/nv_setup.c index 2f2e162..b17acd2 100644 --- a/drivers/video/fbdev/nvidia/nv_setup.c +++ b/drivers/video/fbdev/nvidia/nv_setup.c @@ -264,7 +264,8 @@ static void nv10GetConfig(struct nvidia_par *par) } #endif - dev = pci_get_bus_and_slot(0, 1); + dev = pci_get_domain_bus_and_slot(pci_domain_nr(par->pci_dev->bus), + 0, 1); if ((par->Chipset & 0xffff) == 0x01a0) { u32 amt;