]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
media: ov9640: make const arrays res_x/y static const, reduces object code size
authorColin Ian King <colin.king@canonical.com>
Wed, 6 Sep 2017 13:30:16 +0000 (09:30 -0400)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Sat, 23 Sep 2017 12:30:10 +0000 (08:30 -0400)
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>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/i2c/soc_camera/ov9640.c

index 0146d1f7aacb0967a41ac5df3dcd785514ea77cf..dafea6d90ad92a5d1d2e01360c8dc2fb3375a643 100644 (file)
@@ -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) {