From: Joachim Eastwood <manabian@gmail.com>
To: peppe.cavallaro@st.com, dinguyen@opensource.altera.com,
davem@davemloft.net
Cc: Joachim Eastwood <manabian@gmail.com>, netdev@vger.kernel.org
Subject: [PATCH net-next 05/17] stmmac: dwmac-socfpga: turn setup callback into a probe function
Date: Wed, 29 Jul 2015 00:08:52 +0200 [thread overview]
Message-ID: <1438121344-5304-6-git-send-email-manabian@gmail.com> (raw)
In-Reply-To: <1438121344-5304-1-git-send-email-manabian@gmail.com>
By using a few functions from stmmac_platform a proper probe
function can be created from the setup glue callback. This
makes it look more like a standard driver and the OF match
data can also be dropped.
Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
.../net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 40 ++++++++++++++--------
1 file changed, 26 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
index 0df409e2edcd..401383b252a8 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
@@ -232,46 +232,58 @@ static int socfpga_dwmac_init(struct platform_device *pdev, void *priv)
return ret;
}
-static void *socfpga_dwmac_probe(struct platform_device *pdev)
+static int socfpga_dwmac_probe(struct platform_device *pdev)
{
+ struct plat_stmmacenet_data *plat_dat;
+ struct stmmac_resources stmmac_res;
struct device *dev = &pdev->dev;
int ret;
struct socfpga_dwmac *dwmac;
+ ret = stmmac_get_platform_resources(pdev, &stmmac_res);
+ if (ret)
+ return ret;
+
+ plat_dat = stmmac_probe_config_dt(pdev, &stmmac_res.mac);
+ if (IS_ERR(plat_dat))
+ return PTR_ERR(plat_dat);
+
dwmac = devm_kzalloc(dev, sizeof(*dwmac), GFP_KERNEL);
if (!dwmac)
- return ERR_PTR(-ENOMEM);
+ return -ENOMEM;
ret = socfpga_dwmac_parse_data(dwmac, dev);
if (ret) {
dev_err(dev, "Unable to parse OF data\n");
- return ERR_PTR(ret);
+ return ret;
}
ret = socfpga_dwmac_setup(dwmac);
if (ret) {
dev_err(dev, "couldn't setup SoC glue (%d)\n", ret);
- return ERR_PTR(ret);
+ return ret;
}
- return dwmac;
-}
+ plat_dat->bsp_priv = dwmac;
+ plat_dat->init = socfpga_dwmac_init;
+ plat_dat->exit = socfpga_dwmac_exit;
+ plat_dat->fix_mac_speed = socfpga_dwmac_fix_mac_speed;
-static const struct stmmac_of_data socfpga_gmac_data = {
- .setup = socfpga_dwmac_probe,
- .init = socfpga_dwmac_init,
- .exit = socfpga_dwmac_exit,
- .fix_mac_speed = socfpga_dwmac_fix_mac_speed,
-};
+ ret = socfpga_dwmac_init(pdev, plat_dat->bsp_priv);
+ if (ret)
+ return ret;
+
+ return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
+}
static const struct of_device_id socfpga_dwmac_match[] = {
- { .compatible = "altr,socfpga-stmmac", .data = &socfpga_gmac_data },
+ { .compatible = "altr,socfpga-stmmac" },
{ }
};
MODULE_DEVICE_TABLE(of, socfpga_dwmac_match);
static struct platform_driver socfpga_dwmac_driver = {
- .probe = stmmac_pltfr_probe,
+ .probe = socfpga_dwmac_probe,
.remove = stmmac_pltfr_remove,
.driver = {
.name = "socfpga-dwmac",
--
1.8.0
next prev parent reply other threads:[~2015-07-28 22:09 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-28 22:08 [PATCH net-next 00/17] stmmac clean up for 4.3 part2 Joachim Eastwood
2015-07-28 22:08 ` [PATCH net-next 01/17] stmmac: fix ptr_ret.cocci warning Joachim Eastwood
2015-07-28 22:08 ` [PATCH net-next 02/17] stmmac: dwmac-ipq806x: move ipq806x_gmac_fix_mac_speed function Joachim Eastwood
2015-07-28 22:08 ` [PATCH net-next 03/17] stmmac: dwmac-ipq806x: turn setup callback into a probe function Joachim Eastwood
2015-07-28 22:08 ` [PATCH net-next 04/17] stmmac: dwmac-socfpga: move socfpga_dwmac_probe function Joachim Eastwood
2015-07-28 22:08 ` Joachim Eastwood [this message]
2015-07-28 22:08 ` [PATCH net-next 06/17] stmmac: dwmac-sunxi: move sun7i_gmac_setup function Joachim Eastwood
2015-07-28 22:08 ` [PATCH net-next 07/17] stmmac: dwmac-sunxi: turn setup callback into a probe function Joachim Eastwood
2015-07-28 22:08 ` [PATCH net-next 08/17] stmmac: dwmac-sti: " Joachim Eastwood
[not found] ` <1438121344-5304-1-git-send-email-manabian-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-07-28 22:08 ` [PATCH net-next 09/17] stmmac: dwmac-rk: create a new " Joachim Eastwood
2015-07-28 22:09 ` [PATCH net-next 13/17] stmmac: dwmac-rk: make rk_gmac_ops structs static const Joachim Eastwood
2015-07-28 22:08 ` [PATCH net-next 10/17] stmmac: move stmmac_pltfr_probe into dwmac-generic Joachim Eastwood
2015-07-28 22:08 ` [PATCH net-next 11/17] stmmac: let dwmac-* drivers handle their own match data Joachim Eastwood
2015-07-28 22:08 ` [PATCH net-next 12/17] stmmac: dwmac-sti: use custom of match structure Joachim Eastwood
2015-07-28 22:09 ` [PATCH net-next 14/17] stmmac: dwmac-rk: use rk_gmac_ops as of match data Joachim Eastwood
2015-07-28 22:09 ` [PATCH net-next 15/17] stmmac: remove unused stmmac_of_data struct Joachim Eastwood
2015-07-28 22:09 ` [PATCH net-next 16/17] stmmac: remove setup/free glue callbacks Joachim Eastwood
2015-07-28 22:09 ` [PATCH net-next 17/17] stmmac: dwmac-sti: refactor the init " Joachim Eastwood
2015-07-29 7:13 ` [PATCH net-next 00/17] stmmac clean up for 4.3 part2 David Miller
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=1438121344-5304-6-git-send-email-manabian@gmail.com \
--to=manabian@gmail.com \
--cc=davem@davemloft.net \
--cc=dinguyen@opensource.altera.com \
--cc=netdev@vger.kernel.org \
--cc=peppe.cavallaro@st.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;
as well as URLs for NNTP newsgroup(s).