Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Philipp Zabel and committed by
Mauro Carvalho Chehab
c3d4fb0f ec6b0bd5

+7 -14
+7 -14
drivers/media/rc/sunxi-cir.c
··· 174 174 175 175 /* Reset (optional) */ 176 176 ir->rst = devm_reset_control_get_optional(dev, NULL); 177 - if (IS_ERR(ir->rst)) { 178 - ret = PTR_ERR(ir->rst); 179 - if (ret == -EPROBE_DEFER) 180 - return ret; 181 - ir->rst = NULL; 182 - } else { 183 - ret = reset_control_deassert(ir->rst); 184 - if (ret) 185 - return ret; 186 - } 177 + if (IS_ERR(ir->rst)) 178 + return PTR_ERR(ir->rst); 179 + ret = reset_control_deassert(ir->rst); 180 + if (ret) 181 + return ret; 187 182 188 183 ret = clk_set_rate(ir->clk, SUNXI_IR_BASE_CLK); 189 184 if (ret) { ··· 286 291 exit_clkdisable_apb_clk: 287 292 clk_disable_unprepare(ir->apb_clk); 288 293 exit_reset_assert: 289 - if (ir->rst) 290 - reset_control_assert(ir->rst); 294 + reset_control_assert(ir->rst); 291 295 292 296 return ret; 293 297 } ··· 298 304 299 305 clk_disable_unprepare(ir->clk); 300 306 clk_disable_unprepare(ir->apb_clk); 301 - if (ir->rst) 302 - reset_control_assert(ir->rst); 307 + reset_control_assert(ir->rst); 303 308 304 309 spin_lock_irqsave(&ir->ir_lock, flags); 305 310 /* disable IR IRQ */