Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp6236621ybe; Tue, 17 Sep 2019 23:32:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqxBUbL5kbvHsxfTtQWdl/o68HlzAhzkheMhme5cQ9id6KG9zyjLx26U2JBGSb767Ju2t4F0 X-Received: by 2002:aa7:dc55:: with SMTP id g21mr4939455edu.210.1568788357981; Tue, 17 Sep 2019 23:32:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568788357; cv=none; d=google.com; s=arc-20160816; b=w0zJzZqLSH4j+6ErDU/chTWnKbtuU4iUXfg1Fdd5NuyLoGeYbI3jjBZ9XIu0C6BwNF nUqFb5agv9FTp7IH/5GQvYZr1SQrxly+e7p5gfDQ/zDP9qYbC/HqJwxhW1mJ7u4PGgw5 NrPGe/6PopJchrwQaKgkRVTl0X2AxhOhNKQKosQ+j7Rd7PVg3d6ha6H3WuaDShWCyaIa qn5lRJCRdJXG+44kUk7qyovl8A+SDbGarBDc6jbZtc2B+v1J4f4jWvrFo1tUs9/IK2/h 3FMmULNUw2j/f/WK3YBKPREZFNRHyNOW6uXCqmTtTSAv80/dg+76vUw6dDxPo7CzeYEx LogQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=W90t86f28Ev3yyv8gUJjvU3kalNTflKzQ9s2Av4IW/o=; b=aRarQluYt9MWt3ZJylBDpoTuVJMJ5PrfFt+UzSCwLl90zRPDRAqig4UdLjDUg9F9WJ 2WRDojy+/3Yh74a6sZWFtWHJPflrfnQVe6SJkbH6c/BD5Gfd0h4Og5qoxl7rfQeaVYTz LGDv5C/pWOLlSuUip0cflMRp3G4PhtPJ9iw3Dov1yIDvPf86RC3+Ex0jqA+npoeFCOPk zqlDMnXHBS6mQh5QTXQCb8d6tLMz/xfP49ZPxlZDIjJOmEpr2b/N4yxFQ2Tev5e180pW uQo/05NcVHYd7xHXGGMXnNCVnEnt1GJEpQm7C/qjN4eaGI+MGkuiZSz8XIIwGPGJg8S1 +V1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=t5rQa1o8; 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 c7si2153628ejr.360.2019.09.17.23.32.14; Tue, 17 Sep 2019 23:32:37 -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; dkim=pass header.i=@kernel.org header.s=default header.b=t5rQa1o8; 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 S1730285AbfIRG0U (ORCPT + 99 others); Wed, 18 Sep 2019 02:26:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:47610 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728395AbfIRG0S (ORCPT ); Wed, 18 Sep 2019 02:26:18 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CD5A621924; Wed, 18 Sep 2019 06:26:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568787977; bh=Lb6PQz8+/DWzFIUSaUwex+ThbiYq5c6fI82ixMMnb7o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t5rQa1o8zZnnRqYcIb4QzUUWiic86Dwl5DAYlK4HrrDSLmy8qbv13R/3xfHwFMdKS 0SIeheiHxnvBSb/B+AXbsPRDumqSbXJ4BdPcR57RlnzxRqwrvC/+8oBsKmVrInfTXP GpCrksLA2i6cAfPOf107OjsEPVAIvTgDp1pU8cF0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen-Yu Tsai , Stephen Boyd Subject: [PATCH 5.2 55/85] clk: Simplify debugfs printing and add a newline Date: Wed, 18 Sep 2019 08:19:13 +0200 Message-Id: <20190918061235.849500666@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190918061234.107708857@linuxfoundation.org> References: <20190918061234.107708857@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stephen Boyd commit 11f6c2307caee89370d7752eb6f404f1ed73faaf upstream. The possible parent printing function duplicates a bunch of if conditions. Pull that into another function so we can print an extra character at the end, either a space or a newline. This way we can add the required newline that got lost here and also shorten the code. Fixes: 2d156b78ce8f ("clk: Fix debugfs clk_possible_parents for clks without parent string names") Cc: Chen-Yu Tsai Tested-by: Chen-Yu Tsai Reviewed-by: Chen-Yu Tsai Signed-off-by: Stephen Boyd Signed-off-by: Greg Kroah-Hartman --- drivers/clk/clk.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -3020,11 +3020,10 @@ static int clk_flags_show(struct seq_fil } DEFINE_SHOW_ATTRIBUTE(clk_flags); -static int possible_parents_show(struct seq_file *s, void *data) +static void possible_parent_show(struct seq_file *s, struct clk_core *core, + unsigned int i, char terminator) { - struct clk_core *core = s->private; struct clk_core *parent; - int i; /* * Go through the following options to fetch a parent's name. @@ -3038,22 +3037,6 @@ static int possible_parents_show(struct * specified directly via a struct clk_hw pointer, but it isn't * registered (yet). */ - for (i = 0; i < core->num_parents - 1; i++) { - parent = clk_core_get_parent_by_index(core, i); - if (parent) - seq_printf(s, "%s ", parent->name); - else if (core->parents[i].name) - seq_printf(s, "%s ", core->parents[i].name); - else if (core->parents[i].fw_name) - seq_printf(s, "<%s>(fw) ", core->parents[i].fw_name); - else if (core->parents[i].index >= 0) - seq_printf(s, "%s ", - of_clk_get_parent_name(core->of_node, - core->parents[i].index)); - else - seq_puts(s, "(missing) "); - } - parent = clk_core_get_parent_by_index(core, i); if (parent) seq_printf(s, "%s", parent->name); @@ -3068,6 +3051,19 @@ static int possible_parents_show(struct else seq_puts(s, "(missing)"); + seq_putc(s, terminator); +} + +static int possible_parents_show(struct seq_file *s, void *data) +{ + struct clk_core *core = s->private; + int i; + + for (i = 0; i < core->num_parents - 1; i++) + possible_parent_show(s, core, i, ' '); + + possible_parent_show(s, core, i, '\n'); + return 0; } DEFINE_SHOW_ATTRIBUTE(possible_parents);