Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1727473 > unrolled thread

[PATCH] [media] ov9640: make const arrays res_x/y static const, reduces object code size

Started byColin King <colin.king@canonical.com>
First post2017-09-06 15:40 +0200
Last post2017-09-06 15:40 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] [media] ov9640: make const arrays res_x/y static const, reduces object code size Colin King <colin.king@canonical.com> - 2017-09-06 15:40 +0200

#1727473 — [PATCH] [media] ov9640: make const arrays res_x/y static const, reduces object code size

FromColin King <colin.king@canonical.com>
Date2017-09-06 15:40 +0200
Subject[PATCH] [media] ov9640: make const arrays res_x/y static const, reduces object code size
Message-ID<umIIF-2qh-3@gated-at.bofh.it>
From: Colin Ian King <colin.king@canonical.com>

Don't populate the arrays res_x and resy_y on the stack, instead make them
static const.  Makes the object code smaller by over 160 bytes:

Before:
   text	   data	    bss	    dec	    hex	filename
  10509	   2800	     64	  13373	   343d	ov9640.o

After:
   text	   data	    bss	    dec	    hex	filename
  10184	   2960	     64	  13208	   3398	ov9640.o

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/media/i2c/soc_camera/ov9640.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/soc_camera/ov9640.c b/drivers/media/i2c/soc_camera/ov9640.c
index 0146d1f7aacb..dafea6d90ad9 100644
--- a/drivers/media/i2c/soc_camera/ov9640.c
+++ b/drivers/media/i2c/soc_camera/ov9640.c
@@ -335,8 +335,8 @@ static void ov9640_res_roundup(u32 *width, u32 *height)
 {
 	int i;
 	enum { QQCIF, QQVGA, QCIF, QVGA, CIF, VGA, SXGA };
-	int res_x[] = { 88, 160, 176, 320, 352, 640, 1280 };
-	int res_y[] = { 72, 120, 144, 240, 288, 480, 960 };
+	static const int res_x[] = { 88, 160, 176, 320, 352, 640, 1280 };
+	static const int res_y[] = { 72, 120, 144, 240, 288, 480, 960 };
 
 	for (i = 0; i < ARRAY_SIZE(res_x); i++) {
 		if (res_x[i] >= *width && res_y[i] >= *height) {
-- 
2.14.1

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web