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

[media] st_rc: 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 reset_control_get_optional and to call
reset_control_(de)assert unconditionally.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Patrice Chotard <patrice.chotard@st.com>
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
ec6b0bd5 03eb2a55

+6 -7
+6 -7
drivers/media/rc/st_rc.c
··· 165 165 unsigned int rx_sampling_freq_div; 166 166 167 167 /* Enable the IP */ 168 - if (dev->rstc) 169 - reset_control_deassert(dev->rstc); 168 + reset_control_deassert(dev->rstc); 170 169 171 170 clk_prepare_enable(dev->sys_clock); 172 171 baseclock = clk_get_rate(dev->sys_clock); ··· 280 281 else 281 282 rc_dev->rx_base = rc_dev->base; 282 283 283 - 284 284 rc_dev->rstc = reset_control_get_optional(dev, NULL); 285 - if (IS_ERR(rc_dev->rstc)) 286 - rc_dev->rstc = NULL; 285 + if (IS_ERR(rc_dev->rstc)) { 286 + ret = PTR_ERR(rc_dev->rstc); 287 + goto err; 288 + } 287 289 288 290 rc_dev->dev = dev; 289 291 platform_set_drvdata(pdev, rc_dev); ··· 352 352 writel(0x00, rc_dev->rx_base + IRB_RX_EN); 353 353 writel(0x00, rc_dev->rx_base + IRB_RX_INT_EN); 354 354 clk_disable_unprepare(rc_dev->sys_clock); 355 - if (rc_dev->rstc) 356 - reset_control_assert(rc_dev->rstc); 355 + reset_control_assert(rc_dev->rstc); 357 356 } 358 357 359 358 return 0;