From patchwork Thu Mar 5 14:24:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Klaus Heinrich Kiwi X-Patchwork-Id: 1249605 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48YChJ1pxVz9sPK for ; Fri, 6 Mar 2020 01:25:20 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 48YChH5QHdzDqkj for ; Fri, 6 Mar 2020 01:25:19 +1100 (AEDT) X-Original-To: Skiboot@lists.ozlabs.org Delivered-To: Skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=klaus@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 48YCh271HBzDqjv for ; Fri, 6 Mar 2020 01:25:06 +1100 (AEDT) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 025ELFYd142825 for ; Thu, 5 Mar 2020 09:25:03 -0500 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 2yj4q2h0a9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 05 Mar 2020 09:25:03 -0500 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 025ENPid009022 for ; Thu, 5 Mar 2020 09:25:03 -0500 Received: from ppma01wdc.us.ibm.com (fd.55.37a9.ip4.static.sl-reverse.com [169.55.85.253]) by mx0a-001b2d01.pphosted.com with ESMTP id 2yj4q2h095-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 05 Mar 2020 09:25:02 -0500 Received: from pps.filterd (ppma01wdc.us.ibm.com [127.0.0.1]) by ppma01wdc.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 025EOpkO021647; Thu, 5 Mar 2020 14:25:01 GMT Received: from b01cxnp23032.gho.pok.ibm.com (b01cxnp23032.gho.pok.ibm.com [9.57.198.27]) by ppma01wdc.us.ibm.com with ESMTP id 2yffk6kng6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 05 Mar 2020 14:25:01 +0000 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 025EP1K853936544 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 5 Mar 2020 14:25:01 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0C1EFAC05F; Thu, 5 Mar 2020 14:25:01 +0000 (GMT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 34D4EAC05E; Thu, 5 Mar 2020 14:25:00 +0000 (GMT) Received: from klaus-virtual-ubuntu.mshome.net (unknown [9.85.148.109]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP; Thu, 5 Mar 2020 14:24:59 +0000 (GMT) From: Klaus Heinrich Kiwi To: Skiboot@lists.ozlabs.org Date: Thu, 5 Mar 2020 11:24:56 -0300 Message-Id: <20200305142456.25797-1-klaus@linux.vnet.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.572 definitions=2020-03-05_04:2020-03-05, 2020-03-05 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=1 adultscore=0 bulkscore=0 mlxscore=0 lowpriorityscore=0 phishscore=0 malwarescore=0 priorityscore=1501 spamscore=0 mlxlogscore=999 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2003050093 Subject: [Skiboot] [PATCH] core/pci.c: cleanup pci_add_loc_code() X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Minor cleanups to add clarity after commit ab1b05d2 "PCI: create optional loc-code platform callback" Signed-off-by: Klaus Heinrich Kiwi --- core/pci.c | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/core/pci.c b/core/pci.c index d211207b..cc7353be 100644 --- a/core/pci.c +++ b/core/pci.c @@ -1385,42 +1385,37 @@ void pci_std_swizzle_irq_map(struct dt_node *np, static void pci_add_loc_code(struct dt_node *np) { - struct dt_node *p = np->parent; - const char *blcode = NULL; + struct dt_node *p; + const char *lcode = NULL; - while (p) { + for (p = np->parent; p; p = p->parent) { /* prefer slot-label by default */ - blcode = dt_prop_get_def(p, "ibm,slot-label", NULL); - if (blcode) + lcode = dt_prop_get_def(p, "ibm,slot-label", NULL); + if (lcode) break; /* otherwise use the fully qualified location code */ - blcode = dt_prop_get_def(p, "ibm,slot-location-code", NULL); - if (blcode) + lcode = dt_prop_get_def(p, "ibm,slot-location-code", NULL); + if (lcode) break; - - p = p->parent; } - if (!blcode) - blcode = dt_prop_get_def(np, "ibm,slot-location-code", NULL); + if (!lcode) + lcode = dt_prop_get_def(np, "ibm,slot-location-code", NULL); - if (!blcode) { + if (!lcode) { /* Fall back to finding a ibm,loc-code */ - p = np->parent; - - while (p) { - blcode = dt_prop_get_def(p, "ibm,loc-code", NULL); - if (blcode) + for (p = np->parent; p; p = p->parent) { + lcode = dt_prop_get_def(p, "ibm,loc-code", NULL); + if (lcode) break; - p = p->parent; } } - if (!blcode) + if (!lcode) return; - dt_add_property_string(np, "ibm,loc-code", blcode); + dt_add_property_string(np, "ibm,loc-code", lcode); } static void pci_print_summary_line(struct phb *phb, struct pci_device *pd,