[PATCH 1/4] mtd: fix erasesize math for non power-of-2 devices

Sascha Hauer s.hauer at pengutronix.de
Tue Sep 3 14:16:49 EDT 2013


Hi Darren,

On Mon, Sep 02, 2013 at 10:22:20PM -0400, Darren Garnier wrote:
> 
> +#define ALIGNED_OFFSET(offset, bs) ((bs & (bs-1)) == 0) ? \
> +									offset & ~(bs-1) : \
> +									bs * div_u64(offset,bs)
> +#define ALIGNED_COUNT(count, bs) ((bs & (bs-1)) == 0) ? \
> +									ALIGN(count,bs) : \
> +									bs * div_u64(count+(bs-1),bs)

Can you convert this into a function? It makes it easier and to read and
more obvious what's happening here. Please use the is_power_of_2 macro
and add whitespaces left and right to operators.

Otherwise looks good. I didn't know such flashes exist...

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list