Skip to content

Commit e2843cb

Browse files
Colin Ian KingLinus Walleij
authored andcommitted
gpio: gpio-stmpe: make various char arrays static const, shrinks object size
Don't populate the read-only arrays edge_det_values, rise_values and fall_values on the stack but instead make them static and constify them. Makes the object code smaller by over 240 bytes: Before: text data bss dec hex filename 9525 2520 192 12237 2fcd drivers/gpio/gpio-stmpe.o After: text data bss dec hex filename 9025 2776 192 11993 2ed9 drivers/gpio/gpio-stmpe.o (gcc version 7.2.0 x86_64) Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent deb2e71 commit e2843cb

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

‎drivers/gpio/gpio-stmpe.c‎

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -273,15 +273,21 @@ static void stmpe_dbg_show_one(struct seq_file *s,
273273
u8 fall_reg;
274274
u8 irqen_reg;
275275

276-
char *edge_det_values[] = {"edge-inactive",
277-
"edge-asserted",
278-
"not-supported"};
279-
char *rise_values[] = {"no-rising-edge-detection",
280-
"rising-edge-detection",
281-
"not-supported"};
282-
char *fall_values[] = {"no-falling-edge-detection",
283-
"falling-edge-detection",
284-
"not-supported"};
276+
static const char * const edge_det_values[] = {
277+
"edge-inactive",
278+
"edge-asserted",
279+
"not-supported"
280+
};
281+
static const char * const rise_values[] = {
282+
"no-rising-edge-detection",
283+
"rising-edge-detection",
284+
"not-supported"
285+
};
286+
static const char * const fall_values[] = {
287+
"no-falling-edge-detection",
288+
"falling-edge-detection",
289+
"not-supported"
290+
};
285291
#define NOT_SUPPORTED_IDX 2
286292
u8 edge_det = NOT_SUPPORTED_IDX;
287293
u8 rise = NOT_SUPPORTED_IDX;

0 commit comments

Comments
 (0)