Re: [PATCH v3 03/36] mtd: st_spi_fsm: Initialise and configure theFSM for normal working conditions

From: Brian Norris
Date: Tue Dec 10 2013 - 15:08:20 EST


On Tue, Dec 10, 2013 at 11:01:00AM -0800, Brian Norris wrote:
> On Fri, Nov 29, 2013 at 12:18:52PM +0000, Lee Jones wrote:
> > + /*
> > + * Calculate clk_div - values between 2 and 128
> > + * Multiple of 2, rounded up
> > + */
> > + clk_div = 2*((emi_freq + (2*spi_freq - 1))/(2*spi_freq));
>
> I think this can use the <linux/kerne.h> round_up() macro. Also, you're
> missing some spacing. Possibly:
>
> clk_div = 2 * round_up(emi_freq, 2 * spi_freq);

Sorry, I was reading one thing and writing another; this would be
DIV_ROUND_UP():

clk_div = 2 * DIV_ROUND_UP(emi_freq, 2 * spi_freq);

> > + fsm->fifo_dir_delay = (clk_div + 9) / 10;
>
> round_down()?

Sorry, I again meant DIV_ROUND_UP:

fsm->fifo_dir_delay = DIV_ROUND_UP(clk_div, 10);

Brian
--
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/