spi: sprd: Change to use devm_hwspin_lock_request_specific()

Change to use devm_hwspin_lock_request_specific() instead of
freeing the hwlock explicitly when unbound the device.

Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This commit is contained in:
Baolin Wang 2018-06-22 16:09:05 +08:00 committed by Bjorn Andersson
parent d4942c119c
commit c8d0498967
1 changed files with 3 additions and 6 deletions

View File

@ -465,7 +465,7 @@ static int sprd_adi_probe(struct platform_device *pdev)
goto put_ctlr;
}
sadi->hwlock = hwspin_lock_request_specific(ret);
sadi->hwlock = devm_hwspin_lock_request_specific(&pdev->dev, ret);
if (!sadi->hwlock) {
ret = -ENXIO;
goto put_ctlr;
@ -483,7 +483,7 @@ static int sprd_adi_probe(struct platform_device *pdev)
ret = devm_spi_register_controller(&pdev->dev, ctlr);
if (ret) {
dev_err(&pdev->dev, "failed to register SPI controller\n");
goto free_hwlock;
goto put_ctlr;
}
sadi->restart_handler.notifier_call = sprd_adi_restart_handler;
@ -491,13 +491,11 @@ static int sprd_adi_probe(struct platform_device *pdev)
ret = register_restart_handler(&sadi->restart_handler);
if (ret) {
dev_err(&pdev->dev, "can not register restart handler\n");
goto free_hwlock;
goto put_ctlr;
}
return 0;
free_hwlock:
hwspin_lock_free(sadi->hwlock);
put_ctlr:
spi_controller_put(ctlr);
return ret;
@ -509,7 +507,6 @@ static int sprd_adi_remove(struct platform_device *pdev)
struct sprd_adi *sadi = spi_controller_get_devdata(ctlr);
unregister_restart_handler(&sadi->restart_handler);
hwspin_lock_free(sadi->hwlock);
return 0;
}