From patchwork Wed Nov 22 05:30:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 10069579 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 C220B6038F for ; Wed, 22 Nov 2017 05:32:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD7B929B4B for ; Wed, 22 Nov 2017 05:32:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B1B6A29B49; Wed, 22 Nov 2017 05:32:11 +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 3EBD929B4C for ; Wed, 22 Nov 2017 05:32:11 +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=Cay7B+42YzWfXhht4iiKgKCxucj6Qvv/MUKfNKWCglw=; b=Lx3wq4rxyZJVWRPQRVVJoJTgAP +Gr2dSlIdhlwbJvaJG+2BZeUDXDA8lnwGlHO0D1Kr69oK/PpQ/wdQUxvxESVJKDr2oVGmnyYN2yPJ h7p02iLfLIxCORbo4XZM0tf038YwqkljXKlGOG3TggLHg4RdQryKR78Hdrt6cv1pYRITI7/EoTPAp i5gHFL+Wyd2vUxnEcDGBn/+ajwr8Bkca7n+m7OnfRl3gMPhPFh9Su123htRHlE5fukV/gPtasNcWR YlqAoY8KJucyPBhQYHb8vc3YSw69WSZyK2/G0RnoJk1jQ2+jYpsdkzhXRCHkekeHEmleY1s/7rHkD BMyhzzOA==; 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 1eHNdq-0005xF-H8; Wed, 22 Nov 2017 05:32:10 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eHNdS-0005ST-PH for linux-arm-kernel@lists.infradead.org; Wed, 22 Nov 2017 05:31:48 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 1E44F6084E; Wed, 22 Nov 2017 05:31:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1511328689; bh=KI2f8qb8S2v3pEePk0FZs9fTUhtNHQgOoBtYHsi1TdU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JzpdXhMx1ufINyMy6TlY82wCWuY7KYdFZJcDTHguHah91gHuR54l2Fonn4XbCRQuM oSSds0O4ZwsEKFKXi6713ra/xM6wENvaRKaMemWuIsVWirTWERZykktQ9sHNdc1+Sv gY1OznCOE/Dtg6uZY3UVK7hXwVzrfDuJgbaOQ4g8= 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 E72D26079D; Wed, 22 Nov 2017 05:31:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1511328688; bh=KI2f8qb8S2v3pEePk0FZs9fTUhtNHQgOoBtYHsi1TdU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hQGZTdGwoPS6l4LVvahNPBldgOSLabgfbcp9kW50rJPZQhjo97xbbgd1BxApOMCtW iyfuHosmBnBJz3YBAaHdkCGsYq9MOov0sRkyqv+/X/42I+5Fz6ykbH/783GKezaTWN GAP69mWGPbAg/LFM6jntUml2MfX04mw0MKXiyaw0= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E72D26079D 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 02/30] powerpc/PCI: deprecate pci_get_bus_and_slot() Date: Wed, 22 Nov 2017 00:30:47 -0500 Message-Id: <1511328675-21981-3-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_213146_882248_B2BEF0E2 X-CRM114-Status: GOOD ( 11.34 ) 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: Rob Herring , Benjamin Herrenschmidt , linux-arm-msm@vger.kernel.org, open list , Sinan Kaya , Bhumika Goyal , Paul Mackerras , Tyrel Datwyler , Michael Ellerman , "open list:LINUX FOR POWERPC 32-BIT AND 64-BIT" , 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. 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 --- arch/powerpc/kernel/pci_32.c | 3 ++- arch/powerpc/platforms/powermac/feature.c | 2 +- arch/powerpc/sysdev/mv64x60_pci.c | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c index 1d817f4..85ad2f7 100644 --- a/arch/powerpc/kernel/pci_32.c +++ b/arch/powerpc/kernel/pci_32.c @@ -96,7 +96,8 @@ reg = of_get_property(node, "reg", NULL); if (!reg) continue; - dev = pci_get_bus_and_slot(pci_bus, ((reg[0] >> 8) & 0xff)); + dev = pci_get_domain_bus_and_slot(0, pci_bus, + ((reg[0] >> 8) & 0xff)); if (!dev || !dev->subordinate) { pci_dev_put(dev); continue; diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c index 9e3f39d..ed8b166 100644 --- a/arch/powerpc/platforms/powermac/feature.c +++ b/arch/powerpc/platforms/powermac/feature.c @@ -829,7 +829,7 @@ static long core99_scc_enable(struct device_node *node, long param, long value) if (value) { if (pci_device_from_OF_node(node, &pbus, &pid) == 0) - pdev = pci_get_bus_and_slot(pbus, pid); + pdev = pci_get_domain_bus_and_slot(0, pbus, pid); if (pdev == NULL) return 0; rc = pci_enable_device(pdev); diff --git a/arch/powerpc/sysdev/mv64x60_pci.c b/arch/powerpc/sysdev/mv64x60_pci.c index d52b3b8..6fe9104 100644 --- a/arch/powerpc/sysdev/mv64x60_pci.c +++ b/arch/powerpc/sysdev/mv64x60_pci.c @@ -37,7 +37,7 @@ static ssize_t mv64x60_hs_reg_read(struct file *filp, struct kobject *kobj, if (count < MV64X60_VAL_LEN_MAX) return -EINVAL; - phb = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0)); + phb = pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(0, 0)); if (!phb) return -ENODEV; pci_read_config_dword(phb, MV64X60_PCICFG_CPCI_HOTSWAP, &v); @@ -61,7 +61,7 @@ static ssize_t mv64x60_hs_reg_write(struct file *filp, struct kobject *kobj, if (sscanf(buf, "%i", &v) != 1) return -EINVAL; - phb = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0)); + phb = pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(0, 0)); if (!phb) return -ENODEV; pci_write_config_dword(phb, MV64X60_PCICFG_CPCI_HOTSWAP, v);