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

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.debian


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 214c798b
Loading
Loading
Loading
Loading
+19 −27
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@ static int dwc_eth_dwmac_config_dt(struct platform_device *pdev,
	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 stmmac_resources *stmmac_res)
{
@@ -128,14 +128,14 @@ static void *dwc_qos_probe(struct platform_device *pdev,
	plat_dat->stmmac_clk = devm_clk_get(&pdev->dev, "apb_pclk");
	if (IS_ERR(plat_dat->stmmac_clk)) {
		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);
	if (err < 0) {
		dev_err(&pdev->dev, "failed to enable apb_pclk clock: %d\n",
			err);
		return ERR_PTR(err);
		return err;
	}

	plat_dat->pclk = devm_clk_get(&pdev->dev, "phy_ref_clk");
@@ -152,11 +152,11 @@ static void *dwc_qos_probe(struct platform_device *pdev,
		goto disable;
	}

	return NULL;
	return 0;

disable:
	clk_disable_unprepare(plat_dat->stmmac_clk);
	return ERR_PTR(err);
	return err;
}

static int dwc_qos_remove(struct platform_device *pdev)
@@ -267,7 +267,7 @@ static int tegra_eqos_init(struct platform_device *pdev, void *priv)
	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 stmmac_resources *res)
{
@@ -276,10 +276,8 @@ static void *tegra_eqos_probe(struct platform_device *pdev,
	int err;

	eqos = devm_kzalloc(&pdev->dev, sizeof(*eqos), GFP_KERNEL);
	if (!eqos) {
		err = -ENOMEM;
		goto error;
	}
	if (!eqos)
		return -ENOMEM;

	eqos->dev = &pdev->dev;
	eqos->regs = res->addr;
@@ -368,9 +366,7 @@ static void *tegra_eqos_probe(struct platform_device *pdev,
	if (err < 0)
		goto reset;

out:
	return eqos;

	return 0;
reset:
	reset_control_assert(eqos->rst);
reset_phy:
@@ -384,8 +380,7 @@ static void *tegra_eqos_probe(struct platform_device *pdev,
disable_master:
	clk_disable_unprepare(eqos->clk_master);
error:
	eqos = ERR_PTR(err);
	goto out;
	return err;
}

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 {
	void *(*probe)(struct platform_device *pdev,
	int (*probe)(struct platform_device *pdev,
		     struct plat_stmmacenet_data *data,
		     struct stmmac_resources *res);
	int (*remove)(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;
	struct plat_stmmacenet_data *plat_dat;
	struct stmmac_resources stmmac_res;
	void *priv;
	int ret;

	data = device_get_match_data(&pdev->dev);
@@ -448,10 +442,8 @@ static int dwc_eth_dwmac_probe(struct platform_device *pdev)
	if (IS_ERR(plat_dat))
		return PTR_ERR(plat_dat);

	priv = data->probe(pdev, plat_dat, &stmmac_res);
	if (IS_ERR(priv)) {
		ret = PTR_ERR(priv);

	ret = data->probe(pdev, plat_dat, &stmmac_res);
	if (ret < 0) {
		if (ret != -EPROBE_DEFER)
			dev_err(&pdev->dev, "failed to probe subdriver: %d\n",
				ret);