Commit c3d4fb0f authored by Philipp Zabel's avatar Philipp Zabel Committed by Mauro Carvalho Chehab

[media] rc: sunxi-cir: 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 return errors from devm_reset_control_get_optional and to
call reset_control_(de)assert unconditionally.
Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent ec6b0bd5
...@@ -174,16 +174,11 @@ static int sunxi_ir_probe(struct platform_device *pdev) ...@@ -174,16 +174,11 @@ static int sunxi_ir_probe(struct platform_device *pdev)
/* Reset (optional) */ /* Reset (optional) */
ir->rst = devm_reset_control_get_optional(dev, NULL); ir->rst = devm_reset_control_get_optional(dev, NULL);
if (IS_ERR(ir->rst)) { if (IS_ERR(ir->rst))
ret = PTR_ERR(ir->rst); return PTR_ERR(ir->rst);
if (ret == -EPROBE_DEFER) ret = reset_control_deassert(ir->rst);
return ret; if (ret)
ir->rst = NULL; return ret;
} else {
ret = reset_control_deassert(ir->rst);
if (ret)
return ret;
}
ret = clk_set_rate(ir->clk, SUNXI_IR_BASE_CLK); ret = clk_set_rate(ir->clk, SUNXI_IR_BASE_CLK);
if (ret) { if (ret) {
...@@ -291,8 +286,7 @@ static int sunxi_ir_probe(struct platform_device *pdev) ...@@ -291,8 +286,7 @@ static int sunxi_ir_probe(struct platform_device *pdev)
exit_clkdisable_apb_clk: exit_clkdisable_apb_clk:
clk_disable_unprepare(ir->apb_clk); clk_disable_unprepare(ir->apb_clk);
exit_reset_assert: exit_reset_assert:
if (ir->rst) reset_control_assert(ir->rst);
reset_control_assert(ir->rst);
return ret; return ret;
} }
...@@ -304,8 +298,7 @@ static int sunxi_ir_remove(struct platform_device *pdev) ...@@ -304,8 +298,7 @@ static int sunxi_ir_remove(struct platform_device *pdev)
clk_disable_unprepare(ir->clk); clk_disable_unprepare(ir->clk);
clk_disable_unprepare(ir->apb_clk); clk_disable_unprepare(ir->apb_clk);
if (ir->rst) reset_control_assert(ir->rst);
reset_control_assert(ir->rst);
spin_lock_irqsave(&ir->ir_lock, flags); spin_lock_irqsave(&ir->ir_lock, flags);
/* disable IR IRQ */ /* disable IR IRQ */
......
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