linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Andrew de Quincey <adq_dvb@lidskialf.net>,
	linux-arm-kernel@lists.arm.linux.org.uk,
	Imre Deak <imre.deak@nokia.com>,
	linux-omap@vger.kernel.org,
	linux-fbdev-devel@lists.sourceforge.net
Subject: Re: [PATCH] ARM: Move clk_add_alias() to arch/arm/common/clkdev.c (Re: [PATCH 05/10] ARM: OMAP1: Make 770 LCD work)
Date: Wed, 3 Jun 2009 09:44:33 -0700	[thread overview]
Message-ID: <20090603164432.GE5026@atomide.com> (raw)
In-Reply-To: <20090528210205.GH32453@atomide.com>

* Tony Lindgren <tony@atomide.com> [090528 14:05]:
> * Russell King - ARM Linux <linux@arm.linux.org.uk> [090528 12:53]:
> > On Thu, May 28, 2009 at 11:20:48AM -0700, Tony Lindgren wrote:
> > > > +int clk_add_alias(const char *alias, const char *alias_dev_name, char *id,
> > > > +	struct device *dev)
> > > > +{
> > > > +	struct clk *r = clk_get(dev, id);
> > > > +	struct clk_lookup *l;
> > > > +
> > > > +	if (!r)
> > > > +		return -ENODEV;
> > > > +
> > > > +	l = clkdev_alloc(r, alias, alias_dev_name);
> > > > +	clk_put(r);
> > > > +	if (!l)
> > > > +		return -ENODEV;
> > > > +	clkdev_add(l);
> > > > +	return 0;
> > > > +}
> > > > +EXPORT_SYMBOL(clk_add_alias);
> > 
> > Oh, and a really good thing to do would be to fix the error checking and
> > returning in there (why did I miss it in the original PXA version...)
> 
> How about this? The prototype is in clk.h now, is that OK?

Added to patch tracking as 5536/1.
 
> Tony

> From e4e651822967b0530a9d092894c04149e28efe39 Mon Sep 17 00:00:00 2001
> From: Tony Lindgren <tony@atomide.com>
> Date: Thu, 28 May 2009 13:24:12 -0700
> Subject: [PATCH] ARM: Move clk_add_alias() to arch/arm/common/clkdev.c
> 
> This can be used for other arm platforms too as discussed
> on the linux-arm-kernel list.
> 
> Also check the return value with IS_ERR and return PTR_ERR
> as suggested by Russell King.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> 
> diff --git a/arch/arm/common/clkdev.c b/arch/arm/common/clkdev.c
> index 5589444..f37afd9 100644
> --- a/arch/arm/common/clkdev.c
> +++ b/arch/arm/common/clkdev.c
> @@ -135,6 +135,24 @@ struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id,
>  }
>  EXPORT_SYMBOL(clkdev_alloc);
>  
> +int clk_add_alias(const char *alias, const char *alias_dev_name, char *id,
> +	struct device *dev)
> +{
> +	struct clk *r = clk_get(dev, id);
> +	struct clk_lookup *l;
> +
> +	if (IS_ERR(r))
> +		return PTR_ERR(r);
> +
> +	l = clkdev_alloc(r, alias, alias_dev_name);
> +	clk_put(r);
> +	if (!l)
> +		return -ENODEV;
> +	clkdev_add(l);
> +	return 0;
> +}
> +EXPORT_SYMBOL(clk_add_alias);
> +
>  /*
>   * clkdev_drop - remove a clock dynamically allocated
>   */
> diff --git a/arch/arm/mach-pxa/clock.c b/arch/arm/mach-pxa/clock.c
> index db52d2c..49ae382 100644
> --- a/arch/arm/mach-pxa/clock.c
> +++ b/arch/arm/mach-pxa/clock.c
> @@ -86,20 +86,3 @@ void clks_register(struct clk_lookup *clks, size_t num)
>  	for (i = 0; i < num; i++)
>  		clkdev_add(&clks[i]);
>  }
> -
> -int clk_add_alias(const char *alias, const char *alias_dev_name, char *id,
> -	struct device *dev)
> -{
> -	struct clk *r = clk_get(dev, id);
> -	struct clk_lookup *l;
> -
> -	if (!r)
> -		return -ENODEV;
> -
> -	l = clkdev_alloc(r, alias, alias_dev_name);
> -	clk_put(r);
> -	if (!l)
> -		return -ENODEV;
> -	clkdev_add(l);
> -	return 0;
> -}
> diff --git a/include/linux/clk.h b/include/linux/clk.h
> index 1db9bbf..1d37f42 100644
> --- a/include/linux/clk.h
> +++ b/include/linux/clk.h
> @@ -142,4 +142,17 @@ struct clk *clk_get_parent(struct clk *clk);
>   */
>  struct clk *clk_get_sys(const char *dev_id, const char *con_id);
>  
> +/**
> + * clk_add_alias - add a new clock alias
> + * @alias: name for clock alias
> + * @alias_dev_name: device name
> + * @id: platform specific clock name
> + * @dev: device
> + *
> + * Allows using generic clock names for drivers by adding a new alias.
> + * Assumes clkdev, see clkdev.h for more info.
> + */
> +int clk_add_alias(const char *alias, const char *alias_dev_name, char *id,
> +			struct device *dev);
> +
>  #endif


  reply	other threads:[~2009-06-03 16:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20090519232905.12760.15490.stgit@localhost>
2009-05-19 23:37 ` [PATCH 05/10] ARM: OMAP1: Make 770 LCD work Tony Lindgren
2009-05-25  9:29   ` Russell King - ARM Linux
2009-05-25 13:21     ` Andrew de Quincey
2009-05-25 16:40       ` Andrew de Quincey
2009-05-28 18:20         ` Tony Lindgren
2009-05-28 18:44           ` Andrew de Quincey
2009-05-28 19:11             ` [PATCH 05/10] ARM: OMAP1: Make 770 LCD work, v2 Tony Lindgren
2009-05-28 21:03               ` [PATCH 05/10] ARM: OMAP1: Make 770 LCD work, v3 Tony Lindgren
2009-05-28 19:50           ` [PATCH 05/10] ARM: OMAP1: Make 770 LCD work Russell King - ARM Linux
2009-05-29  0:29             ` Andrew de Quincey
2009-06-01 13:57               ` Kalle Valo
2009-05-28 19:53           ` Russell King - ARM Linux
2009-05-28 21:02             ` [PATCH] ARM: Move clk_add_alias() to arch/arm/common/clkdev.c (Re: [PATCH 05/10] ARM: OMAP1: Make 770 LCD work) Tony Lindgren
2009-06-03 16:44               ` Tony Lindgren [this message]
2009-05-19 23:44 ` [PATCH 10/10] ARM: OMAP2: 2430SDP: Add FB support to board file Tony Lindgren
2009-05-25 17:42   ` [PATCH 11/10] ARM: OMAP: Add some entries to MAINTAINERS Tony Lindgren

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=20090603164432.GE5026@atomide.com \
    --to=tony@atomide.com \
    --cc=adq_dvb@lidskialf.net \
    --cc=imre.deak@nokia.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    /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).