public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] v850: Round up length passed to slram driver to a multiple of SLRAM_BLK_SZ
@ 2005-09-02  6:13 Miles Bader
  2005-09-02  6:50 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Miles Bader @ 2005-09-02  6:13 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel, Andrew Morton

Signed-off-by: Miles Bader <miles@gnu.org>

 arch/v850/kernel/setup.c |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff -ruN -X../cludes linux-2.6.13-uc0/arch/v850/kernel/setup.c linux-2.6.13-uc0-v850-20050902/arch/v850/kernel/setup.c
--- linux-2.6.13-uc0/arch/v850/kernel/setup.c	2005-06-21 16:07:27.095352000 +0900
+++ linux-2.6.13-uc0-v850-20050902/arch/v850/kernel/setup.c	2005-09-02 11:10:57.162581000 +0900
@@ -1,8 +1,8 @@
 /*
  * arch/v850/kernel/setup.c -- Arch-dependent initialization functions
  *
- *  Copyright (C) 2001,02,03  NEC Electronics Corporation
- *  Copyright (C) 2001,02,03  Miles Bader <miles@gnu.org>
+ *  Copyright (C) 2001,02,03,05  NEC Electronics Corporation
+ *  Copyright (C) 2001,02,03,05  Miles Bader <miles@gnu.org>
  *
  * This file is subject to the terms and conditions of the GNU General
  * Public License.  See the file COPYING in the main directory of this
@@ -98,10 +98,20 @@
 }
 
 #ifdef CONFIG_MTD
+
+/* 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;
+
 	/* The only way to pass info to the MTD slram driver is via
 	   the command line.  */
 	if (*cmd_line) {

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] v850: Round up length passed to slram driver to a multiple of SLRAM_BLK_SZ
  2005-09-02  6:13 [PATCH] v850: Round up length passed to slram driver to a multiple of SLRAM_BLK_SZ Miles Bader
@ 2005-09-02  6:50 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2005-09-02  6:50 UTC (permalink / raw)
  To: Miles Bader; +Cc: torvalds, linux-kernel

Miles Bader <miles@gnu.org> 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()..

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-09-02  6:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-02  6:13 [PATCH] v850: Round up length passed to slram driver to a multiple of SLRAM_BLK_SZ Miles Bader
2005-09-02  6:50 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox