diff options
author | Philipp Zabel <p.zabel@pengutronix.de> | 2017-03-15 14:31:38 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-03-24 14:30:03 +0300 |
commit | c3d4fb0fb41f4b5eafeee51173c14e50be12f839 (patch) | |
tree | 89301324ef1ae0b2df1e5fdf3173d354380200d7 /drivers/media/rc/sunxi-cir.c | |
parent | ec6b0bd54e00beabfdf45d1f3aba8dfb79f52b53 (diff) | |
download | linux-c3d4fb0fb41f4b5eafeee51173c14e50be12f839.tar.xz |
[media] rc: sunxi-cir: simplify optional reset handling
As of commit bb475230b8e5 ("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: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/rc/sunxi-cir.c')
-rw-r--r-- | drivers/media/rc/sunxi-cir.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/drivers/media/rc/sunxi-cir.c b/drivers/media/rc/sunxi-cir.c index 25b006167810..4b785dd775c1 100644 --- a/drivers/media/rc/sunxi-cir.c +++ b/drivers/media/rc/sunxi-cir.c @@ -174,16 +174,11 @@ static int sunxi_ir_probe(struct platform_device *pdev) /* Reset (optional) */ ir->rst = devm_reset_control_get_optional(dev, NULL); - if (IS_ERR(ir->rst)) { - ret = PTR_ERR(ir->rst); - if (ret == -EPROBE_DEFER) - return ret; - ir->rst = NULL; - } else { - ret = reset_control_deassert(ir->rst); - if (ret) - return ret; - } + if (IS_ERR(ir->rst)) + return PTR_ERR(ir->rst); + ret = reset_control_deassert(ir->rst); + if (ret) + return ret; ret = clk_set_rate(ir->clk, SUNXI_IR_BASE_CLK); if (ret) { @@ -291,8 +286,7 @@ exit_clkdisable_clk: exit_clkdisable_apb_clk: clk_disable_unprepare(ir->apb_clk); exit_reset_assert: - if (ir->rst) - reset_control_assert(ir->rst); + reset_control_assert(ir->rst); return ret; } @@ -304,8 +298,7 @@ static int sunxi_ir_remove(struct platform_device *pdev) clk_disable_unprepare(ir->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); /* disable IR IRQ */ |