Commit a884915f authored by Jisheng Zhang's avatar Jisheng Zhang Committed by Jakub Kicinski

net: stmmac: dwc-qos: Change the dwc_eth_dwmac_data's .probe prototype

The return pointer of dwc_eth_dwmac_data's .probe isn't used, and
"probe" usually return int, so change the prototype to follow standard
way. Secondly, it can simplify the tegra_eqos_probe() code.
Signed-off-by: default avatarJisheng Zhang <Jisheng.Zhang@synaptics.com>
Link: https://lore.kernel.org/r/20201109160440.3a736ee3@xhacker.debianSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 214c798b
...@@ -119,7 +119,7 @@ static int dwc_eth_dwmac_config_dt(struct platform_device *pdev, ...@@ -119,7 +119,7 @@ static int dwc_eth_dwmac_config_dt(struct platform_device *pdev,
return 0; return 0;
} }
static void *dwc_qos_probe(struct platform_device *pdev, static int dwc_qos_probe(struct platform_device *pdev,
struct plat_stmmacenet_data *plat_dat, struct plat_stmmacenet_data *plat_dat,
struct stmmac_resources *stmmac_res) struct stmmac_resources *stmmac_res)
{ {
...@@ -128,14 +128,14 @@ static void *dwc_qos_probe(struct platform_device *pdev, ...@@ -128,14 +128,14 @@ static void *dwc_qos_probe(struct platform_device *pdev,
plat_dat->stmmac_clk = devm_clk_get(&pdev->dev, "apb_pclk"); plat_dat->stmmac_clk = devm_clk_get(&pdev->dev, "apb_pclk");
if (IS_ERR(plat_dat->stmmac_clk)) { if (IS_ERR(plat_dat->stmmac_clk)) {
dev_err(&pdev->dev, "apb_pclk clock not found.\n"); dev_err(&pdev->dev, "apb_pclk clock not found.\n");
return ERR_CAST(plat_dat->stmmac_clk); return PTR_ERR(plat_dat->stmmac_clk);
} }
err = clk_prepare_enable(plat_dat->stmmac_clk); err = clk_prepare_enable(plat_dat->stmmac_clk);
if (err < 0) { if (err < 0) {
dev_err(&pdev->dev, "failed to enable apb_pclk clock: %d\n", dev_err(&pdev->dev, "failed to enable apb_pclk clock: %d\n",
err); err);
return ERR_PTR(err); return err;
} }
plat_dat->pclk = devm_clk_get(&pdev->dev, "phy_ref_clk"); plat_dat->pclk = devm_clk_get(&pdev->dev, "phy_ref_clk");
...@@ -152,11 +152,11 @@ static void *dwc_qos_probe(struct platform_device *pdev, ...@@ -152,11 +152,11 @@ static void *dwc_qos_probe(struct platform_device *pdev,
goto disable; goto disable;
} }
return NULL; return 0;
disable: disable:
clk_disable_unprepare(plat_dat->stmmac_clk); clk_disable_unprepare(plat_dat->stmmac_clk);
return ERR_PTR(err); return err;
} }
static int dwc_qos_remove(struct platform_device *pdev) static int dwc_qos_remove(struct platform_device *pdev)
...@@ -267,7 +267,7 @@ static int tegra_eqos_init(struct platform_device *pdev, void *priv) ...@@ -267,7 +267,7 @@ static int tegra_eqos_init(struct platform_device *pdev, void *priv)
return 0; return 0;
} }
static void *tegra_eqos_probe(struct platform_device *pdev, static int tegra_eqos_probe(struct platform_device *pdev,
struct plat_stmmacenet_data *data, struct plat_stmmacenet_data *data,
struct stmmac_resources *res) struct stmmac_resources *res)
{ {
...@@ -276,10 +276,8 @@ static void *tegra_eqos_probe(struct platform_device *pdev, ...@@ -276,10 +276,8 @@ static void *tegra_eqos_probe(struct platform_device *pdev,
int err; int err;
eqos = devm_kzalloc(&pdev->dev, sizeof(*eqos), GFP_KERNEL); eqos = devm_kzalloc(&pdev->dev, sizeof(*eqos), GFP_KERNEL);
if (!eqos) { if (!eqos)
err = -ENOMEM; return -ENOMEM;
goto error;
}
eqos->dev = &pdev->dev; eqos->dev = &pdev->dev;
eqos->regs = res->addr; eqos->regs = res->addr;
...@@ -368,9 +366,7 @@ static void *tegra_eqos_probe(struct platform_device *pdev, ...@@ -368,9 +366,7 @@ static void *tegra_eqos_probe(struct platform_device *pdev,
if (err < 0) if (err < 0)
goto reset; goto reset;
out: return 0;
return eqos;
reset: reset:
reset_control_assert(eqos->rst); reset_control_assert(eqos->rst);
reset_phy: reset_phy:
...@@ -384,8 +380,7 @@ static void *tegra_eqos_probe(struct platform_device *pdev, ...@@ -384,8 +380,7 @@ static void *tegra_eqos_probe(struct platform_device *pdev,
disable_master: disable_master:
clk_disable_unprepare(eqos->clk_master); clk_disable_unprepare(eqos->clk_master);
error: error:
eqos = ERR_PTR(err); return err;
goto out;
} }
static int tegra_eqos_remove(struct platform_device *pdev) static int tegra_eqos_remove(struct platform_device *pdev)
...@@ -403,7 +398,7 @@ static int tegra_eqos_remove(struct platform_device *pdev) ...@@ -403,7 +398,7 @@ static int tegra_eqos_remove(struct platform_device *pdev)
} }
struct dwc_eth_dwmac_data { struct dwc_eth_dwmac_data {
void *(*probe)(struct platform_device *pdev, int (*probe)(struct platform_device *pdev,
struct plat_stmmacenet_data *data, struct plat_stmmacenet_data *data,
struct stmmac_resources *res); struct stmmac_resources *res);
int (*remove)(struct platform_device *pdev); int (*remove)(struct platform_device *pdev);
...@@ -424,7 +419,6 @@ static int dwc_eth_dwmac_probe(struct platform_device *pdev) ...@@ -424,7 +419,6 @@ static int dwc_eth_dwmac_probe(struct platform_device *pdev)
const struct dwc_eth_dwmac_data *data; const struct dwc_eth_dwmac_data *data;
struct plat_stmmacenet_data *plat_dat; struct plat_stmmacenet_data *plat_dat;
struct stmmac_resources stmmac_res; struct stmmac_resources stmmac_res;
void *priv;
int ret; int ret;
data = device_get_match_data(&pdev->dev); data = device_get_match_data(&pdev->dev);
...@@ -448,10 +442,8 @@ static int dwc_eth_dwmac_probe(struct platform_device *pdev) ...@@ -448,10 +442,8 @@ static int dwc_eth_dwmac_probe(struct platform_device *pdev)
if (IS_ERR(plat_dat)) if (IS_ERR(plat_dat))
return PTR_ERR(plat_dat); return PTR_ERR(plat_dat);
priv = data->probe(pdev, plat_dat, &stmmac_res); ret = data->probe(pdev, plat_dat, &stmmac_res);
if (IS_ERR(priv)) { if (ret < 0) {
ret = PTR_ERR(priv);
if (ret != -EPROBE_DEFER) if (ret != -EPROBE_DEFER)
dev_err(&pdev->dev, "failed to probe subdriver: %d\n", dev_err(&pdev->dev, "failed to probe subdriver: %d\n",
ret); ret);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment