{"id":807087,"url":"http://patchwork.ozlabs.org/api/patches/807087/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/1504012311-37079-1-git-send-email-bryantly@linux.vnet.ibm.com/","project":{"id":2,"url":"http://patchwork.ozlabs.org/api/projects/2/?format=json","name":"Linux PPC development","link_name":"linuxppc-dev","list_id":"linuxppc-dev.lists.ozlabs.org","list_email":"linuxppc-dev@lists.ozlabs.org","web_url":"https://github.com/linuxppc/wiki/wiki","scm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git","webscm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/","list_archive_url":"https://lore.kernel.org/linuxppc-dev/","list_archive_url_format":"https://lore.kernel.org/linuxppc-dev/{}/","commit_url_format":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}"},"msgid":"<1504012311-37079-1-git-send-email-bryantly@linux.vnet.ibm.com>","list_archive_url":"https://lore.kernel.org/linuxppc-dev/1504012311-37079-1-git-send-email-bryantly@linux.vnet.ibm.com/","date":"2017-08-29T13:11:51","name":"powerpc/kernel: Change retrieval of pci_dn","commit_ref":"f9df74dfce542ad2aea2e601ef1a1281e01fad6a","pull_url":null,"state":"accepted","archived":false,"hash":"5a34c205cd2cc37b3843e5d3f920a97f3a843e2b","submitter":{"id":72247,"url":"http://patchwork.ozlabs.org/api/people/72247/?format=json","name":"Bryant G. Ly","email":"bryantly@linux.vnet.ibm.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/1504012311-37079-1-git-send-email-bryantly@linux.vnet.ibm.com/mbox/","series":[{"id":365,"url":"http://patchwork.ozlabs.org/api/series/365/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=365","date":"2017-08-29T13:11:51","name":"powerpc/kernel: Change retrieval of pci_dn","version":1,"mbox":"http://patchwork.ozlabs.org/series/365/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/807087/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/807087/checks/","tags":{},"related":[],"headers":{"Return-Path":"<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xhTbm6x3Jz9s75\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 29 Aug 2017 23:13:40 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xhTbm5kMdzDqgD\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 29 Aug 2017 23:13:40 +1000 (AEST)","from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com\n\t[148.163.158.5])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xhTYs51pszDq5b\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tTue, 29 Aug 2017 23:12:01 +1000 (AEST)","from pps.filterd (m0098416.ppops.net [127.0.0.1])\n\tby mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id\n\tv7TDAM8e115160\n\tfor <linuxppc-dev@lists.ozlabs.org>; Tue, 29 Aug 2017 09:11:59 -0400","from e32.co.us.ibm.com (e32.co.us.ibm.com [32.97.110.150])\n\tby mx0b-001b2d01.pphosted.com with ESMTP id 2cn7ncwjk5-1\n\t(version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT)\n\tfor <linuxppc-dev@lists.ozlabs.org>; Tue, 29 Aug 2017 09:11:58 -0400","from localhost\n\tby e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use\n\tOnly! Violators will be prosecuted\n\tfor <linuxppc-dev@lists.ozlabs.org> from\n\t<bryantly@linux.vnet.ibm.com>; Tue, 29 Aug 2017 07:11:58 -0600","from b03cxnp07029.gho.boulder.ibm.com (9.17.130.16)\n\tby e32.co.us.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway:\n\tAuthorized Use Only! Violators will be prosecuted; \n\tTue, 29 Aug 2017 07:11:54 -0600","from b03ledav005.gho.boulder.ibm.com\n\t(b03ledav005.gho.boulder.ibm.com [9.17.130.236])\n\tby b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with\n\tESMTP id v7TDBsKm8323570; Tue, 29 Aug 2017 06:11:54 -0700","from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id 1CDB2BE03B;\n\tTue, 29 Aug 2017 07:11:54 -0600 (MDT)","from localhost.localdomain (unknown [9.80.207.28])\n\tby b03ledav005.gho.boulder.ibm.com (Postfix) with ESMTP id 397F3BE038;\n\tTue, 29 Aug 2017 07:11:53 -0600 (MDT)"],"From":"\"Bryant G. Ly\" <bryantly@linux.vnet.ibm.com>","To":"benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au","Subject":"[PATCH] powerpc/kernel: Change retrieval of pci_dn","Date":"Tue, 29 Aug 2017 08:11:51 -0500","X-Mailer":"git-send-email 2.5.4 (Apple Git-61)","X-TM-AS-GCONF":"00","x-cbid":"17082913-0004-0000-0000-000012D7882B","X-IBM-SpamModules-Scores":"","X-IBM-SpamModules-Versions":"BY=3.00007633; HX=3.00000241; KW=3.00000007;\n\tPH=3.00000004; SC=3.00000226; SDB=6.00909253; UDB=6.00456004;\n\tIPR=6.00689538; \n\tBA=6.00005560; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009;\n\tZB=6.00000000; \n\tZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00016917;\n\tXFM=3.00000015; UTC=2017-08-29 13:11:56","X-IBM-AV-DETECTION":"SAVI=unused REMOTE=unused XFE=unused","x-cbparentid":"17082913-0005-0000-0000-000080E775F1","Message-Id":"<1504012311-37079-1-git-send-email-bryantly@linux.vnet.ibm.com>","X-Proofpoint-Virus-Version":"vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-08-29_03:, , signatures=0","X-Proofpoint-Spam-Details":"rule=outbound_notspam policy=outbound score=0\n\tspamscore=0 suspectscore=0\n\tmalwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam\n\tadjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000\n\tdefinitions=main-1708290197","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Cc":"linuxppc-dev@lists.ozlabs.org,\n\t\"Bryant G. Ly\" <bryantly@linux.vnet.ibm.com>, sam.bobroff@au1.ibm.com","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"},"content":"For a PCI device it's pci_dn can be retrieved from\npdev->dev.archdata.firmware_data, PCI_DN(devnode), or parent's list.\nThus, we should just use the existing function pci_get_pdn_by_devfn\nto get the pci_dn.\n\nSigned-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>\nReviewed-by: Sam Bobroff <sam.bobroff@au1.ibm.com>\n---\n arch/powerpc/kernel/rtas_pci.c | 33 ++++-----------------------------\n 1 file changed, 4 insertions(+), 29 deletions(-)","diff":"diff --git a/arch/powerpc/kernel/rtas_pci.c b/arch/powerpc/kernel/rtas_pci.c\nindex 73f1934..c2b148b 100644\n--- a/arch/powerpc/kernel/rtas_pci.c\n+++ b/arch/powerpc/kernel/rtas_pci.c\n@@ -91,26 +91,14 @@ static int rtas_pci_read_config(struct pci_bus *bus,\n \t\t\t\tunsigned int devfn,\n \t\t\t\tint where, int size, u32 *val)\n {\n-\tstruct device_node *busdn, *dn;\n \tstruct pci_dn *pdn;\n-\tbool found = false;\n \tint ret;\n \n-\t/* Search only direct children of the bus */\n \t*val = 0xFFFFFFFF;\n-\tbusdn = pci_bus_to_OF_node(bus);\n-\tfor (dn = busdn->child; dn; dn = dn->sibling) {\n-\t\tpdn = PCI_DN(dn);\n-\t\tif (pdn && pdn->devfn == devfn\n-\t\t    && of_device_is_available(dn)) {\n-\t\t\tfound = true;\n-\t\t\tbreak;\n-\t\t}\n-\t}\n \n-\tif (!found)\n-\t\treturn PCIBIOS_DEVICE_NOT_FOUND;\n+\tpdn = pci_get_pdn_by_devfn(bus, devfn);\n \n+\t/* Validity of pdn is checked in here */\n \tret = rtas_read_config(pdn, where, size, val);\n \tif (*val == EEH_IO_ERROR_VALUE(size) &&\n \t    eeh_dev_check_failure(pdn_to_eeh_dev(pdn)))\n@@ -153,24 +141,11 @@ static int rtas_pci_write_config(struct pci_bus *bus,\n \t\t\t\t unsigned int devfn,\n \t\t\t\t int where, int size, u32 val)\n {\n-\tstruct device_node *busdn, *dn;\n \tstruct pci_dn *pdn;\n-\tbool found = false;\n-\n-\t/* Search only direct children of the bus */\n-\tbusdn = pci_bus_to_OF_node(bus);\n-\tfor (dn = busdn->child; dn; dn = dn->sibling) {\n-\t\tpdn = PCI_DN(dn);\n-\t\tif (pdn && pdn->devfn == devfn\n-\t\t    && of_device_is_available(dn)) {\n-\t\t\tfound = true;\n-\t\t\tbreak;\n-\t\t}\n-\t}\n \n-\tif (!found)\n-\t\treturn PCIBIOS_DEVICE_NOT_FOUND;\n+\tpdn = pci_get_pdn_by_devfn(bus, devfn);\n \n+\t/* Validity of pdn is checked in here. */\n \treturn rtas_write_config(pdn, where, size, val);\n }\n \n","prefixes":[]}