All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Jisheng Zhang <jszhang@marvell.com>
Cc: sebastian.hesselbarth@gmail.com, catalin.marinas@arm.com,
	will.deacon@arm.com, mark.rutland@arm.com, robh+dt@kernel.org,
	pawel.moll@arm.com, ijc+devicetree@hellion.org.uk,
	galak@codeaurora.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/5] clk: berlin: add clk support for berlin4ct
Date: Thu, 1 Oct 2015 15:42:38 -0700	[thread overview]
Message-ID: <20151001224238.GS19319@codeaurora.org> (raw)
In-Reply-To: <1442931156-5877-4-git-send-email-jszhang@marvell.com>

On 09/22, Jisheng Zhang wrote:
> + */
> +#include <linux/clk-provider.h>
> +#include <linux/io.h>
> +#include <linux/kernel.h>
> +#include <linux/of.h>
> +#include <linux/of_address.h>
> +#include <linux/slab.h>
> +
> +#include "clk.h"
> +
> +#define CLK_SOURCE_MAX	5
> +
> +static struct clk_onecell_data gateclk_data;
> +static struct clk_onecell_data clk_data;
> +
> +static DEFINE_SPINLOCK(lock);

This is really generic. How about berlin4ct_lock? That will make
lockdep happy because the name for the key will have some
meaning.

> +static void __init berlin4ct_gateclk_setup(struct device_node *np)
> +{
> +	int i, n, ret;
> +	void __iomem *base;
> +	struct clk **clks;
> +
> +	base = of_iomap(np, 0);
> +	if (WARN_ON(!base))
> +		return;
> +
> +	n = ARRAY_SIZE(berlin4ct_gates);
> +	clks = kzalloc(n * sizeof(struct clk *), GFP_KERNEL);

kcalloc()

> +	if (WARN_ON(!clks))

Same comment about dropping WARN_ON for an allocation failure.

> +		return;
> +
> +	for (i = 0; i < n; i++) {
> +		clks[i] = clk_register_gate(NULL, berlin4ct_gates[i].name,
> +				berlin4ct_gates[i].parent_name,
> +				berlin4ct_gates[i].flags, base,
> +				berlin4ct_gates[i].bit_idx, 0, &lock);
> +		WARN_ON(IS_ERR(clks[i]));
> +	}
> +
> +	gateclk_data.clks = clks;
> +	gateclk_data.clk_num = i;
> +
> +	ret = of_clk_add_provider(np, of_clk_src_onecell_get,
> +				  &gateclk_data);
> +	if (WARN_ON(ret))
> +		return;

Drop that return please.

> +
> +}
> +CLK_OF_DECLARE(berlin4ct_gateclk, "marvell,berlin4ct-gateclk",
> +	       berlin4ct_gateclk_setup);
> +
> +static void __init berlin4ct_clk_setup(struct device_node *np)
> +{
> +	int i, n, ret, num_parents;
> +	void __iomem *base;
> +	struct clk **clks;
> +	const char *parent_names[CLK_SOURCE_MAX];
> +
> +	num_parents = of_clk_get_parent_count(np);
> +	if (num_parents <= 0 || num_parents > CLK_SOURCE_MAX)
> +		return;
> +
> +	of_clk_parent_fill(np, parent_names, num_parents);
> +
> +	base = of_iomap(np, 0);
> +	if (WARN_ON(!base))
> +		return;
> +
> +	n = ARRAY_SIZE(berlin4ct_descs);
> +	clks = kzalloc(n * sizeof(struct clk *), GFP_KERNEL);

kcalloc()

> +	if (WARN_ON(!clks))

Same comment about dropping WARN_ON for an allocation failure.

> +		return;
> +
> +	for (i = 0; i < n; i++) {
> +		clks[i] = berlin_clk_register(berlin4ct_descs[i].name,
> +				num_parents, parent_names,
> +				berlin4ct_descs[i].flags,
> +				base + berlin4ct_descs[i].offset);
> +		WARN_ON(IS_ERR(clks[i]));
> +	}
> +
> +	clk_data.clks = clks;
> +	clk_data.clk_num = i;
> +
> +	ret = of_clk_add_provider(np, of_clk_src_onecell_get,
> +				  &clk_data);
> +	if (WARN_ON(ret))
> +		return;

Drop that return please.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

WARNING: multiple messages have this Message-ID (diff)
From: sboyd@codeaurora.org (Stephen Boyd)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/5] clk: berlin: add clk support for berlin4ct
Date: Thu, 1 Oct 2015 15:42:38 -0700	[thread overview]
Message-ID: <20151001224238.GS19319@codeaurora.org> (raw)
In-Reply-To: <1442931156-5877-4-git-send-email-jszhang@marvell.com>

On 09/22, Jisheng Zhang wrote:
> + */
> +#include <linux/clk-provider.h>
> +#include <linux/io.h>
> +#include <linux/kernel.h>
> +#include <linux/of.h>
> +#include <linux/of_address.h>
> +#include <linux/slab.h>
> +
> +#include "clk.h"
> +
> +#define CLK_SOURCE_MAX	5
> +
> +static struct clk_onecell_data gateclk_data;
> +static struct clk_onecell_data clk_data;
> +
> +static DEFINE_SPINLOCK(lock);

This is really generic. How about berlin4ct_lock? That will make
lockdep happy because the name for the key will have some
meaning.

