[PATCH 1/3] s3c2440-nand-shift-not-div.patch

Werner Almesberger werner at openmoko.org
Mon Nov 3 17:23:04 CET 2008


s3c2440-nand-shift-not-div.patch

The divisions of the signed access lengths caused GCC to emit
unnecessary code for handling negative values.

Changing them to shifts saves 24 bytes.

Signed-off-by: Werner Almesberger <werner at openmoko.org>

---

Index: ktrack/drivers/mtd/nand/s3c2410.c
===================================================================
--- ktrack.orig/drivers/mtd/nand/s3c2410.c	2008-11-03 12:55:53.000000000 -0200
+++ ktrack/drivers/mtd/nand/s3c2410.c	2008-11-03 12:58:18.000000000 -0200
@@ -530,7 +530,7 @@
 static void s3c2440_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
 {
 	struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
-	readsl(info->regs + S3C2440_NFDATA, buf, len / 4);
+	readsl(info->regs + S3C2440_NFDATA, buf, len >> 2);
 }
 
 static void s3c2410_nand_write_buf(struct mtd_info *mtd, const u_char *buf, int len)
@@ -542,7 +542,7 @@
 static void s3c2440_nand_write_buf(struct mtd_info *mtd, const u_char *buf, int len)
 {
 	struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
-	writesl(info->regs + S3C2440_NFDATA, buf, len / 4);
+	writesl(info->regs + S3C2440_NFDATA, buf, len >> 2);
 }
 
 /* cpufreq driver support */



More information about the openmoko-kernel mailing list