Commit bf9279cd authored by Philipp Zabel's avatar Philipp Zabel Committed by David S. Miller
Browse files

net: dsa: bcm_sf2: simplify optional reset handling



As of commit bb475230 ("reset: make optional functions really
optional"), the reset framework API calls use NULL pointers to describe
optional, non-present reset controls.

This allows to unconditionally return errors from
devm_reset_control_get_optional_exclusive.

Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Acked-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9270bbe2
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -406,7 +406,7 @@ static int bcm_sf2_sw_rst(struct bcm_sf2_priv *priv)
	/* The watchdog reset does not work on 7278, we need to hit the
	/* The watchdog reset does not work on 7278, we need to hit the
	 * "external" reset line through the reset controller.
	 * "external" reset line through the reset controller.
	 */
	 */
	if (priv->type == BCM7278_DEVICE_ID && !IS_ERR(priv->rcdev)) {
	if (priv->type == BCM7278_DEVICE_ID) {
		ret = reset_control_assert(priv->rcdev);
		ret = reset_control_assert(priv->rcdev);
		if (ret)
		if (ret)
			return ret;
			return ret;
@@ -1265,7 +1265,7 @@ static int bcm_sf2_sw_probe(struct platform_device *pdev)


	priv->rcdev = devm_reset_control_get_optional_exclusive(&pdev->dev,
	priv->rcdev = devm_reset_control_get_optional_exclusive(&pdev->dev,
								"switch");
								"switch");
	if (PTR_ERR(priv->rcdev) == -EPROBE_DEFER)
	if (IS_ERR(priv->rcdev))
		return PTR_ERR(priv->rcdev);
		return PTR_ERR(priv->rcdev);


	/* Auto-detection using standard registers will not work, so
	/* Auto-detection using standard registers will not work, so
@@ -1426,7 +1426,7 @@ static int bcm_sf2_sw_remove(struct platform_device *pdev)
	bcm_sf2_mdio_unregister(priv);
	bcm_sf2_mdio_unregister(priv);
	clk_disable_unprepare(priv->clk_mdiv);
	clk_disable_unprepare(priv->clk_mdiv);
	clk_disable_unprepare(priv->clk);
	clk_disable_unprepare(priv->clk);
	if (priv->type == BCM7278_DEVICE_ID && !IS_ERR(priv->rcdev))
	if (priv->type == BCM7278_DEVICE_ID)
		reset_control_assert(priv->rcdev);
		reset_control_assert(priv->rcdev);


	return 0;
	return 0;