diff options
author | Simon Glass <sjg@chromium.org> | 2021-08-07 07:24:06 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2021-09-25 09:46:15 -0600 |
commit | dcfc42b12f95fecffbf4692854acd4193240d86a (patch) | |
tree | 0415ef0a2804ac9dff88bc8ecfd28cd39a740de2 /drivers/timer/rockchip_timer.c | |
parent | 62470afed14a598d36d055c60ccc3ffab6967dcc (diff) |
treewide: Try to avoid the preprocessor with OF_REAL
Convert some of these occurences to C code, where it is easy to do. This
should help encourage this approach to be used in new code.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/timer/rockchip_timer.c')
-rw-r--r-- | drivers/timer/rockchip_timer.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/timer/rockchip_timer.c b/drivers/timer/rockchip_timer.c index 96621479105..62eacb98689 100644 --- a/drivers/timer/rockchip_timer.c +++ b/drivers/timer/rockchip_timer.c @@ -55,8 +55,7 @@ ulong timer_get_boot_us(void) /* The timer is available */ rate = timer_get_rate(gd->timer); timer_get_count(gd->timer, &ticks); -#if CONFIG_IS_ENABLED(OF_REAL) - } else if (ret == -EAGAIN) { + } else if (CONFIG_IS_ENABLED(OF_REAL) && ret == -EAGAIN) { /* We have been called so early that the DM is not ready,... */ ofnode node = offset_to_ofnode(-1); struct rk_timer *timer = NULL; @@ -79,7 +78,6 @@ ulong timer_get_boot_us(void) debug("%s: could not read clock-frequency\n", __func__); return 0; } -#endif } else { return 0; } @@ -100,13 +98,13 @@ static u64 rockchip_timer_get_count(struct udevice *dev) static int rockchip_clk_of_to_plat(struct udevice *dev) { -#if CONFIG_IS_ENABLED(OF_REAL) - struct rockchip_timer_priv *priv = dev_get_priv(dev); + if (CONFIG_IS_ENABLED(OF_REAL)) { + struct rockchip_timer_priv *priv = dev_get_priv(dev); - priv->timer = dev_read_addr_ptr(dev); - if (!priv->timer) - return -ENOENT; -#endif + priv->timer = dev_read_addr_ptr(dev); + if (!priv->timer) + return -ENOENT; + } return 0; } |