2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2025-01-03 11:13:56 +08:00

[media] st_rc: simplify optional reset handling

As of commit bb475230b8 ("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>
This commit is contained in:
Philipp Zabel 2017-03-15 08:31:36 -03:00 committed by Mauro Carvalho Chehab
parent 03eb2a557e
commit ec6b0bd54e

View File

@ -165,8 +165,7 @@ static void st_rc_hardware_init(struct st_rc_device *dev)
unsigned int rx_sampling_freq_div; unsigned int rx_sampling_freq_div;
/* Enable the IP */ /* Enable the IP */
if (dev->rstc) reset_control_deassert(dev->rstc);
reset_control_deassert(dev->rstc);
clk_prepare_enable(dev->sys_clock); clk_prepare_enable(dev->sys_clock);
baseclock = clk_get_rate(dev->sys_clock); baseclock = clk_get_rate(dev->sys_clock);
@ -281,10 +280,11 @@ static int st_rc_probe(struct platform_device *pdev)
else else
rc_dev->rx_base = rc_dev->base; rc_dev->rx_base = rc_dev->base;
rc_dev->rstc = reset_control_get_optional(dev, NULL); rc_dev->rstc = reset_control_get_optional(dev, NULL);
if (IS_ERR(rc_dev->rstc)) if (IS_ERR(rc_dev->rstc)) {
rc_dev->rstc = NULL; ret = PTR_ERR(rc_dev->rstc);
goto err;
}
rc_dev->dev = dev; rc_dev->dev = dev;
platform_set_drvdata(pdev, rc_dev); platform_set_drvdata(pdev, rc_dev);
@ -352,8 +352,7 @@ static int st_rc_suspend(struct device *dev)
writel(0x00, rc_dev->rx_base + IRB_RX_EN); writel(0x00, rc_dev->rx_base + IRB_RX_EN);
writel(0x00, rc_dev->rx_base + IRB_RX_INT_EN); writel(0x00, rc_dev->rx_base + IRB_RX_INT_EN);
clk_disable_unprepare(rc_dev->sys_clock); clk_disable_unprepare(rc_dev->sys_clock);
if (rc_dev->rstc) reset_control_assert(rc_dev->rstc);
reset_control_assert(rc_dev->rstc);
} }
return 0; return 0;