All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Rajendra Nayak <rnayak@codeaurora.org>
Cc: mturquette@baylibre.com, linux-arm-msm@vger.kernel.org,
	linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	stanimir.varbanov@linaro.org, vivek.gautam@codeaurora.org
Subject: Re: [PATCH v2 2/5] clk: Add clk_hw_get_clk() helper API to be used by clk providers
Date: Thu, 27 Jul 2017 15:47:13 -0700	[thread overview]
Message-ID: <20170727224713.GP2146@codeaurora.org> (raw)
In-Reply-To: <1500526099-9935-3-git-send-email-rnayak@codeaurora.org>

On 07/20, Rajendra Nayak wrote:
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index fc58c52..c9bbfb3 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -186,6 +186,45 @@ const char *clk_hw_get_name(const struct clk_hw *hw)
>  }
>  EXPORT_SYMBOL_GPL(clk_hw_get_name);
>  
> +struct clk *clk_hw_get_clk(struct clk_hw *hw, const char *dev_id,
> +			   const char *con_id)
> +{
> +	return __clk_create_clk(hw, dev_id, con_id);
> +}
> +EXPORT_SYMBOL_GPL(clk_hw_get_clk);
> +
> +void clk_hw_put_clk(struct clk *clk)
> +{
> +	__clk_free_clk(clk);
> +}
> +EXPORT_SYMBOL_GPL(clk_hw_put_clk);

Isn't this just clk_put()? Not sure why we need this API.

> +
> +static void devm_clk_hw_put(struct device *dev, void *res)
> +{
> +	clk_hw_put_clk(*(struct clk **)res);
> +}

Same comment.

> +
> +struct clk *devm_clk_hw_get_clk(struct device *dev, struct clk_hw *hw,
> +				const char *con_id)
> +{
> +	struct clk **ptr, *clk;
> +
> +	ptr = devres_alloc(devm_clk_hw_put, sizeof(*ptr), GFP_KERNEL);
> +	if (!ptr)
> +		return ERR_PTR(-ENOMEM);
> +
> +	clk = clk_hw_get_clk(hw, dev_name(dev), con_id);
> +	if (!IS_ERR(clk)) {
> +		*ptr = clk;
> +		devres_add(dev, ptr);
> +	} else {
> +		devres_free(ptr);
> +	}
> +
> +	return clk;
> +}
> +EXPORT_SYMBOL_GPL(devm_clk_hw_get_clk);

Hm.. ok. Wasn't expecting us to need this API, but I guess it is
needed.

-- 
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 v2 2/5] clk: Add clk_hw_get_clk() helper API to be used by clk providers
Date: Thu, 27 Jul 2017 15:47:13 -0700	[thread overview]
Message-ID: <20170727224713.GP2146@codeaurora.org> (raw)
In-Reply-To: <1500526099-9935-3-git-send-email-rnayak@codeaurora.org>

On 07/20, Rajendra Nayak wrote:
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index fc58c52..c9bbfb3 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -186,6 +186,45 @@ const char *clk_hw_get_name(const struct clk_hw *hw)
>  }
>  EXPORT_SYMBOL_GPL(clk_hw_get_name);
>  
> +struct clk *clk_hw_get_clk(struct clk_hw *hw, const char *dev_id,
> +			   const char *con_id)
> +{
> +	return __clk_create_clk(hw, dev_id, con_id);
> +}
> +EXPORT_SYMBOL_GPL(clk_hw_get_clk);
> +
> +void clk_hw_put_clk(struct clk *clk)
> +{
> +	__clk_free_clk(clk);
> +}
> +EXPORT_SYMBOL_GPL(clk_hw_put_clk);

Isn't this just clk_put()? Not sure why we need this API.

> +
> +static void devm_clk_hw_put(struct device *dev, void *res)
> +{
> +	clk_hw_put_clk(*(struct clk **)res);
> +}

Same comment.

