From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: davem@davemloft.net,
Pantelis Antoniou <pantelis.antoniou@gmail.com>,
Andrew Lunn <andrew@lunn.ch>, Jakub Kicinski <kuba@kernel.org>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
Russell King <linux@armlinux.org.uk>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
Florian Fainelli <f.fainelli@gmail.com>,
Heiner Kallweit <hkallweit1@gmail.com>
Cc: Maxime Chevallier <maxime.chevallier@bootlin.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
thomas.petazzoni@bootlin.com,
Herve Codina <herve.codina@bootlin.com>,
linuxppc-dev@lists.ozlabs.org
Subject: [PATCH net-next v3 7/8] net: ethernet: fs_enet: simplify clock handling with devm accessors
Date: Wed, 4 Sep 2024 19:18:20 +0200 [thread overview]
Message-ID: <20240904171822.64652-8-maxime.chevallier@bootlin.com> (raw)
In-Reply-To: <20240904171822.64652-1-maxime.chevallier@bootlin.com>
devm_clock_get_enabled() can be used to simplify clock handling for the
PER register clock.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
.../ethernet/freescale/fs_enet/fs_enet-main.c | 16 ++++------------
drivers/net/ethernet/freescale/fs_enet/fs_enet.h | 2 --
2 files changed, 4 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
index c96a6b9e1445..ec43b71c0eba 100644
--- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
+++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
@@ -900,14 +900,9 @@ static int fs_enet_probe(struct platform_device *ofdev)
* but require enable to succeed when a clock was specified/found,
* keep a reference to the clock upon successful acquisition
*/
- clk = devm_clk_get(&ofdev->dev, "per");
- if (!IS_ERR(clk)) {
- ret = clk_prepare_enable(clk);
- if (ret)
- goto out_deregister_fixed_link;
-
- fpi->clk_per = clk;
- }
+ clk = devm_clk_get_enabled(&ofdev->dev, "per");
+ if (IS_ERR(clk))
+ goto out_deregister_fixed_link;
privsize = sizeof(*fep) +
sizeof(struct sk_buff **) *
@@ -917,7 +912,7 @@ static int fs_enet_probe(struct platform_device *ofdev)
ndev = alloc_etherdev(privsize);
if (!ndev) {
ret = -ENOMEM;
- goto out_put;
+ goto out_deregister_fixed_link;
}
SET_NETDEV_DEV(ndev, &ofdev->dev);
@@ -979,8 +974,6 @@ static int fs_enet_probe(struct platform_device *ofdev)
fep->ops->cleanup_data(ndev);
out_free_dev:
free_netdev(ndev);
-out_put:
- clk_disable_unprepare(fpi->clk_per);
out_deregister_fixed_link:
of_node_put(fpi->phy_node);
if (of_phy_is_fixed_link(ofdev->dev.of_node))
@@ -1001,7 +994,6 @@ static void fs_enet_remove(struct platform_device *ofdev)
fep->ops->cleanup_data(ndev);
dev_set_drvdata(fep->dev, NULL);
of_node_put(fep->fpi->phy_node);
- clk_disable_unprepare(fep->fpi->clk_per);
if (of_phy_is_fixed_link(ofdev->dev.of_node))
of_phy_deregister_fixed_link(ofdev->dev.of_node);
free_netdev(ndev);
diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet.h b/drivers/net/ethernet/freescale/fs_enet/fs_enet.h
index ee49749a3202..6ebb1b4404c7 100644
--- a/drivers/net/ethernet/freescale/fs_enet/fs_enet.h
+++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet.h
@@ -119,8 +119,6 @@ struct fs_platform_info {
int napi_weight; /* NAPI weight */
int use_rmii; /* use RMII mode */
-
- struct clk *clk_per; /* 'per' clock for register access */
};
struct fs_enet_private {
--
2.46.0
next prev parent reply other threads:[~2024-09-04 17:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-04 17:18 [PATCH net-next v3 0/8] net: ethernet: fs_enet: Cleanup and phylink conversion Maxime Chevallier
2024-09-04 17:18 ` [PATCH net-next v3 1/8] net: ethernet: fs_enet: convert to SPDX Maxime Chevallier
2024-09-04 17:18 ` [PATCH net-next v3 2/8] net: ethernet: fs_enet: cosmetic cleanups Maxime Chevallier
2024-09-04 17:18 ` [PATCH net-next v3 3/8] net: ethernet: fs_enet: drop the .adjust_link custom fs_ops Maxime Chevallier
2024-09-04 17:18 ` [PATCH net-next v3 4/8] net: ethernet: fs_enet: only protect the .restart() call in .adjust_link Maxime Chevallier
2024-09-16 17:49 ` Russell King (Oracle)
2024-09-04 17:18 ` [PATCH net-next v3 5/8] net: ethernet: fs_enet: drop unused phy_info and mii_if_info Maxime Chevallier
2024-09-04 17:18 ` [PATCH net-next v3 6/8] net: ethernet: fs_enet: use macros for speed and duplex values Maxime Chevallier
2024-09-04 17:18 ` Maxime Chevallier [this message]
2024-09-13 20:24 ` [PATCH net-next v3 7/8] net: ethernet: fs_enet: simplify clock handling with devm accessors Christophe JAILLET
2024-09-14 8:01 ` Maxime Chevallier
2024-09-04 17:18 ` [PATCH net-next v3 8/8] net: ethernet: fs_enet: phylink conversion Maxime Chevallier
2024-09-09 9:30 ` [PATCH net-next v3 0/8] net: ethernet: fs_enet: Cleanup and " patchwork-bot+netdevbpf
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=20240904171822.64652-8-maxime.chevallier@bootlin.com \
--to=maxime.chevallier@bootlin.com \
--cc=andrew@lunn.ch \
--cc=christophe.leroy@csgroup.eu \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=herve.codina@bootlin.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pantelis.antoniou@gmail.com \
--cc=thomas.petazzoni@bootlin.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox