From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Giuseppe Cavallaro <peppe.cavallaro@st.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Jose Abreu <joabreu@synopsys.com>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Junxiao Chang <junxiao.chang@intel.com>,
Vinod Koul <vkoul@kernel.org>,
Bhupesh Sharma <bhupesh.sharma@linaro.org>
Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: [PATCH net-next v2 03/11] net: stmmac: platform: provide stmmac_pltfr_exit()
Date: Fri, 23 Jun 2023 12:04:09 +0200 [thread overview]
Message-ID: <20230623100417.93592-4-brgl@bgdev.pl> (raw)
In-Reply-To: <20230623100417.93592-1-brgl@bgdev.pl>
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Provide a helper wrapper around calling the platform's exit() callback.
This allows users to skip checking if the callback exists.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
.../ethernet/stmicro/stmmac/stmmac_platform.c | 22 ++++++++++++++-----
.../ethernet/stmicro/stmmac/stmmac_platform.h | 2 ++
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 41ca4fc9f863..5b2bc129cd85 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -720,6 +720,20 @@ int stmmac_pltfr_init(struct platform_device *pdev,
}
EXPORT_SYMBOL_GPL(stmmac_pltfr_init);
+/**
+ * stmmac_pltfr_exit
+ * @pdev: pointer to the platform device
+ * @plat: driver data platform structure
+ * Description: Call the platform's exit callback (if any).
+ */
+void stmmac_pltfr_exit(struct platform_device *pdev,
+ struct plat_stmmacenet_data *plat)
+{
+ if (plat->exit)
+ plat->exit(pdev, plat->bsp_priv);
+}
+EXPORT_SYMBOL_GPL(stmmac_pltfr_exit);
+
/**
* stmmac_pltfr_remove
* @pdev: platform device pointer
@@ -733,10 +747,7 @@ void stmmac_pltfr_remove(struct platform_device *pdev)
struct plat_stmmacenet_data *plat = priv->plat;
stmmac_dvr_remove(&pdev->dev);
-
- if (plat->exit)
- plat->exit(pdev, plat->bsp_priv);
-
+ stmmac_pltfr_exit(pdev, plat);
stmmac_remove_config_dt(pdev, plat);
}
EXPORT_SYMBOL_GPL(stmmac_pltfr_remove);
@@ -756,8 +767,7 @@ static int __maybe_unused stmmac_pltfr_suspend(struct device *dev)
struct platform_device *pdev = to_platform_device(dev);
ret = stmmac_suspend(dev);
- if (priv->plat->exit)
- priv->plat->exit(pdev, priv->plat->bsp_priv);
+ stmmac_pltfr_exit(pdev, priv->plat);
return ret;
}
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
index 6a2cd47fedcd..e79134cc1d3d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
@@ -21,6 +21,8 @@ int stmmac_get_platform_resources(struct platform_device *pdev,
int stmmac_pltfr_init(struct platform_device *pdev,
struct plat_stmmacenet_data *plat);
+void stmmac_pltfr_exit(struct platform_device *pdev,
+ struct plat_stmmacenet_data *plat);
void stmmac_pltfr_remove(struct platform_device *pdev);
extern const struct dev_pm_ops stmmac_pltfr_pm_ops;
--
2.39.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-06-23 10:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-23 10:04 [PATCH net-next v2 00/11] net: stmmac: introduce devres helpers for stmmac platform drivers Bartosz Golaszewski
2023-06-23 10:04 ` [PATCH net-next v2 01/11] net: stmmac: platform: provide stmmac_pltfr_init() Bartosz Golaszewski
2023-06-23 10:04 ` [PATCH net-next v2 02/11] net: stmmac: dwmac-generic: use stmmac_pltfr_init() Bartosz Golaszewski
2023-06-23 10:04 ` Bartosz Golaszewski [this message]
2023-06-23 10:04 ` [PATCH net-next v2 04/11] net: stmmac: dwmac-generic: use stmmac_pltfr_exit() Bartosz Golaszewski
2023-06-23 10:04 ` [PATCH net-next v2 05/11] net: stmmac: platform: provide stmmac_pltfr_probe() Bartosz Golaszewski
2023-06-23 10:04 ` [PATCH net-next v2 06/11] net: stmmac: dwmac-generic: use stmmac_pltfr_probe() Bartosz Golaszewski
2023-06-23 10:04 ` [PATCH net-next v2 07/11] net: stmmac: platform: provide stmmac_pltfr_remove_no_dt() Bartosz Golaszewski
2023-06-23 10:04 ` [PATCH net-next v2 08/11] net: stmmac: platform: provide devm_stmmac_probe_config_dt() Bartosz Golaszewski
2023-06-23 10:04 ` [PATCH net-next v2 09/11] net: stmmac: dwmac-qco-ethqos: use devm_stmmac_probe_config_dt() Bartosz Golaszewski
2023-06-23 10:04 ` [PATCH net-next v2 10/11] net: stmmac: platform: provide devm_stmmac_pltfr_probe() Bartosz Golaszewski
2023-06-23 10:04 ` [PATCH net-next v2 11/11] net: stmmac: dwmac-qcom-ethqos: use devm_stmmac_pltfr_probe() Bartosz Golaszewski
2023-06-24 22:40 ` [PATCH net-next v2 00/11] net: stmmac: introduce devres helpers for stmmac platform drivers 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=20230623100417.93592-4-brgl@bgdev.pl \
--to=brgl@bgdev.pl \
--cc=alexandre.torgue@foss.st.com \
--cc=bartosz.golaszewski@linaro.org \
--cc=bhupesh.sharma@linaro.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=joabreu@synopsys.com \
--cc=junxiao.chang@intel.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=peppe.cavallaro@st.com \
--cc=vkoul@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).