
29 Jul
2019
29 Jul
'19
11:09 a.m.
On Mon, Jul 29, 2019 at 10:56 AM Jagan Teki jagan@amarulasolutions.com wrote:
Add driver-model code for designware watchdog.
+/*
- Set the watchdog time interval.
- Counter is 32 bit.
- */
+static int dw_wdt_set_timeout(struct dw_wdt *dw, unsigned int timeout) +{
signed int i;
/* calculate the timeout range value */
i = (log_2_n_round_up(timeout * dw->clk_rate)) - 16;
Redundant parenthesis.
if (i > 15)
i = 15;
if (i < 0)
i = 0;
Use clamp_t().
writel((i | (i << 4)), dw->regs + DW_WDT_TORR);
return 0;
+}
ret = clk_get_by_index(dev, 0, &clk);
if (!ret)
dw->clk_rate = clk_get_rate(&clk);
else
return -EINVAL;
Why not to use traditional pattern, i.e.
if (ret) return -ERRNO;
--
With Best Regards,
Andy Shevchenko