Re: [U-Boot] [PATCH 08/15] wdt: dw: Add driver-model support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 29, 2019 at 10:56 AM Jagan Teki <jagan@xxxxxxxxxxxxxxxxxxxx> 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

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/linux-rockchip



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux