From patchwork Tue Jul 25 21:44:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 108713 Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp91320obm; Tue, 25 Jul 2017 14:44:47 -0700 (PDT) X-Received: by 10.99.175.1 with SMTP id w1mr20672842pge.390.1501019085182; Tue, 25 Jul 2017 14:44:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501019085; cv=none; d=google.com; s=arc-20160816; b=EegzQcA8w8ql49F/QtdMQkrHhyPU6ReKIy8lhB34sqCKr/fUWwtsffMDxcZY5izC/U FVe+yXb1oNQrOiUp1y4OcXMNh6HKhF554P+ufeoGETiByD8WWK1CXKmE1vGFuQ6KPvYu b5S0ZBkGCeiCmKV3K6PB4kGzA4V3U4Jwd/gxV6VN6TmREGoFKNILhfPIQ3Fp4Mm4SJsl gW2r+D6ucw4c/ONUH5FvAoY3MeKTsJ9d0SWwRY4LonI/sD/mUhmdBe2p1cIPZMlmhdrr 1w4jbH7MfHckSbvm9Loz0zv3IoD+aXfTMG+/6On2FhTo4RUtIxgxoq8ljFrKTWPlp6D5 6u3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=QhR+ZMBIdCXrBDeDeJ8kWa4i8ITHWt9ubpz+hGdBkVA=; b=K5SsW4TdhB9YA/uAxJZ/6F7R88/fuQco5diDaI3Djua0Bd1XndeS2MKVQzmxsAATVU Yuk/oC+G/P9V9n1i/T1FcpTMsnph9IvvIUQ/IrtFYJHFOkFawfxiUU431tzJapninPgi JLzGkuKrl8samluxK+4zex+qjoPrF1Q6PFUkrfVuDO8dV055xDTB/0wTOodIgSq/ftDq XB6SCxyWprvIJhIBPYKim76IW9Pfk/3QzX6MgaG+BoIL8+gQ28Jc4ctNUIe2u6OkTts8 ANHUfvWTlQnCEThIPR6PaCp87DN1pNotold90nUAQh0GWvkPo5oK5RDn1oRzJ4KhwWbx CA+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v9si8856492pge.252.2017.07.25.14.44.44; Tue, 25 Jul 2017 14:44:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751592AbdGYVoj (ORCPT + 26 others); Tue, 25 Jul 2017 17:44:39 -0400 Received: from mail-yw0-f193.google.com ([209.85.161.193]:35365 "EHLO mail-yw0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750974AbdGYVog (ORCPT ); Tue, 25 Jul 2017 17:44:36 -0400 Received: by mail-yw0-f193.google.com with SMTP id l82so4120183ywc.2; Tue, 25 Jul 2017 14:44:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QhR+ZMBIdCXrBDeDeJ8kWa4i8ITHWt9ubpz+hGdBkVA=; b=HnvlkKjVCEjK99NgSdFJjoEFK0faD8Y7dJWjnNGvm0IlCfEL5cnd6oJuKlwTZb8GaQ ES5Uu9qJkbOi4C36ITJvRH3tSQdNLlfddVh4iBXSWsH9Cu07I/btpU43ryWmGpIbc32M PjThzoMeXlBc+87n3raq4xiHxGdygaz/n0SgWGw7sUHIazlOC5TixjTPuMZW7lCac0S6 H5WSUuvH29VGDAPGzdmUfkMSysXfcaIZzLKpdRP9PzViyI/0FVddINrNr0u20worwHoP yMm3fVns8r0Ke0TzvR9fahBh7kL4uJ92a7qq3HXWGxYkuaFdXOrC3VEfmi1xp3hacwwW dJ4g== X-Gm-Message-State: AIVw112PJgPGyTo06EhlmqNY5yf0bDubhhAeT73B4vceifSwcJpAfHs2 /o5kL5Cz3MOGRijcgPU= X-Received: by 10.13.246.199 with SMTP id g190mr9798057ywf.175.1501019075760; Tue, 25 Jul 2017 14:44:35 -0700 (PDT) Received: from localhost.localdomain (24-223-123-72.static.usa-companies.net. [24.223.123.72]) by smtp.googlemail.com with ESMTPSA id 204sm2386383ywx.35.2017.07.25.14.44.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Jul 2017 14:44:35 -0700 (PDT) From: Rob Herring To: devicetree@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, Frank Rowand , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Subject: [PATCH 1/4] powerpc: pseries: vio: match parent nodes with of_find_node_by_path Date: Tue, 25 Jul 2017 16:44:24 -0500 Message-Id: <20170725214427.25768-2-robh@kernel.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170725214427.25768-1-robh@kernel.org> References: <20170725214427.25768-1-robh@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In preparation to remove the full path from device_node.full_name, use of_find_node_by_path instead of open coding with strcmp. Signed-off-by: Rob Herring Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: linuxppc-dev@lists.ozlabs.org --- arch/powerpc/platforms/pseries/vio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.11.0 diff --git a/arch/powerpc/platforms/pseries/vio.c b/arch/powerpc/platforms/pseries/vio.c index 3201feb6d32b..28a9505e4919 100644 --- a/arch/powerpc/platforms/pseries/vio.c +++ b/arch/powerpc/platforms/pseries/vio.c @@ -1357,9 +1357,9 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node) */ parent_node = of_get_parent(of_node); if (parent_node) { - if (!strcmp(parent_node->full_name, "ibm,platform-facilities")) + if (parent_node == of_find_node_by_path("/ibm,platform-facilities")) family = PFO; - else if (!strcmp(parent_node->full_name, "vdevice")) + else if (parent_node == of_find_node_by_path("/vdevice")) family = VDEVICE; else { pr_warn("%s: parent(%pOF) of %s not recognized.\n", From patchwork Tue Jul 25 21:44:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 108716 Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp92455obm; Tue, 25 Jul 2017 14:46:15 -0700 (PDT) X-Received: by 10.84.128.46 with SMTP id 43mr23463624pla.113.1501019145186; Tue, 25 Jul 2017 14:45:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501019145; cv=none; d=google.com; s=arc-20160816; b=h2tvH7qtkICXDFuoW19Jsq/SBcwkyv1GEwgxA+g5xRtwN0m6qQi35kXlbqBdZdC6vG BBbgrv1CBguIg1SVCMLVzMwXur0V2jvJSj1cX/QX6TpMLAXatiLjnuStpjxKt4oC6rgE dkuTI8zuRz2K3sNAJ6pBgyvtRrZjBwyb/lqyqp5S5gHlduJ0dv6ud3AFkBB9zIOXE1Go RKZD9z8NO6P4n5bCFxNf+div1t8V/QhKgEAKSel+sdT2GPub6QDMtz4MG7DW7Q0RDqWg STD7x/neaYkHCkh7idjzn7d4su5rWmNwS6m5gYzu5OUu0UkYtLkltvNv2/KPZN45nV7o 35KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=1KzvnSGPYvbqL2EEh/Uc/rZaxNxoRokk/OdZxBkHQss=; b=KIWrKQsvNbzfTbFrNuY24jRvPEqH/XUYXOc81xI453GPfobNqANTIW+Na+iZE6XGzK SCrWCKUikQgmVDDUw/1veGPGr9ed9xvZ+WtP+w9nK2KEfLrJuGeBxoQYrcPAvt2eKsed FVw4RnX0ufsbTfRQdcOPd/PlJvvbteQS65a0EabCcWHV+zQ0h5oMuZCiCJ1rYS9mxHqh rxB4PVUrB0Xnpz9x2GLRUBnGcTLoezed1zmgO6+VIsiZmP+71FlL1IvXZaAPK8yJr04c a53NEUdPLM8VAN3eZVEZCBSMAzNloNoBt4RtVshJ7chJTc+yiU+E8m6aKSLxACUAdR6T 9L7g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z12si3603619pgo.33.2017.07.25.14.45.42; Tue, 25 Jul 2017 14:45:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751821AbdGYVpj (ORCPT + 26 others); Tue, 25 Jul 2017 17:45:39 -0400 Received: from mail-yw0-f193.google.com ([209.85.161.193]:36189 "EHLO mail-yw0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751501AbdGYVoi (ORCPT ); Tue, 25 Jul 2017 17:44:38 -0400 Received: by mail-yw0-f193.google.com with SMTP id i6so4374551ywb.3; Tue, 25 Jul 2017 14:44:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1KzvnSGPYvbqL2EEh/Uc/rZaxNxoRokk/OdZxBkHQss=; b=tgXBn+Rlwqfn/JqL2+OQBMZBcueriYrvVcJGMp4DKWQ0euQyPwIWqaNUKSoEwIqWxh ufrTyetZSyouQ5I4BR1U2ZsweGyJPV1PLOEVwdoPULbBB326opGNZtMcfzfn1uoTI3kR biFd87tuCnfT7ln9NKaMMl1ernlJf0b8yu7tkqvEZrFRuAyKvgS94Jcq8j/ka9UIaD7+ 7DIPKOUDHCaFRxi23HTe7BpO62m7wdnwZTu4xoASSxH8n5khQcHLYmTeJWfxTrZoxDIz cAROSvVEv1YeOtF94GdoNnzrk9apMS/OhIrukSG6B8M9gAdgM0g1w5kAN4i6zCGD0OGG rrAw== X-Gm-Message-State: AIVw113oaj76QxHcOZTjuZiwW3s/jDq/v8QoW7DyUFrAJ+32YdMwtrD2 eYXQIfRvmpJHWSQ2LEY= X-Received: by 10.129.79.210 with SMTP id d201mr17023736ywb.467.1501019077677; Tue, 25 Jul 2017 14:44:37 -0700 (PDT) Received: from localhost.localdomain (24-223-123-72.static.usa-companies.net. [24.223.123.72]) by smtp.googlemail.com with ESMTPSA id 204sm2386383ywx.35.2017.07.25.14.44.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Jul 2017 14:44:37 -0700 (PDT) From: Rob Herring To: devicetree@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, Frank Rowand , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Subject: [PATCH 2/4] powerpc: pseries: remove dlpar_attach_node dependency on full path Date: Tue, 25 Jul 2017 16:44:25 -0500 Message-Id: <20170725214427.25768-3-robh@kernel.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170725214427.25768-1-robh@kernel.org> References: <20170725214427.25768-1-robh@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In preparation to stop storing the full node path in full_name, remove the dependency on full_name from dlpar_attach_node(). Callers of dlpar_attach_node() already have the parent device_node, so just pass the parent node into dlpar_attach_node instead of the path. This avoids doing a lookup of the parent node by the path. Signed-off-by: Rob Herring Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: linuxppc-dev@lists.ozlabs.org --- arch/powerpc/platforms/pseries/dlpar.c | 6 ++---- arch/powerpc/platforms/pseries/hotplug-cpu.c | 2 +- arch/powerpc/platforms/pseries/mobility.c | 2 +- arch/powerpc/platforms/pseries/pseries.h | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) -- 2.11.0 diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c index 80b84c9c8509..783f36364690 100644 --- a/arch/powerpc/platforms/pseries/dlpar.c +++ b/arch/powerpc/platforms/pseries/dlpar.c @@ -254,13 +254,11 @@ struct device_node *dlpar_configure_connector(__be32 drc_index, return first_dn; } -int dlpar_attach_node(struct device_node *dn) +int dlpar_attach_node(struct device_node *dn, struct device_node *parent) { int rc; - dn->parent = pseries_of_derive_parent(dn->full_name); - if (IS_ERR(dn->parent)) - return PTR_ERR(dn->parent); + dn->parent = parent; rc = of_attach_node(dn); if (rc) { diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c index 0a93093fbcef..b357f1ae0b0a 100644 --- a/arch/powerpc/platforms/pseries/hotplug-cpu.c +++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c @@ -463,7 +463,7 @@ static ssize_t dlpar_cpu_add(u32 drc_index) return -EINVAL; } - rc = dlpar_attach_node(dn); + rc = dlpar_attach_node(dn, parent); if (rc) { saved_rc = rc; pr_warn("Failed to attach node %s, rc: %d, drc index: %x\n", diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c index 2da4851eff99..210ce632d63e 100644 --- a/arch/powerpc/platforms/pseries/mobility.c +++ b/arch/powerpc/platforms/pseries/mobility.c @@ -229,7 +229,7 @@ static int add_dt_node(__be32 parent_phandle, __be32 drc_index) if (!dn) return -ENOENT; - rc = dlpar_attach_node(dn); + rc = dlpar_attach_node(dn, parent_dn); if (rc) dlpar_free_cc_nodes(dn); diff --git a/arch/powerpc/platforms/pseries/pseries.h b/arch/powerpc/platforms/pseries/pseries.h index 1361a9db534b..4470a3194311 100644 --- a/arch/powerpc/platforms/pseries/pseries.h +++ b/arch/powerpc/platforms/pseries/pseries.h @@ -46,7 +46,7 @@ extern void dlpar_free_cc_nodes(struct device_node *); extern void dlpar_free_cc_property(struct property *); extern struct device_node *dlpar_configure_connector(__be32, struct device_node *); -extern int dlpar_attach_node(struct device_node *); +extern int dlpar_attach_node(struct device_node *, struct device_node *); extern int dlpar_detach_node(struct device_node *); extern int dlpar_acquire_drc(u32 drc_index); extern int dlpar_release_drc(u32 drc_index); From patchwork Tue Jul 25 21:44:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 108714 Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp91479obm; Tue, 25 Jul 2017 14:44:59 -0700 (PDT) X-Received: by 10.99.3.198 with SMTP id 189mr19268842pgd.49.1501019099899; Tue, 25 Jul 2017 14:44:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501019099; cv=none; d=google.com; s=arc-20160816; b=0Cb6FJnf3dm3j9nMpSL2cy2kHlESuTPIw/A1T67JHLXMGKbMdATsh3nr+rRAui9eO4 1WnDvFXbZxAJOuGtbWG+y25knptExaUz5Oz5f+DxDm6CsXpveHA0kyheJeiBatVYMt9x VtWviTpPR0IdMxFiLGlUzcGhMp2d8DODZPqgVk3WL1+3LgdfbSYq7z75XCOk87T/xIe5 lcTwTyK0etnjZvh/FmeigiM5dKGAt2rPh7oVw+L592k60+TJMd3KOwX4X6xKQKmS/P/U 7EpS0+YLE18dA4eIEeiUMdEl2iPtkVbOuFGyfcGK/gxfmgy0ulxIFBqHGIA5Su3kebU/ +MAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=BqhfycaKF9SPab3bheBzng4f7afjpmRuZgcFkBpJ/Zg=; b=hcE3irQm45rftj5H3v4QcYVelnlB4zYa72mgt+oVWqpmm5RJ4BKbBvXhYEy7UHLhTn DtrwrHKpuDBiA8cnNxYIxLnPrB+ya3J/XeR+cWqVHm+GGlapn+hudS3XcQ167byhZLPJ Vo9Xtk/jFzXgz54cvhj9rcsyPickg7oMu+4Gr6Ki9qZ2wCucW3lYq+qlDx9tHfOcQzx4 Cf1Wz3e7reiAmsRn0e8KNAUZeVKS6ofIsdtlvqRg3wAmJOuj0EvjAnu/B0v5F6nC/qZO tdA8Sjs4XCV0sxZ12g1ADNwezjz4X4A6gXgzgWu+YkoO7T1IEU6cffF9Lnac7BJlh0HH B7NQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l24si8453132pgu.76.2017.07.25.14.44.59; Tue, 25 Jul 2017 14:44:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751626AbdGYVon (ORCPT + 26 others); Tue, 25 Jul 2017 17:44:43 -0400 Received: from mail-yw0-f196.google.com ([209.85.161.196]:35369 "EHLO mail-yw0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750974AbdGYVok (ORCPT ); Tue, 25 Jul 2017 17:44:40 -0400 Received: by mail-yw0-f196.google.com with SMTP id l82so4120227ywc.2; Tue, 25 Jul 2017 14:44:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BqhfycaKF9SPab3bheBzng4f7afjpmRuZgcFkBpJ/Zg=; b=ba/iOwdZ63b5naNK4MLGHW5jFWnj9XN0dV0id4DQ2+FcFvNuZhA1sPzSbBVPgCLlDI IhdMkTM0iGeRMqW0Wg8W7zFm1u9r748DFlXG9pG+jo7ZvxQ4+E1KVtJgUD/RxAhOJw2Z QEWmg2DslCIThFmkjwi6kwBcH6E+GAC56NqCVYDgGZZwW/7sRi+sXNgdDgrioTgyweqU Pu1c1fFH/+99WRpIq23XorqrKYzytscLbwSHPSQOLi6IgEKjQghr1u3tAH1xk4c4YR83 tM2Tskkd/TgIQBYrmhjEkvvUPqlYyKuis2azvKiOIarViOxuxtzElH/BpuRf9dwG52gO P8Bw== X-Gm-Message-State: AIVw111ABJKndXK7XhyQOKdmd26yi9FLoI5zwIARuNfWM/4yuyUMqkSw CpbvgBuSWJCJbpd3VvY= X-Received: by 10.129.78.137 with SMTP id c131mr17304362ywb.464.1501019079433; Tue, 25 Jul 2017 14:44:39 -0700 (PDT) Received: from localhost.localdomain (24-223-123-72.static.usa-companies.net. [24.223.123.72]) by smtp.googlemail.com with ESMTPSA id 204sm2386383ywx.35.2017.07.25.14.44.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Jul 2017 14:44:38 -0700 (PDT) From: Rob Herring To: devicetree@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, Frank Rowand , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Subject: [PATCH 3/4] powerpc: pseries: only store the device node basename in full_name Date: Tue, 25 Jul 2017 16:44:26 -0500 Message-Id: <20170725214427.25768-4-robh@kernel.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170725214427.25768-1-robh@kernel.org> References: <20170725214427.25768-1-robh@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With dependencies on full_name containing the entire device node path removed, stop storing the full_name in nodes created by dlpar_configure_connector() and pSeries_reconfig_add_node(). Signed-off-by: Rob Herring Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: linuxppc-dev@lists.ozlabs.org --- arch/powerpc/platforms/pseries/dlpar.c | 20 ++++---------------- arch/powerpc/platforms/pseries/reconfig.c | 2 +- 2 files changed, 5 insertions(+), 17 deletions(-) -- 2.11.0 diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c index 783f36364690..8ab0be0706fd 100644 --- a/arch/powerpc/platforms/pseries/dlpar.c +++ b/arch/powerpc/platforms/pseries/dlpar.c @@ -75,24 +75,17 @@ static struct property *dlpar_parse_cc_property(struct cc_workarea *ccwa) return prop; } -static struct device_node *dlpar_parse_cc_node(struct cc_workarea *ccwa, - const char *path) +static struct device_node *dlpar_parse_cc_node(struct cc_workarea *ccwa) { struct device_node *dn; char *name; - /* If parent node path is "/" advance path to NULL terminator to - * prevent double leading slashs in full_name. - */ - if (!path[1]) - path++; - dn = kzalloc(sizeof(*dn), GFP_KERNEL); if (!dn) return NULL; name = (char *)ccwa + be32_to_cpu(ccwa->name_offset); - dn->full_name = kasprintf(GFP_KERNEL, "%s/%s", path, name); + dn->full_name = kasprintf(GFP_KERNEL, "%s", name); if (!dn->full_name) { kfree(dn); return NULL; @@ -148,7 +141,6 @@ struct device_node *dlpar_configure_connector(__be32 drc_index, struct property *last_property = NULL; struct cc_workarea *ccwa; char *data_buf; - const char *parent_path = parent->full_name; int cc_token; int rc = -1; @@ -182,7 +174,7 @@ struct device_node *dlpar_configure_connector(__be32 drc_index, break; case NEXT_SIBLING: - dn = dlpar_parse_cc_node(ccwa, parent_path); + dn = dlpar_parse_cc_node(ccwa); if (!dn) goto cc_error; @@ -192,10 +184,7 @@ struct device_node *dlpar_configure_connector(__be32 drc_index, break; case NEXT_CHILD: - if (first_dn) - parent_path = last_dn->full_name; - - dn = dlpar_parse_cc_node(ccwa, parent_path); + dn = dlpar_parse_cc_node(ccwa); if (!dn) goto cc_error; @@ -226,7 +215,6 @@ struct device_node *dlpar_configure_connector(__be32 drc_index, case PREV_PARENT: last_dn = last_dn->parent; - parent_path = last_dn->parent->full_name; break; case CALL_AGAIN: diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c index e5bf1e84047f..73e4063ad997 100644 --- a/arch/powerpc/platforms/pseries/reconfig.c +++ b/arch/powerpc/platforms/pseries/reconfig.c @@ -33,7 +33,7 @@ static int pSeries_reconfig_add_node(const char *path, struct property *proplist if (!np) goto out_err; - np->full_name = kstrdup(path, GFP_KERNEL); + np->full_name = kstrdup(kbasename(path), GFP_KERNEL); if (!np->full_name) goto out_err; From patchwork Tue Jul 25 21:44:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 108715 Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp91689obm; Tue, 25 Jul 2017 14:45:17 -0700 (PDT) X-Received: by 10.99.111.131 with SMTP id k125mr3008786pgc.8.1501019116899; Tue, 25 Jul 2017 14:45:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501019116; cv=none; d=google.com; s=arc-20160816; b=ZBKQy4UTVzaCPQHgHYACss+PrxgzzLbiskLwDMr9M2I79EPb4djhm1BkKKWaj5F3zN uYtsGu/GQwcGF42dOgwpIX9lcTj5ZvO/gJMOmUkqSDjVbyf0lgWwA7Xrut1WaJk6oQGJ UC1pcCWgpz1nn3DAp8zoAks0etyfDRLQ9GhflGUQRx8ITptlqXMMX+eTxA51t0wLSIxU 1H41IIOgJLtvGymVSqPY4KwOv5xSvY4CI3y5HeK+Ou9bzXa0glX2DTBV4ZNJBhLRD88O N5PxJFHCxtEqE5XFJwpAsFHfd0jqee0U4ozVqz7OTiqy0+NgULmdSBJ70VKUpTQouNPu ynVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=Y+KNQmzd4TESkuDDD54Qn98tMFXL87R0JaO/X1yWMb8=; b=u4wffMQvLVtDtAAev0zJjytIODSoD2KQuJUbR1IMKzTCw+Fr4ELbE1TdKh/rudI04e l97p2rzDjApn0Htgglka/PmxtYjHveb+AMLmrML9lCQRumo7cljz7CTlpS2OOlVR5a0N 9dB+3jsV/3bVDc2+j2ZyRYowaIbgBi+QZ8yUfv/VLWv14Dcg8IegFx5S83FArYdz687N dckjclRE0KjCVOPEnZZ//AS5OJjMQQUkQ0hqNz0relkDlPm1FXA8O/6PvSHosPwsw/29 STeMBuTH2+Oj7I8NVIqnLwBnUFU9uvKjjD/L4f6HzrTDjPRZeYQpC9T9r9L91eGlsHr5 FWVg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i78si8573658pfk.198.2017.07.25.14.45.16; Tue, 25 Jul 2017 14:45:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751726AbdGYVpO (ORCPT + 26 others); Tue, 25 Jul 2017 17:45:14 -0400 Received: from mail-yw0-f195.google.com ([209.85.161.195]:34434 "EHLO mail-yw0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751595AbdGYVom (ORCPT ); Tue, 25 Jul 2017 17:44:42 -0400 Received: by mail-yw0-f195.google.com with SMTP id t139so1398269ywg.1; Tue, 25 Jul 2017 14:44:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Y+KNQmzd4TESkuDDD54Qn98tMFXL87R0JaO/X1yWMb8=; b=EWzHo2OBzRAtMly6OyDOShChfmhylt0nOQZKI4GAETbUpriPTmuMae80jau4a2sCEe MmqOReKrh4DQsKG41jJX8PdPrKOSbQOCRe4yyA1dgyD4kcNQr3dLWIjX5Nh191KKH/Zy cDxlXgTm0XkY//4+qm4EHxP1KQUI/3p4HQ01peYwd3s9MLZKWwMW7AfqbqzUAY3Nrrwu pP5KKNfQOJGLwnXUsF7Dj+6qR0DMETKp0ROqlbbXF0uc39rQYQr8H1+nqMllu8fgQDyC 7RfzyHLdduE6jff1yqlBSBepS59ThpeXRx9zulN4YiAyGVnAr1MRYbgvRstZGyWqtl+A 04Lg== X-Gm-Message-State: AIVw113oyUNuRmgJlEwRzpzPkmkUDZ0gFT/RgZY0kq88eiHCL/GKbC+v LBAJL8XOPRYQysMGbTs= X-Received: by 10.13.246.65 with SMTP id g62mr18611556ywf.205.1501019081425; Tue, 25 Jul 2017 14:44:41 -0700 (PDT) Received: from localhost.localdomain (24-223-123-72.static.usa-companies.net. [24.223.123.72]) by smtp.googlemail.com with ESMTPSA id 204sm2386383ywx.35.2017.07.25.14.44.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Jul 2017 14:44:40 -0700 (PDT) From: Rob Herring To: devicetree@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, Frank Rowand , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Subject: [PATCH 4/4] of/fdt: only store the device node basename in full_name Date: Tue, 25 Jul 2017 16:44:27 -0500 Message-Id: <20170725214427.25768-5-robh@kernel.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170725214427.25768-1-robh@kernel.org> References: <20170725214427.25768-1-robh@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With dependencies on a statically allocated full path name converted to use %pOF format specifier, we can store just the basename of node, and the unflattening of the FDT can be simplified. This commit will affect the remaining users of full_name. After analyzing these users, the remaining cases should only change some print messages. The main users of full_name are providing a name for struct resource. The resource names shouldn't be important other than providing /proc/iomem names. We no longer distinguish between pre and post 0x10 dtb formats as either a full path or basename will work. However, less than 0x10 formats have been broken since the conversion to use libfdt (and no one has cared). The conversion of the unflattening code to be non-recursive also broke pre 0x10 formats as the populate_node function would return 0 in that case. Signed-off-by: Rob Herring --- drivers/of/fdt.c | 69 +++++++++----------------------------------------------- 1 file changed, 11 insertions(+), 58 deletions(-) -- 2.11.0 diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index ce30c9a588a4..27c535af0be8 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -266,74 +266,32 @@ static void populate_properties(const void *blob, *pprev = NULL; } -static unsigned int populate_node(const void *blob, - int offset, - void **mem, - struct device_node *dad, - unsigned int fpsize, - struct device_node **pnp, - bool dryrun) +static bool populate_node(const void *blob, + int offset, + void **mem, + struct device_node *dad, + struct device_node **pnp, + bool dryrun) { struct device_node *np; const char *pathp; unsigned int l, allocl; - int new_format = 0; pathp = fdt_get_name(blob, offset, &l); if (!pathp) { *pnp = NULL; - return 0; + return false; } allocl = ++l; - /* version 0x10 has a more compact unit name here instead of the full - * path. we accumulate the full path size using "fpsize", we'll rebuild - * it later. We detect this because the first character of the name is - * not '/'. - */ - if ((*pathp) != '/') { - new_format = 1; - if (fpsize == 0) { - /* root node: special case. fpsize accounts for path - * plus terminating zero. root node only has '/', so - * fpsize should be 2, but we want to avoid the first - * level nodes to have two '/' so we use fpsize 1 here - */ - fpsize = 1; - allocl = 2; - l = 1; - pathp = ""; - } else { - /* account for '/' and path size minus terminal 0 - * already in 'l' - */ - fpsize += l; - allocl = fpsize; - } - } - np = unflatten_dt_alloc(mem, sizeof(struct device_node) + allocl, __alignof__(struct device_node)); if (!dryrun) { char *fn; of_node_init(np); np->full_name = fn = ((char *)np) + sizeof(*np); - if (new_format) { - /* rebuild full path for new format */ - if (dad && dad->parent) { - strcpy(fn, dad->full_name); -#ifdef DEBUG - if ((strlen(fn) + l + 1) != allocl) { - pr_debug("%s: p: %d, l: %d, a: %d\n", - pathp, (int)strlen(fn), - l, allocl); - } -#endif - fn += strlen(fn); - } - *(fn++) = '/'; - } + memcpy(fn, pathp, l); if (dad != NULL) { @@ -355,7 +313,7 @@ static unsigned int populate_node(const void *blob, } *pnp = np; - return fpsize; + return true; } static void reverse_nodes(struct device_node *parent) @@ -399,7 +357,6 @@ static int unflatten_dt_nodes(const void *blob, struct device_node *root; int offset = 0, depth = 0, initial_depth = 0; #define FDT_MAX_DEPTH 64 - unsigned int fpsizes[FDT_MAX_DEPTH]; struct device_node *nps[FDT_MAX_DEPTH]; void *base = mem; bool dryrun = !base; @@ -418,7 +375,6 @@ static int unflatten_dt_nodes(const void *blob, depth = initial_depth = 1; root = dad; - fpsizes[depth] = dad ? strlen(of_node_full_name(dad)) : 0; nps[depth] = dad; for (offset = 0; @@ -427,11 +383,8 @@ static int unflatten_dt_nodes(const void *blob, if (WARN_ON_ONCE(depth >= FDT_MAX_DEPTH)) continue; - fpsizes[depth+1] = populate_node(blob, offset, &mem, - nps[depth], - fpsizes[depth], - &nps[depth+1], dryrun); - if (!fpsizes[depth+1]) + if (!populate_node(blob, offset, &mem, nps[depth], + &nps[depth+1], dryrun)) return mem - base; if (!dryrun && nodepp && !*nodepp)