From patchwork Mon Aug 21 15:16:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring \(Arm\)" X-Patchwork-Id: 110555 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1429801qge; Mon, 21 Aug 2017 08:17:31 -0700 (PDT) X-Received: by 10.98.160.65 with SMTP id r62mr17639853pfe.65.1503328651750; Mon, 21 Aug 2017 08:17:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503328651; cv=none; d=google.com; s=arc-20160816; b=hFDFfrapfnGu9zVvvhc1peOMKISuz5g5bMrZlpn+Q737drN1aAo2GCFbJMYzYGAcRi Sma4RlT03waZuSHvWi5Bm04bEgbjJ+OrdMIcBYGbdAIuxAOiXJMviUEzgJKy7DqpsMXM WeMWQOxMdd+ztnyBx7V5rIXoa1dZRAzIhShJqnAo76BobeYYBkGpL8i7vGY/JvAaOaou j/meJ6JACl7xsgDXf5+QPZVnnGllQO+vGEJgGTwf8WT3A33M94Q3fnv1IEM+vBv9l9tM t9Oksp05NDrWQFz97sJJO36CjV5uHbPlSWpKAKE4Bkowm+J3t/f7pK5gmkz6LPnbk17p RuLg== 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=/QtgzlJ/SQk6IfyGheqrj/gnGRFN9f+WGwO/2NktLDU=; b=UbRql14lIWJuYttTc+hd2sXs99kH0Xx3PWFA7XNP9AgHFohd9t2P1QBpYchA7uo8ni KYCkff4u53/lOQ6UGwP06udEQTBKOmxdaUP5xJi+kuHE1CNuvDp4OePhQISgg3T72XHO XQR/vbvBYDuH20e56LfmbTwwMg1mvWJnqKFViPX3kDAYP6CgBJRWHjphQBNfzVhUWi0D hlFSYdS6KXsvRVTOm2Ge29xqV0jP1GunINX0qbx8vgc+0HpnUUazMi0Z3PYTXKZtsWiW uUGxqdMsA63cr+jBkszlnHgBmGCXgKaAOor2RFucJFG8nBe4wCINUiw++5lQwyzxi7fa /mIQ== 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 x4si8118815plm.263.2017.08.21.08.17.31; Mon, 21 Aug 2017 08:17:31 -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 S1754018AbdHUPR3 (ORCPT + 26 others); Mon, 21 Aug 2017 11:17:29 -0400 Received: from mail-oi0-f68.google.com ([209.85.218.68]:37209 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753856AbdHUPRB (ORCPT ); Mon, 21 Aug 2017 11:17:01 -0400 Received: by mail-oi0-f68.google.com with SMTP id k77so2259743oib.4; Mon, 21 Aug 2017 08:17:01 -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=/QtgzlJ/SQk6IfyGheqrj/gnGRFN9f+WGwO/2NktLDU=; b=CKZg7kkG/nJqK/QDtz3qv79/Linmfw8aSbTsGlM/Qf6OA+0oVNJ2np9G79C/cjuT8A JGWp36teka7kIoZh0I7awg6EtSYOFiOl9pZL4B0ProPiwPQ4xUeXP/AxTb23Cu1dEDbc hrMJISs2QUBUPn1tQta5cZkMRne8bJW+tRnq8zGyUA185G3gjcwoqGq6ZCzw4FNDyo3c 1Nnag2pfyxa0YVp8+PB5c6emDk7bi6S96M9BGKc3s9v4YymCQob73xNSqFYVPJOqtBvG l2bldFj65U1SsAsf1W2ltnf2JMWuajmToj8Ke6d6tJuPGEHKa7ad8kpujT5TCyeWPnPE nujQ== X-Gm-Message-State: AHYfb5hpW5aL2JqkYB2IjYy+9bWnEsv78Rx9YM73AtIhwGAqq7vM+s0P woiJACsmv910mscAGbk= X-Received: by 10.202.5.69 with SMTP id 66mr21013837oif.30.1503328620891; Mon, 21 Aug 2017 08:17:00 -0700 (PDT) Received: from localhost.localdomain (216-188-254-6.dyn.grandenetworks.net. [216.188.254.6]) by smtp.googlemail.com with ESMTPSA id q134sm4505638oic.51.2017.08.21.08.16.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Aug 2017 08:17:00 -0700 (PDT) From: Rob Herring To: devicetree@vger.kernel.org, Michael Ellerman , linuxppc-dev@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, Frank Rowand , Benjamin Herrenschmidt , Paul Mackerras , David Laight Subject: [PATCH v2 4/5] powerpc: pseries: only store the device node basename in full_name Date: Mon, 21 Aug 2017 10:16:50 -0500 Message-Id: <20170821151651.25096-5-robh@kernel.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170821151651.25096-1-robh@kernel.org> References: <20170821151651.25096-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 --- v2: - Rework dlpar_parse_cc_node() to a single allocation and strcpy instead of kasprintf arch/powerpc/platforms/pseries/dlpar.c | 30 +++++++----------------------- arch/powerpc/platforms/pseries/reconfig.c | 2 +- 2 files changed, 8 insertions(+), 24 deletions(-) -- 2.11.0 diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c index 783f36364690..31a0615aeea1 100644 --- a/arch/powerpc/platforms/pseries/dlpar.c +++ b/arch/powerpc/platforms/pseries/dlpar.c @@ -75,28 +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++; + const char *name = (const char *)ccwa + be32_to_cpu(ccwa->name_offset); - dn = kzalloc(sizeof(*dn), GFP_KERNEL); + dn = kzalloc(sizeof(*dn) + strlen(name) + 1, 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); - if (!dn->full_name) { - kfree(dn); - return NULL; - } + dn->full_name = (char *)(dn + 1); + strcpy((char *)dn->full_name, name); of_node_set_flag(dn, OF_DYNAMIC); of_node_init(dn); @@ -148,7 +137,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 +170,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 +180,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 +211,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 296c188fd5ca..f24d8159c9e1 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;