* [PATCH net-next v2] nfc: s3fwrn5: use devm_clk_get_optional_enabled() helper
@ 2022-10-27 7:34 Dmitry Torokhov
2022-10-27 13:18 ` Krzysztof Kozlowski
2022-10-28 10:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2022-10-27 7:34 UTC (permalink / raw)
To: Krzysztof Kozlowski; +Cc: netdev, linux-kernel
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>
---
v2: remove calls to clk_disable_unprepare() as they are not needed anymore
drivers/nfc/s3fwrn5/i2c.c | 19 +++++--------------
1 file changed, 5 insertions(+), 14 deletions(-)
diff --git a/drivers/nfc/s3fwrn5/i2c.c b/drivers/nfc/s3fwrn5/i2c.c
index f824dc7099ce..ecdee838d25d 100644
--- a/drivers/nfc/s3fwrn5/i2c.c
+++ b/drivers/nfc/s3fwrn5/i2c.c
@@ -209,27 +209,21 @@ 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");
ret = s3fwrn5_probe(&phy->common.ndev, phy, &phy->i2c_dev->dev,
&i2c_phy_ops);
if (ret < 0)
- goto disable_clk;
+ return ret;
ret = devm_request_threaded_irq(&client->dev, phy->i2c_dev->irq, NULL,
s3fwrn5_i2c_irq_thread_fn, IRQF_ONESHOT,
@@ -241,8 +235,6 @@ static int s3fwrn5_i2c_probe(struct i2c_client *client,
s3fwrn5_remove:
s3fwrn5_remove(phy->common.ndev);
-disable_clk:
- clk_disable_unprepare(phy->clk);
return ret;
}
@@ -251,7 +243,6 @@ static void s3fwrn5_i2c_remove(struct i2c_client *client)
struct s3fwrn5_i2c_phy *phy = i2c_get_clientdata(client);
s3fwrn5_remove(phy->common.ndev);
- clk_disable_unprepare(phy->clk);
}
static const struct i2c_device_id s3fwrn5_i2c_id_table[] = {
--
2.38.0.135.g90850a2211-goog
--
Dmitry
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next v2] nfc: s3fwrn5: use devm_clk_get_optional_enabled() helper
2022-10-27 7:34 [PATCH net-next v2] nfc: s3fwrn5: use devm_clk_get_optional_enabled() helper Dmitry Torokhov
@ 2022-10-27 13:18 ` Krzysztof Kozlowski
2022-10-28 10:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2022-10-27 13:18 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: netdev, linux-kernel
On 27/10/2022 03:34, 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>
> ---
>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next v2] nfc: s3fwrn5: use devm_clk_get_optional_enabled() helper
2022-10-27 7:34 [PATCH net-next v2] nfc: s3fwrn5: use devm_clk_get_optional_enabled() helper Dmitry Torokhov
2022-10-27 13:18 ` Krzysztof Kozlowski
@ 2022-10-28 10:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-10-28 10:40 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: krzysztof.kozlowski, netdev, linux-kernel
Hello:
This patch was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:
On Thu, 27 Oct 2022 00:34:02 -0700 you 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>
> ---
>
> [...]
Here is the summary with links:
- [net-next,v2] nfc: s3fwrn5: use devm_clk_get_optional_enabled() helper
https://git.kernel.org/netdev/net-next/c/f8f797f35a9a
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-10-28 10:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-27 7:34 [PATCH net-next v2] nfc: s3fwrn5: use devm_clk_get_optional_enabled() helper Dmitry Torokhov
2022-10-27 13:18 ` Krzysztof Kozlowski
2022-10-28 10:40 ` patchwork-bot+netdevbpf
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.