* [PATCH net-next 00/11] net: stmmac: introduce devres helpers for stmmac platform drivers
@ 2023-06-21 15:36 Bartosz Golaszewski
2023-06-21 15:36 ` [PATCH net-next 01/11] net: stmmac: platform: provide stmmac_pltfr_init() Bartosz Golaszewski
` (10 more replies)
0 siblings, 11 replies; 16+ messages in thread
From: Bartosz Golaszewski @ 2023-06-21 15:36 UTC (permalink / raw)
To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Maxime Coquelin, Junxiao Chang, Vinod Koul, Bhupesh Sharma
Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel,
Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
The goal of this series is two-fold: to make the API for stmmac platforms more
logically correct (by providing functions that acquire resources with release
counterparts that undo only their actions and nothing more) and to provide
devres variants of commonly use registration functions that allows to
significantly simplify the platform drivers.
The current pattern for stmmac platform drivers is to call
stmmac_probe_config_dt(), possibly the platform's init() callback and then
call stmmac_drv_probe(). The resources allocated by these calls will then
be released by calling stmmac_pltfr_remove(). This goes against the commonly
accepted way of providing each function that allocated a resource with a
function that frees it.
First: provide wrappers around platform's init() and exit() callbacks that
allow users to skip checking if the callbacks exist manually.
Second: provide stmmac_pltfr_probe() which calls the platform init() callback
and then calls stmmac_drv_probe() together with a variant of
stmmac_pltfr_remove() that DOES NOT call stmmac_remove_config_dt(). For now
this variant is called stmmac_pltfr_remove_no_dt() but once all users of
the old stmmac_pltfr_remove() are converted to the devres helper, it will be
renamed back to stmmac_pltfr_remove() and the no_dt function removed.
Finally use the devres helpers in dwmac-qco-ethqos to show how much simplier
the driver's probe() becomes.
This series obviously just starts the conversion process and other platform
drivers will need to be converted once the helpers land in net/.
Bartosz Golaszewski (11):
net: stmmac: platform: provide stmmac_pltfr_init()
net: stmmac: dwmac-generic: use stmmac_pltfr_init()
net: stmmac: platform: provide stmmac_pltfr_exit()
net: stmmac: dwmac-generic: use stmmac_pltfr_exit()
net: stmmac: platform: provide stmmac_pltfr_probe()
net: stmmac: dwmac-generic: use stmmac_pltfr_probe()
net: stmmac: platform: provide stmmac_pltfr_remove_no_dt()
net: stmmac: platform: provide devm_stmmac_probe_config_dt()
net: stmmac: dwmac-qco-ethqos: use devm_stmmac_probe_config_dt()
net: stmmac: platform: provide devm_stmmac_pltfr_probe()
net: stmmac: dwmac-qcom-ethqos: use devm_stmmac_pltfr_probe()
.../ethernet/stmicro/stmmac/dwmac-generic.c | 14 +-
.../stmicro/stmmac/dwmac-qcom-ethqos.c | 48 ++----
.../ethernet/stmicro/stmmac/stmmac_platform.c | 158 +++++++++++++++++-
.../ethernet/stmicro/stmmac/stmmac_platform.h | 14 ++
4 files changed, 179 insertions(+), 55 deletions(-)
--
2.39.2
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH net-next 01/11] net: stmmac: platform: provide stmmac_pltfr_init()
2023-06-21 15:36 [PATCH net-next 00/11] net: stmmac: introduce devres helpers for stmmac platform drivers Bartosz Golaszewski
@ 2023-06-21 15:36 ` Bartosz Golaszewski
2023-06-21 15:36 ` [PATCH net-next 02/11] net: stmmac: dwmac-generic: use stmmac_pltfr_init() Bartosz Golaszewski
` (9 subsequent siblings)
10 siblings, 0 replies; 16+ messages in thread
From: Bartosz Golaszewski @ 2023-06-21 15:36 UTC (permalink / raw)
To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Maxime Coquelin, Junxiao Chang, Vinod Koul, Bhupesh Sharma
Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel,
Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Provide a helper wrapper around calling the platform's init() 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 | 25 +++++++++++++++++--
.../ethernet/stmicro/stmmac/stmmac_platform.h | 3 +++
2 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 3c6b55b60461..41ca4fc9f863 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -701,6 +701,25 @@ int stmmac_get_platform_resources(struct platform_device *pdev,
}
EXPORT_SYMBOL_GPL(stmmac_get_platform_resources);
+/**
+ * stmmac_pltfr_init
+ * @pdev: pointer to the platform device
+ * @plat: driver data platform structure
+ * Description: Call the platform's init callback (if any) and propagate
+ * the return value.
+ */
+int stmmac_pltfr_init(struct platform_device *pdev,
+ struct plat_stmmacenet_data *plat)
+{
+ int ret = 0;
+
+ if (plat->init)
+ ret = plat->init(pdev, plat->bsp_priv);
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(stmmac_pltfr_init);
+
/**
* stmmac_pltfr_remove
* @pdev: platform device pointer
@@ -755,9 +774,11 @@ static int __maybe_unused stmmac_pltfr_resume(struct device *dev)
struct net_device *ndev = dev_get_drvdata(dev);
struct stmmac_priv *priv = netdev_priv(ndev);
struct platform_device *pdev = to_platform_device(dev);
+ int ret;
- if (priv->plat->init)
- priv->plat->init(pdev, priv->plat->bsp_priv);
+ ret = stmmac_pltfr_init(pdev, priv->plat->bsp_priv);
+ if (ret)
+ return ret;
return stmmac_resume(dev);
}
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
index f7e457946681..6a2cd47fedcd 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
@@ -19,6 +19,9 @@ void stmmac_remove_config_dt(struct platform_device *pdev,
int stmmac_get_platform_resources(struct platform_device *pdev,
struct stmmac_resources *stmmac_res);
+int stmmac_pltfr_init(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
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH net-next 02/11] net: stmmac: dwmac-generic: use stmmac_pltfr_init()
2023-06-21 15:36 [PATCH net-next 00/11] net: stmmac: introduce devres helpers for stmmac platform drivers Bartosz Golaszewski
2023-06-21 15:36 ` [PATCH net-next 01/11] net: stmmac: platform: provide stmmac_pltfr_init() Bartosz Golaszewski
@ 2023-06-21 15:36 ` Bartosz Golaszewski
2023-06-21 15:36 ` [PATCH net-next 03/11] net: stmmac: platform: provide stmmac_pltfr_exit() Bartosz Golaszewski
` (8 subsequent siblings)
10 siblings, 0 replies; 16+ messages in thread
From: Bartosz Golaszewski @ 2023-06-21 15:36 UTC (permalink / raw)
To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Maxime Coquelin, Junxiao Chang, Vinod Koul, Bhupesh Sharma
Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel,
Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Shrink the code in dwmac-generic by using the new stmmac_pltfr_init()
helper.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
index ef1023930fd0..b7fc79864e8c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
@@ -47,11 +47,9 @@ static int dwmac_generic_probe(struct platform_device *pdev)
}
/* Custom initialisation (if needed) */
- if (plat_dat->init) {
- ret = plat_dat->init(pdev, plat_dat->bsp_priv);
- if (ret)
- goto err_remove_config_dt;
- }
+ ret = stmmac_pltfr_init(pdev, plat_dat);
+ if (ret)
+ goto err_remove_config_dt;
ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
if (ret)
--
2.39.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH net-next 03/11] net: stmmac: platform: provide stmmac_pltfr_exit()
2023-06-21 15:36 [PATCH net-next 00/11] net: stmmac: introduce devres helpers for stmmac platform drivers Bartosz Golaszewski
2023-06-21 15:36 ` [PATCH net-next 01/11] net: stmmac: platform: provide stmmac_pltfr_init() Bartosz Golaszewski
2023-06-21 15:36 ` [PATCH net-next 02/11] net: stmmac: dwmac-generic: use stmmac_pltfr_init() Bartosz Golaszewski
@ 2023-06-21 15:36 ` Bartosz Golaszewski
2023-06-21 15:36 ` [PATCH net-next 04/11] net: stmmac: dwmac-generic: use stmmac_pltfr_exit() Bartosz Golaszewski
` (7 subsequent siblings)
10 siblings, 0 replies; 16+ messages in thread
From: Bartosz Golaszewski @ 2023-06-21 15:36 UTC (permalink / raw)
To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Maxime Coquelin, Junxiao Chang, Vinod Koul, Bhupesh Sharma
Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel,
Bartosz Golaszewski
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
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH net-next 04/11] net: stmmac: dwmac-generic: use stmmac_pltfr_exit()
2023-06-21 15:36 [PATCH net-next 00/11] net: stmmac: introduce devres helpers for stmmac platform drivers Bartosz Golaszewski
` (2 preceding siblings ...)
2023-06-21 15:36 ` [PATCH net-next 03/11] net: stmmac: platform: provide stmmac_pltfr_exit() Bartosz Golaszewski
@ 2023-06-21 15:36 ` Bartosz Golaszewski
2023-06-21 15:36 ` [PATCH net-next 05/11] net: stmmac: platform: provide stmmac_pltfr_probe() Bartosz Golaszewski
` (6 subsequent siblings)
10 siblings, 0 replies; 16+ messages in thread
From: Bartosz Golaszewski @ 2023-06-21 15:36 UTC (permalink / raw)
To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Maxime Coquelin, Junxiao Chang, Vinod Koul, Bhupesh Sharma
Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel,
Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Shrink the code in dwmac-generic by using the new stmmac_pltfr_exit()
helper.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
index b7fc79864e8c..dabf05601221 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
@@ -58,8 +58,7 @@ static int dwmac_generic_probe(struct platform_device *pdev)
return 0;
err_exit:
- if (plat_dat->exit)
- plat_dat->exit(pdev, plat_dat->bsp_priv);
+ stmmac_pltfr_exit(pdev, plat_dat);
err_remove_config_dt:
if (pdev->dev.of_node)
stmmac_remove_config_dt(pdev, plat_dat);
--
2.39.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH net-next 05/11] net: stmmac: platform: provide stmmac_pltfr_probe()
2023-06-21 15:36 [PATCH net-next 00/11] net: stmmac: introduce devres helpers for stmmac platform drivers Bartosz Golaszewski
` (3 preceding siblings ...)
2023-06-21 15:36 ` [PATCH net-next 04/11] net: stmmac: dwmac-generic: use stmmac_pltfr_exit() Bartosz Golaszewski
@ 2023-06-21 15:36 ` Bartosz Golaszewski
2023-06-21 15:36 ` [PATCH net-next 06/11] net: stmmac: dwmac-generic: use stmmac_pltfr_probe() Bartosz Golaszewski
` (5 subsequent siblings)
10 siblings, 0 replies; 16+ messages in thread
From: Bartosz Golaszewski @ 2023-06-21 15:36 UTC (permalink / raw)
To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Maxime Coquelin, Junxiao Chang, Vinod Koul, Bhupesh Sharma
Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel,
Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Implement stmmac_pltfr_probe() which is the logical API counterpart
for stmmac_pltfr_remove(). It calls the platform's init() callback and
then probes the stmmac device.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
.../ethernet/stmicro/stmmac/stmmac_platform.c | 28 +++++++++++++++++++
.../ethernet/stmicro/stmmac/stmmac_platform.h | 3 ++
2 files changed, 31 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 5b2bc129cd85..df417cdab8c1 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -734,6 +734,34 @@ void stmmac_pltfr_exit(struct platform_device *pdev,
}
EXPORT_SYMBOL_GPL(stmmac_pltfr_exit);
+/**
+ * stmmac_pltfr_probe
+ * @pdev: platform device pointer
+ * @plat: driver data platform structure
+ * @res: stmmac resources structure
+ * Description: This calls the platform's init() callback and probes the
+ * stmmac driver.
+ */
+int stmmac_pltfr_probe(struct platform_device *pdev,
+ struct plat_stmmacenet_data *plat,
+ struct stmmac_resources *res)
+{
+ int ret;
+
+ ret = stmmac_pltfr_init(pdev, plat);
+ if (ret)
+ return ret;
+
+ ret = stmmac_dvr_probe(&pdev->dev, plat, res);
+ if (ret) {
+ stmmac_pltfr_exit(pdev, plat);
+ return ret;
+ }
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(stmmac_pltfr_probe);
+
/**
* stmmac_pltfr_remove
* @pdev: platform device pointer
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
index e79134cc1d3d..f968e658c9d2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
@@ -24,6 +24,9 @@ int stmmac_pltfr_init(struct platform_device *pdev,
void stmmac_pltfr_exit(struct platform_device *pdev,
struct plat_stmmacenet_data *plat);
+int stmmac_pltfr_probe(struct platform_device *pdev,
+ struct plat_stmmacenet_data *plat,
+ struct stmmac_resources *res);
void stmmac_pltfr_remove(struct platform_device *pdev);
extern const struct dev_pm_ops stmmac_pltfr_pm_ops;
--
2.39.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH net-next 06/11] net: stmmac: dwmac-generic: use stmmac_pltfr_probe()
2023-06-21 15:36 [PATCH net-next 00/11] net: stmmac: introduce devres helpers for stmmac platform drivers Bartosz Golaszewski
` (4 preceding siblings ...)
2023-06-21 15:36 ` [PATCH net-next 05/11] net: stmmac: platform: provide stmmac_pltfr_probe() Bartosz Golaszewski
@ 2023-06-21 15:36 ` Bartosz Golaszewski
2023-06-21 15:36 ` [PATCH net-next 07/11] net: stmmac: platform: provide stmmac_pltfr_remove_no_dt() Bartosz Golaszewski
` (4 subsequent siblings)
10 siblings, 0 replies; 16+ messages in thread
From: Bartosz Golaszewski @ 2023-06-21 15:36 UTC (permalink / raw)
To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Maxime Coquelin, Junxiao Chang, Vinod Koul, Bhupesh Sharma
Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel,
Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Shrink the code and remove labels by using the new stmmac_pltfr_probe()
function.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
index dabf05601221..20fc455b3337 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c
@@ -46,19 +46,12 @@ static int dwmac_generic_probe(struct platform_device *pdev)
plat_dat->unicast_filter_entries = 1;
}
- /* Custom initialisation (if needed) */
- ret = stmmac_pltfr_init(pdev, plat_dat);
+ ret = stmmac_pltfr_probe(pdev, plat_dat, &stmmac_res);
if (ret)
goto err_remove_config_dt;
- ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
- if (ret)
- goto err_exit;
-
return 0;
-err_exit:
- stmmac_pltfr_exit(pdev, plat_dat);
err_remove_config_dt:
if (pdev->dev.of_node)
stmmac_remove_config_dt(pdev, plat_dat);
--
2.39.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH net-next 07/11] net: stmmac: platform: provide stmmac_pltfr_remove_no_dt()
2023-06-21 15:36 [PATCH net-next 00/11] net: stmmac: introduce devres helpers for stmmac platform drivers Bartosz Golaszewski
` (5 preceding siblings ...)
2023-06-21 15:36 ` [PATCH net-next 06/11] net: stmmac: dwmac-generic: use stmmac_pltfr_probe() Bartosz Golaszewski
@ 2023-06-21 15:36 ` Bartosz Golaszewski
2023-06-22 12:14 ` Simon Horman
2023-06-21 15:36 ` [PATCH net-next 08/11] net: stmmac: platform: provide devm_stmmac_probe_config_dt() Bartosz Golaszewski
` (3 subsequent siblings)
10 siblings, 1 reply; 16+ messages in thread
From: Bartosz Golaszewski @ 2023-06-21 15:36 UTC (permalink / raw)
To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Maxime Coquelin, Junxiao Chang, Vinod Koul, Bhupesh Sharma
Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel,
Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Add a variant of stmmac_pltfr_remove() that only frees resources
allocated by stmmac_pltfr_probe() and - unlike stmmac_pltfr_remove() -
does not call stmmac_remove_config_dt().
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
.../ethernet/stmicro/stmmac/stmmac_platform.c | 20 +++++++++++++++++--
.../ethernet/stmicro/stmmac/stmmac_platform.h | 1 +
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index df417cdab8c1..58d5c5cc2269 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -762,6 +762,23 @@ int stmmac_pltfr_probe(struct platform_device *pdev,
}
EXPORT_SYMBOL_GPL(stmmac_pltfr_probe);
+/**
+ * stmmac_pltfr_remove_no_dt
+ * @pdev: pointer to the platform device
+ * Description: This undoes the effects of stmmac_pltfr_probe() by removing the
+ * driver and calling the platform's exit() callback.
+ */
+void stmmac_pltfr_remove_no_dt(struct platform_device *pdev)
+{
+ struct net_device *ndev = platform_get_drvdata(pdev);
+ struct stmmac_priv *priv = netdev_priv(ndev);
+ struct plat_stmmacenet_data *plat = priv->plat;
+
+ stmmac_dvr_remove(&pdev->dev);
+ stmmac_pltfr_exit(pdev, plat);
+}
+EXPORT_SYMBOL_GPL(stmmac_pltfr_remove_no_dt);
+
/**
* stmmac_pltfr_remove
* @pdev: platform device pointer
@@ -774,8 +791,7 @@ void stmmac_pltfr_remove(struct platform_device *pdev)
struct stmmac_priv *priv = netdev_priv(ndev);
struct plat_stmmacenet_data *plat = priv->plat;
- stmmac_dvr_remove(&pdev->dev);
- stmmac_pltfr_exit(pdev, plat);
+ stmmac_pltfr_remove_no_dt(pdev);
stmmac_remove_config_dt(pdev, plat);
}
EXPORT_SYMBOL_GPL(stmmac_pltfr_remove);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
index f968e658c9d2..af52d5aa2b9a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
@@ -27,6 +27,7 @@ void stmmac_pltfr_exit(struct platform_device *pdev,
int stmmac_pltfr_probe(struct platform_device *pdev,
struct plat_stmmacenet_data *plat,
struct stmmac_resources *res);
+void stmmac_pltfr_remove_no_dt(struct platform_device *pdev);
void stmmac_pltfr_remove(struct platform_device *pdev);
extern const struct dev_pm_ops stmmac_pltfr_pm_ops;
--
2.39.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH net-next 08/11] net: stmmac: platform: provide devm_stmmac_probe_config_dt()
2023-06-21 15:36 [PATCH net-next 00/11] net: stmmac: introduce devres helpers for stmmac platform drivers Bartosz Golaszewski
` (6 preceding siblings ...)
2023-06-21 15:36 ` [PATCH net-next 07/11] net: stmmac: platform: provide stmmac_pltfr_remove_no_dt() Bartosz Golaszewski
@ 2023-06-21 15:36 ` Bartosz Golaszewski
2023-06-22 2:48 ` kernel test robot
2023-06-21 15:36 ` [PATCH net-next 09/11] net: stmmac: dwmac-qco-ethqos: use devm_stmmac_probe_config_dt() Bartosz Golaszewski
` (2 subsequent siblings)
10 siblings, 1 reply; 16+ messages in thread
From: Bartosz Golaszewski @ 2023-06-21 15:36 UTC (permalink / raw)
To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Maxime Coquelin, Junxiao Chang, Vinod Koul, Bhupesh Sharma
Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel,
Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Provide a devres variant of stmmac_probe_config_dt() that allows users to
skip calling stmmac_remove_config_dt() at driver detach.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
.../ethernet/stmicro/stmmac/stmmac_platform.c | 35 +++++++++++++++++++
.../ethernet/stmicro/stmmac/stmmac_platform.h | 2 ++
2 files changed, 37 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 58d5c5cc2269..043fdfdef6d4 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -8,6 +8,7 @@
Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
*******************************************************************************/
+#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/module.h>
@@ -629,6 +630,39 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)
return ret;
}
+static void devm_stmmac_remove_config_dt(void *data)
+{
+ struct plat_stmmacenet_data *plat = data;
+
+ /* Platform data argument is unused */
+ stmmac_remove_config_dt(NULL, plat);
+}
+
+/**
+ * devm_stmmac_probe_config_dt
+ * @pdev: platform_device structure
+ * @mac: MAC address to use
+ * Description: Devres variant of stmmac_probe_config_dt(). Does not require
+ * the user to call stmmac_remove_config_dt() at driver detach.
+ */
+struct plat_stmmacenet_data *
+devm_stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)
+{
+ struct plat_stmmacenet_data *plat;
+ int ret;
+
+ plat = stmmac_probe_config_dt(pdev, mac);
+ if (IS_ERR(plat))
+ return plat;
+
+ ret = devm_add_action_or_reset(&pdev->dev,
+ devm_stmmac_remove_config_dt, plat);
+ if (ret)
+ return ERR_PTR(ret);
+
+ return plat;
+}
+
/**
* stmmac_remove_config_dt - undo the effects of stmmac_probe_config_dt()
* @pdev: platform_device structure
@@ -657,6 +691,7 @@ void stmmac_remove_config_dt(struct platform_device *pdev,
}
#endif /* CONFIG_OF */
EXPORT_SYMBOL_GPL(stmmac_probe_config_dt);
+EXPORT_SYMBOL_GPL(devm_stmmac_probe_config_dt);
EXPORT_SYMBOL_GPL(stmmac_remove_config_dt);
int stmmac_get_platform_resources(struct platform_device *pdev,
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
index af52d5aa2b9a..8c1e5b2e9dae 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
@@ -13,6 +13,8 @@
struct plat_stmmacenet_data *
stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac);
+struct plat_stmmacenet_data *
+devm_stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac);
void stmmac_remove_config_dt(struct platform_device *pdev,
struct plat_stmmacenet_data *plat);
--
2.39.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH net-next 09/11] net: stmmac: dwmac-qco-ethqos: use devm_stmmac_probe_config_dt()
2023-06-21 15:36 [PATCH net-next 00/11] net: stmmac: introduce devres helpers for stmmac platform drivers Bartosz Golaszewski
` (7 preceding siblings ...)
2023-06-21 15:36 ` [PATCH net-next 08/11] net: stmmac: platform: provide devm_stmmac_probe_config_dt() Bartosz Golaszewski
@ 2023-06-21 15:36 ` Bartosz Golaszewski
2023-06-21 15:36 ` [PATCH net-next 10/11] net: stmmac: platform: provide devm_stmmac_pltfr_probe() Bartosz Golaszewski
2023-06-21 15:36 ` [PATCH net-next 11/11] net: stmmac: dwmac-qcom-ethqos: use devm_stmmac_pltfr_probe() Bartosz Golaszewski
10 siblings, 0 replies; 16+ messages in thread
From: Bartosz Golaszewski @ 2023-06-21 15:36 UTC (permalink / raw)
To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Maxime Coquelin, Junxiao Chang, Vinod Koul, Bhupesh Sharma
Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel,
Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Significantly simplify the driver's probe() function by using the devres
variant of stmmac_probe_config_dt(). This allows to drop the goto jumps
entirely.
The remove_new() callback now needs to be switched to
stmmac_pltfr_remove_no_dt().
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
.../stmicro/stmmac/dwmac-qcom-ethqos.c | 49 ++++++-------------
1 file changed, 15 insertions(+), 34 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
index fa0fc53c56a3..7b9fbcb8d84d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
@@ -708,7 +708,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
if (ret)
return ret;
- plat_dat = stmmac_probe_config_dt(pdev, stmmac_res.mac);
+ plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac);
if (IS_ERR(plat_dat)) {
dev_err(dev, "dt configuration failed\n");
return PTR_ERR(plat_dat);
@@ -717,10 +717,8 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
plat_dat->clks_config = ethqos_clks_config;
ethqos = devm_kzalloc(dev, sizeof(*ethqos), GFP_KERNEL);
- if (!ethqos) {
- ret = -ENOMEM;
- goto out_config_dt;
- }
+ if (!ethqos)
+ return -ENOMEM;
ethqos->phy_mode = device_get_phy_mode(dev);
switch (ethqos->phy_mode) {
@@ -734,19 +732,15 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
ethqos->configure_func = ethqos_configure_sgmii;
break;
case -ENODEV:
- ret = -ENODEV;
- goto out_config_dt;
+ return -ENODEV;
default:
- ret = -EINVAL;
- goto out_config_dt;
+ return -EINVAL;
}
ethqos->pdev = pdev;
ethqos->rgmii_base = devm_platform_ioremap_resource_byname(pdev, "rgmii");
- if (IS_ERR(ethqos->rgmii_base)) {
- ret = PTR_ERR(ethqos->rgmii_base);
- goto out_config_dt;
- }
+ if (IS_ERR(ethqos->rgmii_base))
+ return PTR_ERR(ethqos->rgmii_base);
ethqos->mac_base = stmmac_res.addr;
@@ -757,24 +751,20 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
ethqos->has_emac_ge_3 = data->has_emac_ge_3;
ethqos->link_clk = devm_clk_get(dev, data->link_clk_name ?: "rgmii");
- if (IS_ERR(ethqos->link_clk)) {
- ret = PTR_ERR(ethqos->link_clk);
- goto out_config_dt;
- }
+ if (IS_ERR(ethqos->link_clk))
+ return PTR_ERR(ethqos->link_clk);
ret = ethqos_clks_config(ethqos, true);
if (ret)
- goto out_config_dt;
+ return ret;
ret = devm_add_action_or_reset(dev, ethqos_clks_disable, ethqos);
if (ret)
- goto out_config_dt;
+ return ret;
ethqos->serdes_phy = devm_phy_optional_get(dev, "serdes");
- if (IS_ERR(ethqos->serdes_phy)) {
- ret = PTR_ERR(ethqos->serdes_phy);
- goto out_config_dt;
- }
+ if (IS_ERR(ethqos->serdes_phy))
+ return PTR_ERR(ethqos->serdes_phy);
ethqos->speed = SPEED_1000;
ethqos_update_link_clk(ethqos, SPEED_1000);
@@ -797,16 +787,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
plat_dat->serdes_powerdown = qcom_ethqos_serdes_powerdown;
}
- ret = stmmac_dvr_probe(dev, plat_dat, &stmmac_res);
- if (ret)
- goto out_config_dt;
-
- return ret;
-
-out_config_dt:
- stmmac_remove_config_dt(pdev, plat_dat);
-
- return ret;
+ return stmmac_dvr_probe(dev, plat_dat, &stmmac_res);
}
static const struct of_device_id qcom_ethqos_match[] = {
@@ -820,7 +801,7 @@ MODULE_DEVICE_TABLE(of, qcom_ethqos_match);
static struct platform_driver qcom_ethqos_driver = {
.probe = qcom_ethqos_probe,
- .remove_new = stmmac_pltfr_remove,
+ .remove_new = stmmac_pltfr_remove_no_dt,
.driver = {
.name = "qcom-ethqos",
.pm = &stmmac_pltfr_pm_ops,
--
2.39.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH net-next 10/11] net: stmmac: platform: provide devm_stmmac_pltfr_probe()
2023-06-21 15:36 [PATCH net-next 00/11] net: stmmac: introduce devres helpers for stmmac platform drivers Bartosz Golaszewski
` (8 preceding siblings ...)
2023-06-21 15:36 ` [PATCH net-next 09/11] net: stmmac: dwmac-qco-ethqos: use devm_stmmac_probe_config_dt() Bartosz Golaszewski
@ 2023-06-21 15:36 ` Bartosz Golaszewski
2023-06-21 15:36 ` [PATCH net-next 11/11] net: stmmac: dwmac-qcom-ethqos: use devm_stmmac_pltfr_probe() Bartosz Golaszewski
10 siblings, 0 replies; 16+ messages in thread
From: Bartosz Golaszewski @ 2023-06-21 15:36 UTC (permalink / raw)
To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Maxime Coquelin, Junxiao Chang, Vinod Koul, Bhupesh Sharma
Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel,
Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Provide a devres variant of stmmac_pltfr_probe() which allows users to
skip calling stmmac_pltfr_remove() at driver detach.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
.../ethernet/stmicro/stmmac/stmmac_platform.c | 30 +++++++++++++++++++
.../ethernet/stmicro/stmmac/stmmac_platform.h | 3 ++
2 files changed, 33 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 043fdfdef6d4..6b0dce6cb661 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -797,6 +797,36 @@ int stmmac_pltfr_probe(struct platform_device *pdev,
}
EXPORT_SYMBOL_GPL(stmmac_pltfr_probe);
+static void devm_stmmac_pltfr_remove(void *data)
+{
+ struct platform_device *pdev = data;
+
+ stmmac_pltfr_remove_no_dt(pdev);
+}
+
+/**
+ * devm_stmmac_pltfr_probe
+ * @pdev: pointer to the platform device
+ * @plat: driver data platform structure
+ * @res: stmmac resources
+ * Description: Devres variant of stmmac_pltfr_probe(). Allows users to skip
+ * calling stmmac_pltfr_remove() on driver detach.
+ */
+int devm_stmmac_pltfr_probe(struct platform_device *pdev,
+ struct plat_stmmacenet_data *plat,
+ struct stmmac_resources *res)
+{
+ int ret;
+
+ ret = stmmac_pltfr_probe(pdev, plat, res);
+ if (ret)
+ return ret;
+
+ return devm_add_action_or_reset(&pdev->dev, devm_stmmac_pltfr_remove,
+ pdev);
+}
+EXPORT_SYMBOL_GPL(devm_stmmac_pltfr_probe);
+
/**
* stmmac_pltfr_remove_no_dt
* @pdev: pointer to the platform device
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
index 8c1e5b2e9dae..c5565b2a70ac 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
@@ -29,6 +29,9 @@ void stmmac_pltfr_exit(struct platform_device *pdev,
int stmmac_pltfr_probe(struct platform_device *pdev,
struct plat_stmmacenet_data *plat,
struct stmmac_resources *res);
+int devm_stmmac_pltfr_probe(struct platform_device *pdev,
+ struct plat_stmmacenet_data *plat,
+ struct stmmac_resources *res);
void stmmac_pltfr_remove_no_dt(struct platform_device *pdev);
void stmmac_pltfr_remove(struct platform_device *pdev);
extern const struct dev_pm_ops stmmac_pltfr_pm_ops;
--
2.39.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH net-next 11/11] net: stmmac: dwmac-qcom-ethqos: use devm_stmmac_pltfr_probe()
2023-06-21 15:36 [PATCH net-next 00/11] net: stmmac: introduce devres helpers for stmmac platform drivers Bartosz Golaszewski
` (9 preceding siblings ...)
2023-06-21 15:36 ` [PATCH net-next 10/11] net: stmmac: platform: provide devm_stmmac_pltfr_probe() Bartosz Golaszewski
@ 2023-06-21 15:36 ` Bartosz Golaszewski
10 siblings, 0 replies; 16+ messages in thread
From: Bartosz Golaszewski @ 2023-06-21 15:36 UTC (permalink / raw)
To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Maxime Coquelin, Junxiao Chang, Vinod Koul, Bhupesh Sharma
Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel,
Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Use the devres variant of stmmac_pltfr_probe() and finally drop the
remove() callback entirely.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
index 7b9fbcb8d84d..e62940414e54 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
@@ -787,7 +787,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
plat_dat->serdes_powerdown = qcom_ethqos_serdes_powerdown;
}
- return stmmac_dvr_probe(dev, plat_dat, &stmmac_res);
+ return devm_stmmac_pltfr_probe(pdev, plat_dat, &stmmac_res);
}
static const struct of_device_id qcom_ethqos_match[] = {
@@ -801,7 +801,6 @@ MODULE_DEVICE_TABLE(of, qcom_ethqos_match);
static struct platform_driver qcom_ethqos_driver = {
.probe = qcom_ethqos_probe,
- .remove_new = stmmac_pltfr_remove_no_dt,
.driver = {
.name = "qcom-ethqos",
.pm = &stmmac_pltfr_pm_ops,
--
2.39.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH net-next 08/11] net: stmmac: platform: provide devm_stmmac_probe_config_dt()
2023-06-21 15:36 ` [PATCH net-next 08/11] net: stmmac: platform: provide devm_stmmac_probe_config_dt() Bartosz Golaszewski
@ 2023-06-22 2:48 ` kernel test robot
2023-06-22 12:45 ` Bartosz Golaszewski
0 siblings, 1 reply; 16+ messages in thread
From: kernel test robot @ 2023-06-22 2:48 UTC (permalink / raw)
To: Bartosz Golaszewski, Giuseppe Cavallaro, Alexandre Torgue,
Jose Abreu, David S . Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Maxime Coquelin, Junxiao Chang, Vinod Koul,
Bhupesh Sharma
Cc: oe-kbuild-all, netdev, linux-stm32, linux-arm-kernel,
linux-kernel, Bartosz Golaszewski
Hi Bartosz,
kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Bartosz-Golaszewski/net-stmmac-platform-provide-stmmac_pltfr_init/20230621-234133
base: net-next/main
patch link: https://lore.kernel.org/r/20230621153650.440350-9-brgl%40bgdev.pl
patch subject: [PATCH net-next 08/11] net: stmmac: platform: provide devm_stmmac_probe_config_dt()
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20230622/202306221025.K6fKRmj7-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230622/202306221025.K6fKRmj7-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202306221025.K6fKRmj7-lkp@intel.com/
All errors (new ones prefixed by >>):
ld: vmlinux.o: in function `__ksymtab_devm_stmmac_probe_config_dt':
>> stmmac_platform.c:(___ksymtab_gpl+devm_stmmac_probe_config_dt+0x0): undefined reference to `devm_stmmac_probe_config_dt'
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next 07/11] net: stmmac: platform: provide stmmac_pltfr_remove_no_dt()
2023-06-21 15:36 ` [PATCH net-next 07/11] net: stmmac: platform: provide stmmac_pltfr_remove_no_dt() Bartosz Golaszewski
@ 2023-06-22 12:14 ` Simon Horman
2023-06-22 12:25 ` Bartosz Golaszewski
0 siblings, 1 reply; 16+ messages in thread
From: Simon Horman @ 2023-06-22 12:14 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Maxime Coquelin, Junxiao Chang, Vinod Koul, Bhupesh Sharma,
netdev, linux-stm32, linux-arm-kernel, linux-kernel,
Bartosz Golaszewski
On Wed, Jun 21, 2023 at 05:36:46PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> Add a variant of stmmac_pltfr_remove() that only frees resources
> allocated by stmmac_pltfr_probe() and - unlike stmmac_pltfr_remove() -
> does not call stmmac_remove_config_dt().
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
> .../ethernet/stmicro/stmmac/stmmac_platform.c | 20 +++++++++++++++++--
> .../ethernet/stmicro/stmmac/stmmac_platform.h | 1 +
> 2 files changed, 19 insertions(+), 2 deletions(-)
>
Hi Bartosz,
some minor feedback from my side as it looks like there will be a v2 anyway.
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> index df417cdab8c1..58d5c5cc2269 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> @@ -762,6 +762,23 @@ int stmmac_pltfr_probe(struct platform_device *pdev,
> }
> EXPORT_SYMBOL_GPL(stmmac_pltfr_probe);
>
> +/**
> + * stmmac_pltfr_remove_no_dt
> + * @pdev: pointer to the platform device
> + * Description: This undoes the effects of stmmac_pltfr_probe() by removing the
> + * driver and calling the platform's exit() callback.
> + */
> +void stmmac_pltfr_remove_no_dt(struct platform_device *pdev)
> +{
> + struct net_device *ndev = platform_get_drvdata(pdev);
> + struct stmmac_priv *priv = netdev_priv(ndev);
> + struct plat_stmmacenet_data *plat = priv->plat;
nit: please use reverse xmas tree - longest line to shortest - for
new Networking code.
e.g.:
struct net_device *ndev = platform_get_drvdata(pdev);
struct stmmac_priv *priv = netdev_priv(ndev);
struct plat_stmmacenet_data *plat = plat;
plat = priv->plat;
> +
> + stmmac_dvr_remove(&pdev->dev);
> + stmmac_pltfr_exit(pdev, plat);
> +}
> +EXPORT_SYMBOL_GPL(stmmac_pltfr_remove_no_dt);
> +
> /**
> * stmmac_pltfr_remove
> * @pdev: platform device pointer
...
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next 07/11] net: stmmac: platform: provide stmmac_pltfr_remove_no_dt()
2023-06-22 12:14 ` Simon Horman
@ 2023-06-22 12:25 ` Bartosz Golaszewski
0 siblings, 0 replies; 16+ messages in thread
From: Bartosz Golaszewski @ 2023-06-22 12:25 UTC (permalink / raw)
To: Simon Horman
Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Maxime Coquelin, Junxiao Chang, Vinod Koul, Bhupesh Sharma,
netdev, linux-stm32, linux-arm-kernel, linux-kernel,
Bartosz Golaszewski
On Thu, Jun 22, 2023 at 2:15 PM Simon Horman <simon.horman@corigine.com> wrote:
>
> On Wed, Jun 21, 2023 at 05:36:46PM +0200, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> >
> > Add a variant of stmmac_pltfr_remove() that only frees resources
> > allocated by stmmac_pltfr_probe() and - unlike stmmac_pltfr_remove() -
> > does not call stmmac_remove_config_dt().
> >
> > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> > ---
> > .../ethernet/stmicro/stmmac/stmmac_platform.c | 20 +++++++++++++++++--
> > .../ethernet/stmicro/stmmac/stmmac_platform.h | 1 +
> > 2 files changed, 19 insertions(+), 2 deletions(-)
> >
>
> Hi Bartosz,
>
> some minor feedback from my side as it looks like there will be a v2 anyway.
>
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> > index df417cdab8c1..58d5c5cc2269 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> > @@ -762,6 +762,23 @@ int stmmac_pltfr_probe(struct platform_device *pdev,
> > }
> > EXPORT_SYMBOL_GPL(stmmac_pltfr_probe);
> >
> > +/**
> > + * stmmac_pltfr_remove_no_dt
> > + * @pdev: pointer to the platform device
> > + * Description: This undoes the effects of stmmac_pltfr_probe() by removing the
> > + * driver and calling the platform's exit() callback.
> > + */
> > +void stmmac_pltfr_remove_no_dt(struct platform_device *pdev)
> > +{
> > + struct net_device *ndev = platform_get_drvdata(pdev);
> > + struct stmmac_priv *priv = netdev_priv(ndev);
> > + struct plat_stmmacenet_data *plat = priv->plat;
>
> nit: please use reverse xmas tree - longest line to shortest - for
> new Networking code.
>
> e.g.:
>
> struct net_device *ndev = platform_get_drvdata(pdev);
> struct stmmac_priv *priv = netdev_priv(ndev);
> struct plat_stmmacenet_data *plat = plat;
>
> plat = priv->plat;
>
I normally stick to this convention but here, you need 5 lines for the
same effect and you make it more confusing by initializing some of the
variables at their declaration and some not. In other places in this
driver the same approach is used i.e. not adhering to reverse xmas
tree when all variables are initialized when declared.
Bart
> > +
> > + stmmac_dvr_remove(&pdev->dev);
> > + stmmac_pltfr_exit(pdev, plat);
> > +}
> > +EXPORT_SYMBOL_GPL(stmmac_pltfr_remove_no_dt);
> > +
> > /**
> > * stmmac_pltfr_remove
> > * @pdev: platform device pointer
>
> ...
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next 08/11] net: stmmac: platform: provide devm_stmmac_probe_config_dt()
2023-06-22 2:48 ` kernel test robot
@ 2023-06-22 12:45 ` Bartosz Golaszewski
0 siblings, 0 replies; 16+ messages in thread
From: Bartosz Golaszewski @ 2023-06-22 12:45 UTC (permalink / raw)
To: kernel test robot
Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Maxime Coquelin, Junxiao Chang, Vinod Koul, Bhupesh Sharma,
oe-kbuild-all, netdev, linux-stm32, linux-arm-kernel,
linux-kernel, Bartosz Golaszewski
On Thu, Jun 22, 2023 at 4:49 AM kernel test robot <lkp@intel.com> wrote:
>
> Hi Bartosz,
>
> kernel test robot noticed the following build errors:
>
> [auto build test ERROR on net-next/main]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Bartosz-Golaszewski/net-stmmac-platform-provide-stmmac_pltfr_init/20230621-234133
> base: net-next/main
> patch link: https://lore.kernel.org/r/20230621153650.440350-9-brgl%40bgdev.pl
> patch subject: [PATCH net-next 08/11] net: stmmac: platform: provide devm_stmmac_probe_config_dt()
> config: x86_64-kexec (https://download.01.org/0day-ci/archive/20230622/202306221025.K6fKRmj7-lkp@intel.com/config)
> compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
> reproduce: (https://download.01.org/0day-ci/archive/20230622/202306221025.K6fKRmj7-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202306221025.K6fKRmj7-lkp@intel.com/
>
> All errors (new ones prefixed by >>):
>
> ld: vmlinux.o: in function `__ksymtab_devm_stmmac_probe_config_dt':
> >> stmmac_platform.c:(___ksymtab_gpl+devm_stmmac_probe_config_dt+0x0): undefined reference to `devm_stmmac_probe_config_dt'
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
I added the missing stub for !CONFIG_OF to v2.
Bart
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2023-06-22 12:45 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-21 15:36 [PATCH net-next 00/11] net: stmmac: introduce devres helpers for stmmac platform drivers Bartosz Golaszewski
2023-06-21 15:36 ` [PATCH net-next 01/11] net: stmmac: platform: provide stmmac_pltfr_init() Bartosz Golaszewski
2023-06-21 15:36 ` [PATCH net-next 02/11] net: stmmac: dwmac-generic: use stmmac_pltfr_init() Bartosz Golaszewski
2023-06-21 15:36 ` [PATCH net-next 03/11] net: stmmac: platform: provide stmmac_pltfr_exit() Bartosz Golaszewski
2023-06-21 15:36 ` [PATCH net-next 04/11] net: stmmac: dwmac-generic: use stmmac_pltfr_exit() Bartosz Golaszewski
2023-06-21 15:36 ` [PATCH net-next 05/11] net: stmmac: platform: provide stmmac_pltfr_probe() Bartosz Golaszewski
2023-06-21 15:36 ` [PATCH net-next 06/11] net: stmmac: dwmac-generic: use stmmac_pltfr_probe() Bartosz Golaszewski
2023-06-21 15:36 ` [PATCH net-next 07/11] net: stmmac: platform: provide stmmac_pltfr_remove_no_dt() Bartosz Golaszewski
2023-06-22 12:14 ` Simon Horman
2023-06-22 12:25 ` Bartosz Golaszewski
2023-06-21 15:36 ` [PATCH net-next 08/11] net: stmmac: platform: provide devm_stmmac_probe_config_dt() Bartosz Golaszewski
2023-06-22 2:48 ` kernel test robot
2023-06-22 12:45 ` Bartosz Golaszewski
2023-06-21 15:36 ` [PATCH net-next 09/11] net: stmmac: dwmac-qco-ethqos: use devm_stmmac_probe_config_dt() Bartosz Golaszewski
2023-06-21 15:36 ` [PATCH net-next 10/11] net: stmmac: platform: provide devm_stmmac_pltfr_probe() Bartosz Golaszewski
2023-06-21 15:36 ` [PATCH net-next 11/11] net: stmmac: dwmac-qcom-ethqos: use devm_stmmac_pltfr_probe() Bartosz Golaszewski
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).