From patchwork Thu Oct 29 11:21:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 7518271 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4AC89BEEA4 for ; Thu, 29 Oct 2015 11:21:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D05E820652 for ; Thu, 29 Oct 2015 11:21:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 75DB720650 for ; Thu, 29 Oct 2015 11:21:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751917AbbJ2LVF (ORCPT ); Thu, 29 Oct 2015 07:21:05 -0400 Received: from xavier.telenet-ops.be ([195.130.132.52]:57886 "EHLO xavier.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750889AbbJ2LVE (ORCPT ); Thu, 29 Oct 2015 07:21:04 -0400 Received: from ayla.of.borg ([84.195.106.123]) by xavier.telenet-ops.be with bizsmtp id azM11r0102fm56U01zM1Um; Thu, 29 Oct 2015 12:21:02 +0100 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.82) (envelope-from ) id 1ZrlGP-0002WC-AR; Thu, 29 Oct 2015 12:21:01 +0100 Received: from geert by ramsan with local (Exim 4.82) (envelope-from ) id 1ZrlGV-0001aq-EF; Thu, 29 Oct 2015 12:21:07 +0100 From: Geert Uytterhoeven To: Michael Turquette , Stephen Boyd , Magnus Damm , Simon Horman , Laurent Pinchart Cc: linux-clk@vger.kernel.org, linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v5 2/5] clk: shmobile: div6: Make clock-output-names optional Date: Thu, 29 Oct 2015 12:21:01 +0100 Message-Id: <1446117664-6037-3-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1446117664-6037-1-git-send-email-geert+renesas@glider.be> References: <1446117664-6037-1-git-send-email-geert+renesas@glider.be> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Renesas DIV6 clocks provide a single clock output. Hence make the "clock-output-names" DT property optional instead of mandatory. In case the DT property is omitted the DT node name will be used. Rename the variable "name" to "clk_name" to make the code more similar with fixed-factor-clock.c, and to avoid a conflict with a nested local variable while we're at it. Signed-off-by: Geert Uytterhoeven --- v5: - Integrated in this series as a dependency. --- .../devicetree/bindings/clock/renesas,cpg-div6-clocks.txt | 4 ++++ drivers/clk/shmobile/clk-div6.c | 13 +++---------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Documentation/devicetree/bindings/clock/renesas,cpg-div6-clocks.txt b/Documentation/devicetree/bindings/clock/renesas,cpg-div6-clocks.txt index 5ddb68418655d569..86008ad354cf4bbd 100644 --- a/Documentation/devicetree/bindings/clock/renesas,cpg-div6-clocks.txt +++ b/Documentation/devicetree/bindings/clock/renesas,cpg-div6-clocks.txt @@ -20,6 +20,10 @@ Required Properties: clocks must be specified. For clocks with multiple parents, invalid settings must be specified as "<0>". - #clock-cells: Must be 0 + + +Optional Properties: + - clock-output-names: The name of the clock as a free-form string diff --git a/drivers/clk/shmobile/clk-div6.c b/drivers/clk/shmobile/clk-div6.c index 036a692c72195db9..c89566a918290246 100644 --- a/drivers/clk/shmobile/clk-div6.c +++ b/drivers/clk/shmobile/clk-div6.c @@ -178,10 +178,9 @@ static void __init cpg_div6_clock_init(struct device_node *np) const char **parent_names; struct clk_init_data init; struct div6_clock *clock; - const char *name; + const char *clk_name = np->name; struct clk *clk; unsigned int i; - int ret; clock = kzalloc(sizeof(*clock), GFP_KERNEL); if (!clock) @@ -215,13 +214,7 @@ static void __init cpg_div6_clock_init(struct device_node *np) clock->div = (clk_readl(clock->reg) & CPG_DIV6_DIV_MASK) + 1; /* Parse the DT properties. */ - ret = of_property_read_string(np, "clock-output-names", &name); - if (ret < 0) { - pr_err("%s: failed to get %s DIV6 clock output name\n", - __func__, np->name); - goto error; - } - + of_property_read_string(np, "clock-output-names", &clk_name); for (i = 0, valid_parents = 0; i < num_parents; i++) { const char *name = of_clk_get_parent_name(np, i); @@ -255,7 +248,7 @@ static void __init cpg_div6_clock_init(struct device_node *np) } /* Register the clock. */ - init.name = name; + init.name = clk_name; init.ops = &cpg_div6_clock_ops; init.flags = CLK_IS_BASIC; init.parent_names = parent_names;