Commit aa31e559 authored by Philipp Zabel's avatar Philipp Zabel Committed by Herbert Xu
Browse files

crypto: sun4i-ss - 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>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent e5f9f41d
Loading
Loading
Loading
Loading
+8 −13
Original line number Diff line number Diff line
@@ -288,7 +288,6 @@ static int sun4i_ss_pm_suspend(struct device *dev)
{
	struct sun4i_ss_ctx *ss = dev_get_drvdata(dev);

	if (ss->reset)
	reset_control_assert(ss->reset);

	clk_disable_unprepare(ss->ssclk);
@@ -314,13 +313,11 @@ static int sun4i_ss_pm_resume(struct device *dev)
		goto err_enable;
	}

	if (ss->reset) {
	err = reset_control_deassert(ss->reset);
	if (err) {
		dev_err(ss->dev, "Cannot deassert reset control\n");
		goto err_enable;
	}
	}

	return err;
err_enable:
@@ -401,12 +398,10 @@ static int sun4i_ss_probe(struct platform_device *pdev)
	dev_dbg(&pdev->dev, "clock ahb_ss acquired\n");

	ss->reset = devm_reset_control_get_optional(&pdev->dev, "ahb");
	if (IS_ERR(ss->reset)) {
		if (PTR_ERR(ss->reset) == -EPROBE_DEFER)
	if (IS_ERR(ss->reset))
		return PTR_ERR(ss->reset);
	if (!ss->reset)
		dev_info(&pdev->dev, "no reset control found\n");
		ss->reset = NULL;
	}

	/*
	 * Check that clock have the correct rates given in the datasheet