From: Andrzej Hajda <andrzej.hajda@intel.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
Neil Armstrong <neil.armstrong@linaro.org>,
Robert Foss <robert.foss@linaro.org>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Jonas Karlman <jonas@kwiboo.se>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/bridge: tc358767: Use devm_clk_get_enabled() helper
Date: Fri, 30 Dec 2022 16:37:41 +0100 [thread overview]
Message-ID: <eb919e0b-8dd3-00e3-a2e9-2b6daf378539@intel.com> (raw)
In-Reply-To: <4f855984ea895e1488169e77935fa6e044912ac2.1672414073.git.christophe.jaillet@wanadoo.fr>
On 30.12.2022 16:29, Christophe JAILLET wrote:
> The devm_clk_get_enabled() helper:
> - calls devm_clk_get()
> - calls clk_prepare_enable() and registers what is needed in order to
> call clk_disable_unprepare() when needed, as a managed resource.
>
> This simplifies the code and avoids the need of a dedicated function used
> with devm_add_action_or_reset().
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> drivers/gpu/drm/bridge/tc358767.c | 17 +----------------
> 1 file changed, 1 insertion(+), 16 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c
> index 2a58eb271f70..b95c36ca660d 100644
> --- a/drivers/gpu/drm/bridge/tc358767.c
> +++ b/drivers/gpu/drm/bridge/tc358767.c
> @@ -2022,13 +2022,6 @@ static int tc_probe_bridge_endpoint(struct tc_data *tc)
> return -EINVAL;
> }
>
> -static void tc_clk_disable(void *data)
> -{
> - struct clk *refclk = data;
> -
> - clk_disable_unprepare(refclk);
> -}
> -
> static int tc_probe(struct i2c_client *client, const struct i2c_device_id *id)
> {
> struct device *dev = &client->dev;
> @@ -2045,21 +2038,13 @@ static int tc_probe(struct i2c_client *client, const struct i2c_device_id *id)
> if (ret)
> return ret;
>
> - tc->refclk = devm_clk_get(dev, "ref");
> + tc->refclk = devm_clk_get_enabled(dev, "ref");
> if (IS_ERR(tc->refclk)) {
> ret = PTR_ERR(tc->refclk);
> dev_err(dev, "Failed to get refclk: %d\n", ret);
You can adjust the message and convert to dev_err_probe.
With that:
Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
Regards
Andrzej
> return ret;
> }
>
> - ret = clk_prepare_enable(tc->refclk);
> - if (ret)
> - return ret;
> -
> - ret = devm_add_action_or_reset(dev, tc_clk_disable, tc->refclk);
> - if (ret)
> - return ret;
> -
> /* tRSTW = 100 cycles , at 13 MHz that is ~7.69 us */
> usleep_range(10, 15);
>
prev parent reply other threads:[~2022-12-30 15:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-30 15:29 Christophe JAILLET
2022-12-30 15:37 ` Andrzej Hajda [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=eb919e0b-8dd3-00e3-a2e9-2b6daf378539@intel.com \
--to=andrzej.hajda@intel.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=robert.foss@linaro.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
all inboxes | Powered by JetHome®