mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Josh Cartwright <josh.cartwright@ni.com>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Grant Likely <grant.likely@secretlab.ca>,
	Rob Herring <rob.herring@calxeda.com>,
	Russell King <linux@arm.linux.org.uk>,
	Mike Turquette <mturquette@ti.com>,
	John Stultz <johnstul@us.ibm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Alan Cox <alan@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	John Linn <John.Linn@xilinx.com>,
	Michal Simek <michal.simek@xilinx.com>,
	devicetree-discuss@lists.ozlabs.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-serial@vger.kernel.org, Michal Simek <monstr@monstr.eu>
Subject: Re: [PATCH 5/8] ARM: zynq: add COMMON_CLK support
Date: Fri, 2 Nov 2012 07:38:50 -0600	[thread overview]
Message-ID: <20121102133850.GO5190@beefymiracle.amer.corp.natinst.com> (raw)
In-Reply-To: <50939378.2050500@metafoo.de>

Thanks for the review.

On Fri, Nov 02, 2012 at 10:33:44AM +0100, Lars-Peter Clausen wrote:
> On 10/31/2012 07:58 PM, Josh Cartwright wrote:
> > [...]
> > +#define PERIPH_CLK_CTRL_SRC(x)	(periph_clk_parent_map[((x)&3)>>4])
> > +#define PERIPH_CLK_CTRL_DIV(x)	(((x)&0x3F00)>>8)
> 
> A few more spaces wouldn't hurt ;)

Okay, sure.

> > [...]
> > +static void __init zynq_periph_clk_setup(struct device_node *np)
> > +{
> > +	struct zynq_periph_clk *periph;
> > +	const char *parent_names[3];
> > +	struct clk_init_data init;
> > +	struct clk *clk;
> > +	int err;
> > +	u32 reg;
> > +	int i;
> > +
> > +	err = of_property_read_u32(np, "reg", &reg);
> > +	WARN_ON(err);
>
> Shouldn't the function abort if a error happens somewhere? Continuing here
> will lead to undefined behavior. Same is probably true for the other WARN_ONs.

The way I see it is: the kernel is will be left in a bad state in the
case of any failure, regardless of if we bail out or continue.  AFAICT,
there is no clean way to recover from a failure this early.

Given that, it seems simpler (albeit marginally so) just to continue; so
that's what I chose to do.  I'm not opposed to bailing out, just not
convinced it does anything for us.

> > +
> > +	periph = kzalloc(sizeof(*periph), GFP_KERNEL);
> > +	WARN_ON(!periph);
> > +
> > +	periph->clk_ctrl = slcr_base + reg;
> > +	spin_lock_init(&periph->clkact_lock);
> > +
> > +	init.name = np->name;
> > +	init.ops = &zynq_periph_clk_ops;
> > +	for (i = 0; i < ARRAY_SIZE(parent_names); i++)
> > +		parent_names[i] = of_clk_get_parent_name(np, i);
> > +	init.parent_names = parent_names;
> > +	init.num_parents = ARRAY_SIZE(parent_names);
> > +
> > +	periph->hw.init = &init;
> > +
> > +	clk = clk_register(NULL, &periph->hw);
> > +	WARN_ON(IS_ERR(clk));
> > +
> > +	err = of_clk_add_provider(np, of_clk_src_simple_get, clk);
> > +	WARN_ON(err);
> > +
> > +	for (i = 0; i < 2; i++) {
> 
> Not all of the peripheral clock generators have two output clocks. I think
> it makes sense to use the number entries in clock-output-names here.

Yes, I agree.  I'll also update the bindings documentation.

Thanks again,
  Josh

  reply	other threads:[~2012-11-02 13:40 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-31 22:06 [PATCH 0/8] zynq " Josh Cartwright
2012-10-29 18:42 ` [PATCH 2/8] ARM: zynq: move ttc timer code to drivers/clocksource Josh Cartwright
2012-11-05 11:22   ` Michal Simek
2012-11-05 14:49     ` Rob Herring
2012-11-05 21:47     ` Josh Cartwright
2012-11-12 11:53       ` Michal Simek
2012-10-30 12:25 ` [PATCH 6/8] serial: xilinx_uartps: kill CONFIG_OF conditional Josh Cartwright
2012-11-05 12:16   ` Michal Simek
2012-10-31 17:11 ` [PATCH 1/8] ARM: zynq: move arm-specific sys_timer out of ttc Josh Cartwright
2012-11-05 11:20   ` Michal Simek
2012-10-31 18:24 ` [PATCH 4/8] ARM: zynq: dts: split up device tree Josh Cartwright
2012-11-05 11:32   ` Michal Simek
2012-10-31 18:58 ` [PATCH 5/8] ARM: zynq: add COMMON_CLK support Josh Cartwright
2012-11-02  9:33   ` Lars-Peter Clausen
2012-11-02 13:38     ` Josh Cartwright [this message]
2012-11-02 15:12       ` Lars-Peter Clausen
2012-11-02 15:28         ` Josh Cartwright
2012-11-05 12:31           ` Michal Simek
2012-10-31 19:28 ` [PATCH 7/8] serial: xilinx_uartps: get clock rate info from dts Josh Cartwright
2012-11-02  9:20   ` Lars-Peter Clausen
2012-11-02 13:39     ` Josh Cartwright
2012-10-31 19:45 ` [PATCH 3/8] ARM: zynq: dts: add description of the second uart Josh Cartwright
2012-11-05 11:35   ` Michal Simek
2012-10-31 19:56 ` [PATCH 8/8] clocksource: xilinx_ttc: add OF_CLK support Josh Cartwright
2012-11-02  2:56   ` Josh Cartwright
2012-11-05 13:02   ` Michal Simek

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=20121102133850.GO5190@beefymiracle.amer.corp.natinst.com \
    --to=josh.cartwright@ni.com \
    --cc=John.Linn@xilinx.com \
    --cc=alan@linux.intel.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=gregkh@linuxfoundation.org \
    --cc=johnstul@us.ibm.com \
    --cc=lars@metafoo.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=michal.simek@xilinx.com \
    --cc=monstr@monstr.eu \
    --cc=mturquette@ti.com \
    --cc=rob.herring@calxeda.com \
    --cc=tglx@linutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®