From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
Krzysztof Opasiak <k.opasiak@samsung.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 2/2] nfc: s3fwrn5: use devm_clk_get_optional_enabled() helper
Date: Thu, 29 Sep 2022 07:58:24 -0700 [thread overview]
Message-ID: <YzWykMgcJ6nZBi19@google.com> (raw)
In-Reply-To: <20220929050426.955139-2-dmitry.torokhov@gmail.com>
On Wed, Sep 28, 2022 at 10:04:26PM -0700, Dmitry Torokhov wrote:
> Because we enable the clock immediately after acquiring it in probe,
> we can combine the 2 operations and use devm_clk_get_optional_enabled()
> helper.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> drivers/nfc/s3fwrn5/i2c.c | 14 ++++----------
> 1 file changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/nfc/s3fwrn5/i2c.c b/drivers/nfc/s3fwrn5/i2c.c
> index fb36860df81c..2aaee2a8ff1c 100644
> --- a/drivers/nfc/s3fwrn5/i2c.c
> +++ b/drivers/nfc/s3fwrn5/i2c.c
> @@ -209,22 +209,16 @@ static int s3fwrn5_i2c_probe(struct i2c_client *client,
> if (ret < 0)
> return ret;
>
> - phy->clk = devm_clk_get_optional(&client->dev, NULL);
> - if (IS_ERR(phy->clk))
> - return dev_err_probe(&client->dev, PTR_ERR(phy->clk),
> - "failed to get clock\n");
> -
> /*
> * S3FWRN5 depends on a clock input ("XI" pin) to function properly.
> * Depending on the hardware configuration this could be an always-on
> * oscillator or some external clock that must be explicitly enabled.
> * Make sure the clock is running before starting S3FWRN5.
> */
> - ret = clk_prepare_enable(phy->clk);
> - if (ret < 0) {
> - dev_err(&client->dev, "failed to enable clock: %d\n", ret);
> - return ret;
> - }
> + phy->clk = devm_clk_get_optional_enabled(&client->dev, NULL);
> + if (IS_ERR(phy->clk))
> + return dev_err_probe(&client->dev, PTR_ERR(phy->clk),
> + "failed to get clock\n");
I forgot to remove clk_disable_unprepare() in remove method, I will
resubmit.
Thanks.
--
Dmitry
next prev parent reply other threads:[~2022-09-29 14:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-29 5:04 [PATCH net-next 1/2] nfc: s3fwrn5: fix order of freeing resources Dmitry Torokhov
2022-09-29 5:04 ` [PATCH net-next 2/2] nfc: s3fwrn5: use devm_clk_get_optional_enabled() helper Dmitry Torokhov
2022-09-29 14:58 ` Dmitry Torokhov [this message]
2022-09-29 7:26 ` [PATCH net-next 1/2] nfc: s3fwrn5: fix order of freeing resources Krzysztof Kozlowski
2022-09-29 7:27 ` Krzysztof Kozlowski
2022-09-29 7:37 ` Dmitry Torokhov
2022-09-29 7:42 ` Krzysztof Kozlowski
2022-09-29 7:51 ` Dmitry Torokhov
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=YzWykMgcJ6nZBi19@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=k.opasiak@samsung.com \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.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).