> +static void __init berlin4ct_gateclk_setup(struct device_node *np)
> +{
> +	int i, n, ret;
> +	void __iomem *base;
> +	struct clk **clks;
> +
> +	base = of_iomap(np, 0);
> +	if (WARN_ON(!base))
> +		return;
> +
> +	n = ARRAY_SIZE(berlin4ct_gates);
> +	clks = kzalloc(n * sizeof(struct clk *), GFP_KERNEL);

kcalloc()

> +	if (WARN_ON(!clks))

Same comment about dropping WARN_ON for an allocation failure.

> +		return;
> +
> +	for (i = 0; i < n; i++) {
> +		clks[i] = clk_register_gate(NULL, berlin4ct_gates[i].name,
> +				berlin4ct_gates[i].parent_name,
> +				berlin4ct_gates[i].flags, base,
> +				berlin4ct_gates[i].bit_idx, 0, &lock);
> +		WARN_ON(IS_ERR(clks[i]));
> +	}
> +
> +	gateclk_data.clks = clks;
> +	gateclk_data.clk_num = i;
> +
> +	ret = of_clk_add_provider(np, of_clk_src_onecell_get,
> +				  &gateclk_data);
> +	if (WARN_ON(ret))
> +		return;

Drop that return please.

> +
> +}
> +CLK_OF_DECLARE(berlin4ct_gateclk, "marvell,berlin4ct-gateclk",
> +	       berlin4ct_gateclk_setup);
> +
> +static void __init berlin4ct_clk_setup(struct device_node *np)
> +{
> +	int i, n, ret, num_parents;
> +	void __iomem *base;
> +	struct clk **clks;
> +	const char *parent_names[CLK_SOURCE_MAX];
> +
> +	num_parents = of_clk_get_parent_count(np);
> +	if (num_parents <= 0 || num_parents > CLK_SOURCE_MAX)
> +		return;
> +
> +	of_clk_parent_fill(np, parent_names, num_parents);
> +
> +	base = of_iomap(np, 0);
> +	if (WARN_ON(!base))
> +		return;
> +
> +	n = ARRAY_SIZE(berlin4ct_descs);
> +	clks = kzalloc(n * sizeof(struct clk *), GFP_KERNEL);

kcalloc()

> +	if (WARN_ON(!clks))

Same comment about dropping WARN_ON for an allocation failure.

> +		return;
> +
> +	for (i = 0; i < n; i++) {
> +		clks[i] = berlin_clk_register(berlin4ct_descs[i].name,
> +				num_parents, parent_names,
> +				berlin4ct_descs[i].flags,
> +				base + berlin4ct_descs[i].offset);
> +		WARN_ON(IS_ERR(clks[i]));
> +	}
> +
> +	clk_data.clks = clks;
> +	clk_data.clk_num = i;
> +
> +	ret = of_clk_add_provider(np, of_clk_src_onecell_get,
> +				  &clk_data);
> +	if (WARN_ON(ret))
> +		return;

Drop that return please.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

  reply	other threads:[~2015-10-01 22:42 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-22 14:12 [PATCH 0/5] Add Marvell berlin4ct clk support Jisheng Zhang
2015-09-22 14:12 ` Jisheng Zhang
2015-09-22 14:12 ` Jisheng Zhang
2015-09-22 14:12 ` [PATCH 1/5] clk: berlin: add common pll driver Jisheng Zhang
2015-09-22 14:12   ` Jisheng Zhang
2015-09-22 14:12   ` Jisheng Zhang
2015-10-01 22:32   ` Stephen Boyd
2015-10-01 22:32     ` Stephen Boyd
2015-10-08 10:52     ` Jisheng Zhang
2015-10-08 10:52       ` Jisheng Zhang
2015-10-08 10:52       ` Jisheng Zhang
2015-09-22 14:12 ` [PATCH 2/5] clk: berlin: add common clk driver for newer SoCs Jisheng Zhang
2015-09-22 14:12   ` Jisheng Zhang
2015-09-22 14:12   ` Jisheng Zhang
2015-10-01 22:38   ` Stephen Boyd
2015-10-01 22:38     ` Stephen Boyd
2015-09-22 14:12 ` [PATCH 3/5] clk: berlin: add clk support for berlin4ct Jisheng Zhang
2015-09-22 14:12   ` Jisheng Zhang
2015-09-22 14:12   ` Jisheng Zhang
2015-10-01 22:42   ` Stephen Boyd [this message]
2015-10-01 22:42     ` Stephen Boyd
2015-09-22 14:12 ` [PATCH 4/5] dt-bindings: add binding for marvell berlin4ct SoC Jisheng Zhang
2015-09-22 14:12   ` Jisheng Zhang
2015-09-22 14:12   ` Jisheng Zhang
2015-10-01 22:50   ` Stephen Boyd
2015-10-01 22:50     ` Stephen Boyd
2015-10-08 11:13     ` Jisheng Zhang
2015-10-08 11:13       ` Jisheng Zhang
2015-10-08 11:13       ` Jisheng Zhang
2015-09-22 14:12 ` [PATCH 5/5] arm64: dts: berlin4ct: add pll and clock nodes Jisheng Zhang
2015-09-22 14:12   ` Jisheng Zhang
2015-09-22 14:12   ` Jisheng Zhang
2015-09-23  1:55 ` [PATCH 0/5] Add Marvell berlin4ct clk support Jisheng Zhang
2015-09-23  1:55   ` Jisheng Zhang
2015-09-23  1:55   ` Jisheng Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151001224238.GS19319@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=catalin.marinas@arm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=jszhang@marvell.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.