All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Cc: linux-kernel@vger.kernel.org,
	Mike Turquette <mturquette@linaro.org>,
	Javier Martinez Canillas <javier.martinez@collabora.co.uk>,
	Paul Walmsley <paul@pwsan.com>, Tony Lindgren <tony@atomide.com>,
	Russell King <linux@arm.linux.org.uk>,
	linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v9 2/3] clk: Make clk API return per-user struct clk instances
Date: Mon, 19 Jan 2015 12:59:08 -0800	[thread overview]
Message-ID: <20150119205908.GC27202@codeaurora.org> (raw)
In-Reply-To: <1421688067-24426-3-git-send-email-tomeu.vizoso@collabora.com>

On 01/19, Tomeu Vizoso wrote:
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 97f3425..f2a1ff3 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -694,32 +751,32 @@ long __clk_mux_determine_rate(struct clk_hw *hw, unsigned long rate,
>  			      unsigned long *best_parent_rate,
>  			      struct clk_hw **best_parent_p)
>  {
> -	struct clk *clk = hw->clk, *parent, *best_parent = NULL;
> +	struct clk_core *core = hw->clk->core, *parent, *best_parent = NULL;

Can't we just use hw->core here?

>  	int i, num_parents;
>  	unsigned long parent_rate, best = 0;
>  
>  
> @@ -820,15 +877,18 @@ int clk_prepare(struct clk *clk)
>  {
>  	int ret;
>  
> +	if (IS_ERR_OR_NULL(clk))
> +		return PTR_ERR(clk);

What's going on here? Should be if (!clk)?

> +
>  	clk_prepare_lock();
> -	ret = __clk_prepare(clk);
> +	ret = clk_core_prepare(clk->core);
>  	clk_prepare_unlock();
>  
>  	return ret;
>  }
>  EXPORT_SYMBOL_GPL(clk_prepare);
> @@ -1066,9 +1149,24 @@ long clk_get_accuracy(struct clk *clk)
>  
>  	return accuracy;
>  }
> +
> +/**
> + * clk_get_accuracy - return the accuracy of clk
> + * @clk: the clk whose accuracy is being returned
> + *
> + * Simply returns the cached accuracy of the clk, unless
> + * CLK_GET_ACCURACY_NOCACHE flag is set, which means a recalc_rate will be
> + * issued.
> + * If clk is NULL then returns 0.
> + */
> +long clk_get_accuracy(struct clk *clk)
> +{
> +	return clk_core_get_accuracy(clk->core);

Oops. Missing NULL check.

> +}
>  EXPORT_SYMBOL_GPL(clk_get_accuracy);
>  
> @@ -1130,14 +1220,29 @@ unsigned long clk_get_rate(struct clk *clk)
[...]
> + *
> + * Simply returns the cached rate of the clk, unless CLK_GET_RATE_NOCACHE flag
> + * is set, which means a recalc_rate will be issued.
> + * If clk is NULL then returns 0.
> + */
> +unsigned long clk_get_rate(struct clk *clk)
> +{
> +	return clk_core_get_rate(clk->core);

Oops. Missing NULL check.

> +}
>  EXPORT_SYMBOL_GPL(clk_get_rate);
> @@ -1629,37 +1741,26 @@ static struct clk *__clk_init_parent(struct clk *clk)
[...]
> -int clk_set_parent(struct clk *clk, struct clk *parent)
> +void __clk_reparent(struct clk *clk, struct clk *new_parent)
> +{
> +	clk_core_reparent(clk->core, new_parent->core);
> +}

Is this used? Looks like we can remove it. Sorry, not sure how I
missed this last time.

