Re: [PATCH] v850: Round up length passed to slram driver to amultiple of SLRAM_BLK_SZ

From: Andrew Morton
Date: Fri Sep 02 2005 - 01:52:53 EST


Miles Bader <miles@xxxxxxx> wrote:
>
> +
> +/* From drivers/mtd/devices/slram.c */
> +#define SLRAM_BLK_SZ 0x4000
> +
> /* Set the root filesystem to be the given memory region.
> Some parameter may be appended to CMD_LINE. */
> void set_mem_root (void *addr, size_t len, char *cmd_line)
> {
> + /* Some sort of idiocy in MTD means we must supply a length that's
> + a multiple of SLRAM_BLK_SZ. We just round up the real length,
> + as the file system shouldn't attempt to access anything beyond
> + the end of the image anyway. */
> + len = (((len - 1) + SLRAM_BLK_SZ) / SLRAM_BLK_SZ) * SLRAM_BLK_SZ;

If SLRAM_BLK_SZ will always be a power of two, there's kernel.h:ALIGN()..
-
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/