linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] at91: switch to CLKDEV_LOOKUP
Date: Thu, 28 Apr 2011 20:22:37 +0100	[thread overview]
Message-ID: <20110428192237.GP17290@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20110420081624.GT31131@pengutronix.de>

On Wed, Apr 20, 2011 at 10:16:24AM +0200, Uwe Kleine-K?nig wrote:
> Hello Jean-Christophe,
> 
> On Wed, Apr 20, 2011 at 05:59:29AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> >  /*
> >   * The five programmable clocks.
> >   * You must configure pin multiplexing to bring these signals out.
> > @@ -234,6 +265,13 @@ static struct clk pck3 = {
> >  	.id		= 3,
> >  };
> >  
> > +static struct clk_lookup program_clocks_lookups[] = {
> > +	CLKDEV_CON_ID("pck0", &pck0),
> > +	CLKDEV_CON_ID("pck1", &pck1),
> > +	CLKDEV_CON_ID("pck2", &pck2),
> > +	CLKDEV_CON_ID("pck3", &pck3),
> > +};
> > +
> >  static struct clk mAgicV_mem_clk = {
> >  	.name		= "mAgicV_mem_clk",
> >  	.pmc_mask	= AT91_PMC_PCK4,
> > @@ -241,6 +279,9 @@ static struct clk mAgicV_mem_clk = {
> >  	.id		= 4,
> >  };
> >  
> > +static struct clk_lookup mAgicV_mem_clk_lookup =
> > +	CLKDEV_CON_ID("mAgicV_mem_clk", &mAgicV_mem_clk);
> > +
> >  /* HClocks */
> >  static struct clk hck0 = {
> >  	.name		= "hck0",
> > @@ -255,6 +296,11 @@ static struct clk hck1 = {
> >  	.id		= 1,
> >  };
> >  
> > +static struct clk_lookup hc_clocks_lookups[] = {
> > +	CLKDEV_CON_ID("hck0", &hck0),
> > +	CLKDEV_CON_ID("hck1", &hck1),
> > +};
> > +
> >  static void __init at572d940hf_register_clocks(void)
> >  {
> >  	int i;
> > @@ -262,14 +308,32 @@ static void __init at572d940hf_register_clocks(void)
> >  	for (i = 0; i < ARRAY_SIZE(periph_clocks); i++)
> >  		clk_register(periph_clocks[i]);
> >  
> > +	clkdev_add_table(periph_clocks_lookups,
> > +			 ARRAY_SIZE(periph_clocks_lookups));
> > +
> Does it make sense to add a (maybe global) helper function ? la:
> 
> 	void __init clkdev_register_and_add_table(struct clk_lookup *cl, size_t num)
> 	{
> 		while (num--) {
> 			clk_register(&cl->clk);
> 			clkdev_add(cl);
> 			++cl;
> 		}
> 	}
> 
> ? (The locking isn't optimal here, but I think you get the point.)

Err no.  clk_register() has nothing to do with clkdev, and actually
clkdev has no business knowing about clk_register() at all.  Note
that clk_register() is not part of the clk API but a private
function to the implementation.

      parent reply	other threads:[~2011-04-28 19:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-20  3:59 [PATCH] at91: switch to CLKDEV_LOOKUP Jean-Christophe PLAGNIOL-VILLARD
2011-04-20  8:16 ` Uwe Kleine-König
2011-04-20 10:44   ` Jean-Christophe PLAGNIOL-VILLARD
2011-04-28 19:22   ` Russell King - ARM Linux [this message]

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=20110428192237.GP17290@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).