> +
> +struct clk *devm_clk_hw_get_clk(struct device *dev, struct clk_hw *hw,
> +				const char *con_id)
> +{
> +	struct clk **ptr, *clk;
> +
> +	ptr = devres_alloc(devm_clk_hw_put, sizeof(*ptr), GFP_KERNEL);
> +	if (!ptr)
> +		return ERR_PTR(-ENOMEM);
> +
> +	clk = clk_hw_get_clk(hw, dev_name(dev), con_id);
> +	if (!IS_ERR(clk)) {
> +		*ptr = clk;
> +		devres_add(dev, ptr);
> +	} else {
> +		devres_free(ptr);
> +	}
> +
> +	return clk;
> +}
> +EXPORT_SYMBOL_GPL(devm_clk_hw_get_clk);

Hm.. ok. Wasn't expecting us to need this API, but I guess it is
needed.

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

  reply	other threads:[~2017-07-27 22:47 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-20  4:48 [PATCH v2 0/5] clk: qcom: gdsc: Add support for clk control Rajendra Nayak
2017-07-20  4:48 ` Rajendra Nayak
2017-07-20  4:48 ` [PATCH v2 1/5] arm64: qcom: Select PM_GENERIC_DOMAINS Rajendra Nayak
2017-07-20  4:48   ` Rajendra Nayak
2017-07-28 16:42   ` Stephen Boyd
2017-07-28 16:42     ` Stephen Boyd
2017-08-08  1:28   ` Andy Gross
2017-08-08  1:28     ` Andy Gross
2017-07-20  4:48 ` [PATCH v2 2/5] clk: Add clk_hw_get_clk() helper API to be used by clk providers Rajendra Nayak
2017-07-20  4:48   ` Rajendra Nayak
2017-07-27 22:47   ` Stephen Boyd [this message]
2017-07-27 22:47     ` Stephen Boyd
2017-07-28  7:56     ` Rajendra Nayak
2017-07-28  7:56       ` Rajendra Nayak
2017-07-20  4:48 ` [PATCH v2 3/5] clk: qcom: gdsc: Add support to control associated clks Rajendra Nayak
2017-07-20  4:48   ` Rajendra Nayak
2017-07-21  8:29   ` Stanimir Varbanov
2017-07-21  8:29     ` Stanimir Varbanov
2017-07-27 23:02   ` Stephen Boyd
2017-07-27 23:02     ` Stephen Boyd
2017-07-28  8:05     ` Rajendra Nayak
2017-07-28  8:05       ` Rajendra Nayak
2017-07-28 16:37       ` Stephen Boyd
2017-07-28 16:37         ` Stephen Boyd
2017-07-31  8:25         ` Rajendra Nayak
2017-07-31  8:25           ` Rajendra Nayak
2017-08-02  4:39           ` Rajendra Nayak
2017-08-02  4:39             ` Rajendra Nayak
2017-07-20  4:48 ` [PATCH v2 4/5] clk: qcom: gcc-msm8996: Mark gcc_mmss_noc_cfg_ahb_clk as a critical clock Rajendra Nayak
2017-07-20  4:48   ` Rajendra Nayak
2017-07-27 22:51   ` Stephen Boyd
2017-07-27 22:51     ` Stephen Boyd
2017-07-28  7:58     ` Rajendra Nayak
2017-07-28  7:58       ` Rajendra Nayak
2017-07-28 16:40       ` Stephen Boyd
2017-07-28 16:40         ` Stephen Boyd
2017-07-28 17:02         ` Stephen Boyd
2017-07-28 17:02           ` Stephen Boyd
2017-07-20  4:48 ` [PATCH v2 5/5] clk: qcom: mmcc-8996: Associate all mmagic clks with mmagic gdscs Rajendra Nayak
2017-07-20  4:48   ` Rajendra Nayak
2017-07-26 14:47 ` [PATCH v2 0/5] clk: qcom: gdsc: Add support for clk control Vivek Gautam
2017-07-26 14:47   ` Vivek Gautam

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=20170727224713.GP2146@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=rnayak@codeaurora.org \
    --cc=stanimir.varbanov@linaro.org \
    --cc=vivek.gautam@codeaurora.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 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.