> +
> +static int clk_core_set_parent(struct clk_core *clk, struct clk_core *parent)
>  {
>  	int ret = 0;
>  	int p_index = 0;
> @@ -1719,6 +1820,28 @@ out:
[...]
> +int clk_set_parent(struct clk *clk, struct clk *parent)
> +{
> +	return clk_core_set_parent(clk->core, parent->core);

Oops. Missing NULL check for both inputs.

> +}
>  EXPORT_SYMBOL_GPL(clk_set_parent);
>  
>  /**
> @@ -1793,18 +1909,31 @@ out:
>  }
>  
>  /**
> + * clk_get_phase - return the phase shift of a clock signal
> + * @clk: clock signal source
> + *
> + * Returns the phase shift of a clock node in degrees, otherwise returns
> + * -EERROR.
> + */
> +int clk_get_phase(struct clk *clk)
> +{
> +	return clk_core_get_phase(clk->core);

Oops. Missing NULL check.

-- 
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 v9 2/3] clk: Make clk API return per-user struct clk instances
Date: Mon, 19 Jan 2015 12:59:08 -0800	[thread overview]
Message-ID: <20150119205908.GC27202@codeaurora.org> (raw)
In-Reply-To: <1421688067-24426-3-git-send-email-tomeu.vizoso@collabora.com>

On 01/19, Tomeu Vizoso wrote:
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 97f3425..f2a1ff3 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -694,32 +751,32 @@ long __clk_mux_determine_rate(struct clk_hw *hw, unsigned long rate,
>  			      unsigned long *best_parent_rate,
>  			      struct clk_hw **best_parent_p)
>  {
> -	struct clk *clk = hw->clk, *parent, *best_parent = NULL;
> +	struct clk_core *core = hw->clk->core, *parent, *best_parent = NULL;

Can't we just use hw->core here?

>  	int i, num_parents;
>  	unsigned long parent_rate, best = 0;
>  
>  
> @@ -820,15 +877,18 @@ int clk_prepare(struct clk *clk)
>  {
>  	int ret;
>  
> +	if (IS_ERR_OR_NULL(clk))
> +		return PTR_ERR(clk);

What's going on here? Should be if (!clk)?

> +
>  	clk_prepare_lock();
> -	ret = __clk_prepare(clk);
> +	ret = clk_core_prepare(clk->core);
>  	clk_prepare_unlock();
>  
>  	return ret;
>  }
>  EXPORT_SYMBOL_GPL(clk_prepare);
> @@ -1066,9 +1149,24 @@ long clk_get_accuracy(struct clk *clk)
>  
>  	return accuracy;
>  }
> +
> +/**
> + * clk_get_accuracy - return the accuracy of clk
> + * @clk: the clk whose accuracy is being returned
> + *
> + * Simply returns the cached accuracy of the clk, unless
> + * CLK_GET_ACCURACY_NOCACHE flag is set, which means a recalc_rate will be
> + * issued.
> + * If clk is NULL then returns 0.
> + */
> +long clk_get_accuracy(struct clk *clk)
> +{
> +	return clk_core_get_accuracy(clk->core);

Oops. Missing NULL check.

> +}
>  EXPORT_SYMBOL_GPL(clk_get_accuracy);
>  
> @@ -1130,14 +1220,29 @@ unsigned long clk_get_rate(struct clk *clk)
[...]
> + *
> + * Simply returns the cached rate of the clk, unless CLK_GET_RATE_NOCACHE flag
> + * is set, which means a recalc_rate will be issued.
> + * If clk is NULL then returns 0.
> + */
> +unsigned long clk_get_rate(struct clk *clk)
> +{
> +	return clk_core_get_rate(clk->core);

Oops. Missing NULL check.

> +}
>  EXPORT_SYMBOL_GPL(clk_get_rate);
> @@ -1629,37 +1741,26 @@ static struct clk *__clk_init_parent(struct clk *clk)
[...]
> -int clk_set_parent(struct clk *clk, struct clk *parent)
> +void __clk_reparent(struct clk *clk, struct clk *new_parent)
> +{
> +	clk_core_reparent(clk->core, new_parent->core);
> +}

Is this used? Looks like we can remove it. Sorry, not sure how I
missed this last time.

> +
> +static int clk_core_set_parent(struct clk_core *clk, struct clk_core *parent)
>  {
>  	int ret = 0;
>  	int p_index = 0;
> @@ -1719,6 +1820,28 @@ out:
[...]
> +int clk_set_parent(struct clk *clk, struct clk *parent)
> +{
> +	return clk_core_set_parent(clk->core, parent->core);

Oops. Missing NULL check for both inputs.

> +}
>  EXPORT_SYMBOL_GPL(clk_set_parent);
>  
>  /**
> @@ -1793,18 +1909,31 @@ out:
>  }
>  
>  /**
> + * clk_get_phase - return the phase shift of a clock signal
> + * @clk: clock signal source
> + *
> + * Returns the phase shift of a clock node in degrees, otherwise returns
> + * -EERROR.
> + */
> +int clk_get_phase(struct clk *clk)
> +{
> +	return clk_core_get_phase(clk->core);

Oops. Missing NULL check.

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

  reply	other threads:[~2015-01-19 20:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-19 17:20 [PATCH v9 0/3] Per-user clock constraints Tomeu Vizoso
2015-01-19 17:20 ` [PATCH v9 1/3] clk: Remove unneeded NULL checks Tomeu Vizoso
2015-01-19 19:19   ` Stephen Boyd
2015-01-19 17:20 ` [PATCH v9 2/3] clk: Make clk API return per-user struct clk instances Tomeu Vizoso
2015-01-19 17:20   ` Tomeu Vizoso
2015-01-19 20:59   ` Stephen Boyd [this message]
2015-01-19 20:59     ` Stephen Boyd
2015-01-20 10:14     ` Tomeu Vizoso
2015-01-20 10:14       ` Tomeu Vizoso
2015-01-19 17:21 ` [PATCH v9 3/3] clk: Add floor and ceiling constraints to clock rates Tomeu Vizoso
2015-01-19 17:21   ` Tomeu Vizoso
2015-01-20  0:00   ` Stephen Boyd
2015-01-20  0:00     ` Stephen Boyd
2015-01-20  0:00     ` Stephen Boyd
2015-01-20 13:04     ` Tomeu Vizoso
2015-01-20 13:04       ` Tomeu Vizoso
2015-01-20 13:04       ` Tomeu Vizoso

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=20150119205908.GC27202@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=javier.martinez@collabora.co.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mturquette@linaro.org \
    --cc=paul@pwsan.com \
    --cc=tomeu.vizoso@collabora.com \
    --cc=tony@atomide.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.