From patchwork Tue Aug 28 15:52:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring \(Arm\)" X-Patchwork-Id: 145346 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp1347665ljw; Tue, 28 Aug 2018 08:53:00 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYKSh803MfJzmc1gRqOpbmTJxOAMlZ43Rm9sL9wXx8sR53dAL/Lo9LhCJCfM7fLekqGuqHg X-Received: by 2002:a17:902:49:: with SMTP id 67-v6mr2187607pla.206.1535471580377; Tue, 28 Aug 2018 08:53:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535471580; cv=none; d=google.com; s=arc-20160816; b=taM3X6z2QZahjf8OIM8+dSFGZ+ruhSETenrAzhjRPP7G+FzvnYhaeUZ8fN/Bb2623Q pNYFbypRG07GmGrZx6cl0HsE1zef3RWTNy8vWiutCgTxWWe9sch0cpx9bXCCHZ1TPrOh aHCL4nRfneOBDst2YXxXVmBZPoXSSyXFqfuM5AmLuXoautAvITZouWYhyBVhR5EUdx9Y 8WEaO/Wyy8nYyM8sdB5tx47sQU1XDF72jgin1BQFqk3/H5JI6MJto1zvthkk3hrTTZGs U3OBg2hAchXD0FDtSStWjOJIEiHkNNIiC3v9CUP3FT+m9UMTuiOo2TVj1Uq5ky0+KiNw K1iw== 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=Y1hlk2S9GwjBYVlyTE/lecEc+81ZS+U6GrCrISTwDb4=; b=yzicPdiXzWMK8BMhVlQC77XlvKEx5+i+z6cujXXr9UO6fVawnBoHSSL5wk+lnsyl8y 6DiLt0dfZf2D8xLuMq5h7aXczwKTpzZOhnKJ6yavQoLzX/R8o2RGGPxsjDmZInr4QQqi OT21xJc2u9TzCydbACTDojNJwpGbBDbnLaRQmkZR4PPNRDRrgA/8jM6SVm5hFMJ0ycWS LQF4wZWDydWYHVhmghkmFBejR7GqpFIgVdvUgsjlsbr0+fuVsCW2APimF8/U3RKU9SUP eBGTtHuRqAoUC/13IfpX0WKiwODvjtLB1K8sLYNo+5Py+J5czFDbJ/nn+65T6+seYdpA RIQw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g15-v6si1298825plo.284.2018.08.28.08.53.00; Tue, 28 Aug 2018 08:53:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-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 devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728048AbeH1TpP (ORCPT + 6 others); Tue, 28 Aug 2018 15:45:15 -0400 Received: from mail-oi0-f66.google.com ([209.85.218.66]:39649 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726383AbeH1TpO (ORCPT ); Tue, 28 Aug 2018 15:45:14 -0400 Received: by mail-oi0-f66.google.com with SMTP id c190-v6so3716122oig.6; Tue, 28 Aug 2018 08:52:58 -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=Y1hlk2S9GwjBYVlyTE/lecEc+81ZS+U6GrCrISTwDb4=; b=gxnXOyF5ONvQqSlq8i4k2URH4Ym598Q8v/P80y6EMWH8nl4Yi7RyCko65YOrKs73Qs Cdupydj9+6qfd8WRmmsKC01ZVvPZ3SeG/J2b8+zaGI/7dQm4B5zq6cL7BazXWJNYenw0 66hUM89PLq6SYzpBmXoPIyeIuV4fhi4oZUkyVo0zcmioiXpDUCfnhTg30+fXg/kurYsQ /aqSI0oMRm3bYFbzeDok2g+j94shfD2wiGPnRcnmNwE2TgUWhKuKSdGjhaGxKviiTEai jBZvPvBHRNPo3vEv6Xnpl6nzCpyrZZqZ8daoQexu6O5PqtbtJa8BmWjuceTd95TjeEBF 3TmQ== X-Gm-Message-State: APzg51Ce/A/7ZMgg+kliiLGzhKTHwcuj5JOpXB1wZSf2LVwUVkx2dgy4 rOcWy7n2ND+jS/YfsvgMnA== X-Received: by 2002:aca:fd4f:: with SMTP id b76-v6mr1810244oii.307.1535471577715; Tue, 28 Aug 2018 08:52:57 -0700 (PDT) Received: from xps15.herring.priv (24-155-109-49.dyn.grandenetworks.net. [24.155.109.49]) by smtp.googlemail.com with ESMTPSA id o68-v6sm2902294oik.56.2018.08.28.08.52.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Aug 2018 08:52:56 -0700 (PDT) From: Rob Herring To: Frank Rowand , devicetree@vger.kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 2/4] of/unittest: add printf tests for node name Date: Tue, 28 Aug 2018 10:52:52 -0500 Message-Id: <20180828155254.10709-3-robh@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180828155254.10709-1-robh@kernel.org> References: <20180828155254.10709-1-robh@kernel.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add some printf test for printing the node name (without the unit-address). Cc: Frank Rowand Signed-off-by: Rob Herring --- drivers/of/unittest.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.17.1 diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index 69a522e48970..9def7be9c111 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c @@ -299,6 +299,10 @@ static void __init of_unittest_printf(void) of_unittest_printf_one(np, "%pOF", full_name); of_unittest_printf_one(np, "%pOFf", full_name); + of_unittest_printf_one(np, "%pOFn", "dev"); + of_unittest_printf_one(np, "%2pOFn", "dev"); + of_unittest_printf_one(np, "%5pOFn", " dev"); + of_unittest_printf_one(np, "%pOFnc", "dev:test-sub-device"); of_unittest_printf_one(np, "%pOFp", phandle_str); of_unittest_printf_one(np, "%pOFP", "dev@100"); of_unittest_printf_one(np, "ABC %pOFP ABC", "ABC dev@100 ABC"); From patchwork Tue Aug 28 15:52:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring \(Arm\)" X-Patchwork-Id: 145348 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp1347710ljw; Tue, 28 Aug 2018 08:53:02 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZlhD+wsY4UUvzwwLdHiFGkVQmSOQFlmDvoXqAs2ewbnGu7Lgo8YNjEFl7VVlLyoke81JI+ X-Received: by 2002:a65:5a81:: with SMTP id c1-v6mr1636579pgt.120.1535471582453; Tue, 28 Aug 2018 08:53:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535471582; cv=none; d=google.com; s=arc-20160816; b=x6PdQ1klVdLvtITg7y2Vb+ZOo8+dvvmchEd+aMHK42xhbKYf3CaUp9SSZK433SQsTq gpTNbyJJwwE88dEpk7ZDb9cYzBaTStvfxkxb+xASU5lLBXGyrYfBSYeCZ+2HTV0hAMOv zFjqAv96+z/7V80m5pbc/1QP/CGOjgGGmnJbsldJpaT71JBaQz4JObuFUmZxzwZ0dxw2 bOmjqJ7o2/4QkcRAuwhCJplMBmuRUsqiHP75diBMVxgxzrVpCk2tDi4GE9bsCpN2GIsz 7q4NclcrnSyS+CFBtnzakKPVSHlrAcKvPlkfMe8fHcpWOKunFdnsgMedh7zHcDzUx/pA PWLQ== 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=dmsFnFa+rHwaIKyMDWAR6JB4IObSHfoKE8CK74MJYsk=; b=cOql28HIxaKmJQI4mgnhxUoJBzgY2nctBlRLC2YdsO6GhVlAuysoaY6PxxO3bVZJJB wOCeGMF+cjUQmVSxWpI9nqBaC+dhvgujaKQTCzm7vGRBkBk2mxD2Gu/sjBUzh+IKgo0T lCY/JieC3QUQ8n1nrnmeUS2810ZM5HpzLGfm48/lvaXG3/6iWImmAJBKOVLHGNh8tHLV IpuawSX2PrWxCq9NrP8C8JCG01LGqX89FZIbzGCBcoI+JxbBD9Zb8bcmfVooOQokQ7zY 5yNcUOV6oNgw27I/v54SEI9lqhMzgdKBzX14/CuRZvefsQ4omjbuOHJ6JK6md+tkI9BD QRSQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o20-v6si1360455pgk.120.2018.08.28.08.53.02; Tue, 28 Aug 2018 08:53:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-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 devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728125AbeH1TpR (ORCPT + 6 others); Tue, 28 Aug 2018 15:45:17 -0400 Received: from mail-oi0-f53.google.com ([209.85.218.53]:37240 "EHLO mail-oi0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726383AbeH1TpQ (ORCPT ); Tue, 28 Aug 2018 15:45:16 -0400 Received: by mail-oi0-f53.google.com with SMTP id p84-v6so3731404oic.4; Tue, 28 Aug 2018 08:53:00 -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=dmsFnFa+rHwaIKyMDWAR6JB4IObSHfoKE8CK74MJYsk=; b=MYFVIew10BUp/QoJT2Dzn+3YGHVteI0B9miV/D6fpGPhIBpQatEpvx+GKwhXiqCIXv J9wtF+QUEGAdzyAY1HmTUPOJarNsy5fi5p0uflXna54+a1kP+WzWFRlFyj0v3O/llEle 1hFrXBxO4gDddt3FFUykoKU8iX2qmcdQhPBpdqA8Q6DbdHcg7en8+2Ggrb5wDcRyC44o Q2EbM0CXnIW8GE679wGgQ3Rrmc+BHXwfZknaE/jtPTUILaNO7n7Sa544X9Wu2sELu093 gS2eCJtcE8CDtwxxQ4KWofRFmumEbtzQYtd3qvQZ0V7IPf7VGmagOdgq85yuyPUqRnes YR7w== X-Gm-Message-State: APzg51Da1RBT1LyBUAOlOb9oHpE/ltCZMIFXL2DSHdPqmiLbPkKP1wyv 5TMOes4CjlMsgJJirPGpnRa83tE= X-Received: by 2002:aca:2111:: with SMTP id 17-v6mr1572408oiz.241.1535471579756; Tue, 28 Aug 2018 08:52:59 -0700 (PDT) Received: from xps15.herring.priv (24-155-109-49.dyn.grandenetworks.net. [24.155.109.49]) by smtp.googlemail.com with ESMTPSA id o68-v6sm2902294oik.56.2018.08.28.08.52.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Aug 2018 08:52:58 -0700 (PDT) From: Rob Herring To: Frank Rowand , devicetree@vger.kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 4/4] vsprintf: print OF node name using full_name Date: Tue, 28 Aug 2018 10:52:54 -0500 Message-Id: <20180828155254.10709-5-robh@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180828155254.10709-1-robh@kernel.org> References: <20180828155254.10709-1-robh@kernel.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org In preparation to remove the node name pointer from struct device_node, convert the node name print to get the node name from the full name. Signed-off-by: Rob Herring --- lib/vsprintf.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/lib/vsprintf.c b/lib/vsprintf.c index d5b3a3f95c01..891c282092a0 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -1596,6 +1596,7 @@ char *device_node_string(char *buf, char *end, struct device_node *dn, fmt = "f"; for (pass = false; strspn(fmt,"fnpPFcC"); fmt++, pass = true) { + int precision; if (pass) { if (buf < end) *buf = ':'; @@ -1607,7 +1608,11 @@ char *device_node_string(char *buf, char *end, struct device_node *dn, buf = device_node_gen_full_name(dn, buf, end); break; case 'n': /* name */ - buf = string(buf, end, dn->name, str_spec); + p = kbasename(of_node_full_name(dn)); + precision = str_spec.precision; + str_spec.precision = strchrnul(p, '@') - p; + buf = string(buf, end, p, str_spec); + str_spec.precision = precision; break; case 'p': /* phandle */ buf = number(buf, end, (unsigned int)dn->phandle, num_spec);