Re: [PATCH 3/4] clk: new basic clk type for fractional divider

From: Heikki Krogerus
Date: Wed May 14 2014 - 09:56:01 EST


On Tue, May 13, 2014 at 03:13:52PM +0300, Heikki Krogerus wrote:
> +static unsigned long clk_fd_recalc_rate(struct clk_hw *hw,
> + unsigned long parent_rate)
> +{
> + struct clk_fractional_divider *fd = to_clk_fd(hw);
> + unsigned long flags = 0;
> + u64 n, m;
> + u32 val;
> +
> + if (fd->lock)
> + spin_lock_irqsave(fd->lock, flags);
> +
> + val = clk_readl(fd->reg);
> +
> + if (fd->lock)
> + spin_unlock_irqrestore(fd->lock, flags);
> +
> + m = (val & fd->mmask) >> fd->mshift;
> + n = (val & fd->nmask) >> fd->nshift;
> +
> + return parent_rate * m / n;
> +}

Andy noticed an issue here but he commented it outside the list. I
need to use do_div() here. He had also some nitpicks for the other
patches, so I'll prepare a new version for all of these tomorrow.


--
heikki
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/