Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging/panel: Mark local functions/structs static and add const if applicable (fix sparse warnings)

sparse complains about the following functions:
panel.c:188:1: warning: symbol 'logical_inputs' was not declared. Should it be static?
panel.c:569:6: warning: symbol 'old_keypad_profile' was not declared. Should it be static?
panel.c:580:6: warning: symbol 'new_keypad_profile' was not declared. Should it be static?
panel.c:593:6: warning: symbol 'nexcom_keypad_profile' was not declared. Should it be static?
panel.c:672:6: warning: symbol 'pin_to_bits' was not declared. Should it be static?
panel.c:1375:6: warning: symbol 'panel_lcd_print' was not declared. Should it be static?
panel.c:1382:6: warning: symbol 'lcd_init' was not declared. Should it be static?
panel.c:2181:5: warning: symbol 'panel_init' was not declared. Should it be static?

Add the static keyword to silence these warnings and make sparse happy.

If structs or function parameters are used readonly they are also marked
as const.

CC: David Howells <dhowells@redhat.com>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Peter Huewe and committed by
Greg Kroah-Hartman
36d2041a a81875dd

+16 -15
+16 -15
drivers/staging/panel/panel.c
··· 185 185 } u; 186 186 }; 187 187 188 - LIST_HEAD(logical_inputs); /* list of all defined logical inputs */ 188 + static LIST_HEAD(logical_inputs); /* list of all defined logical inputs */ 189 189 190 190 /* physical contacts history 191 191 * Physical contacts are a 45 bits string of 9 groups of 5 bits each. ··· 527 527 "# of the // port pin connected to serial LCD 'SCL' " 528 528 "signal, with polarity (-17..17)"); 529 529 530 - static unsigned char *lcd_char_conv; 530 + static const unsigned char *lcd_char_conv; 531 531 532 532 /* for some LCD drivers (ks0074) we need a charset conversion table. */ 533 - static unsigned char lcd_char_conv_ks0074[256] = { 533 + static const unsigned char lcd_char_conv_ks0074[256] = { 534 534 /* 0|8 1|9 2|A 3|B 4|C 5|D 6|E 7|F */ 535 535 /* 0x00 */ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 536 536 /* 0x08 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, ··· 566 566 /* 0xF8 */ 0xac, 0xa6, 0xea, 0xef, 0x7e, 0xeb, 0xb2, 0x79, 567 567 }; 568 568 569 - char old_keypad_profile[][4][9] = { 569 + static const char old_keypad_profile[][4][9] = { 570 570 {"S0", "Left\n", "Left\n", ""}, 571 571 {"S1", "Down\n", "Down\n", ""}, 572 572 {"S2", "Up\n", "Up\n", ""}, ··· 577 577 }; 578 578 579 579 /* signals, press, repeat, release */ 580 - char new_keypad_profile[][4][9] = { 580 + static const char new_keypad_profile[][4][9] = { 581 581 {"S0", "Left\n", "Left\n", ""}, 582 582 {"S1", "Down\n", "Down\n", ""}, 583 583 {"S2", "Up\n", "Up\n", ""}, ··· 590 590 }; 591 591 592 592 /* signals, press, repeat, release */ 593 - char nexcom_keypad_profile[][4][9] = { 593 + static const char nexcom_keypad_profile[][4][9] = { 594 594 {"a-p-e-", "Down\n", "Down\n", ""}, 595 595 {"a-p-E-", "Ret\n", "Ret\n", ""}, 596 596 {"a-P-E-", "Esc\n", "Esc\n", ""}, ··· 599 599 {"", "", "", ""} 600 600 }; 601 601 602 - static char (*keypad_profile)[4][9] = old_keypad_profile; 602 + static const char (*keypad_profile)[4][9] = old_keypad_profile; 603 603 604 604 /* FIXME: this should be converted to a bit array containing signals states */ 605 605 static struct { ··· 669 669 * out(dport, in(dport) & d_val[2] | d_val[signal_state]) 670 670 * out(cport, in(cport) & c_val[2] | c_val[signal_state]) 671 671 */ 672 - void pin_to_bits(int pin, unsigned char *d_val, unsigned char *c_val) 672 + static void pin_to_bits(int pin, unsigned char *d_val, unsigned char *c_val) 673 673 { 674 674 int d_bit, c_bit, inv; 675 675 ··· 1372 1372 }; 1373 1373 1374 1374 /* public function usable from the kernel for any purpose */ 1375 - void panel_lcd_print(char *s) 1375 + static void panel_lcd_print(const char *s) 1376 1376 { 1377 1377 if (lcd_enabled && lcd_initialized) 1378 1378 lcd_write(NULL, s, strlen(s), NULL); 1379 1379 } 1380 1380 1381 1381 /* initialize the LCD driver */ 1382 - void lcd_init(void) 1382 + static void lcd_init(void) 1383 1383 { 1384 1384 switch (lcd_type) { 1385 1385 case LCD_TYPE_OLD: ··· 1638 1638 &keypad_fops 1639 1639 }; 1640 1640 1641 - static void keypad_send_key(char *string, int max_len) 1641 + static void keypad_send_key(const char *string, int max_len) 1642 1642 { 1643 1643 if (init_in_progress) 1644 1644 return; ··· 1929 1929 * corresponding to out and in bits respectively. 1930 1930 * returns 1 if ok, 0 if error (in which case, nothing is written). 1931 1931 */ 1932 - static int input_name2mask(char *name, pmask_t *mask, pmask_t *value, 1932 + static int input_name2mask(const char *name, pmask_t *mask, pmask_t *value, 1933 1933 char *imask, char *omask) 1934 1934 { 1935 1935 static char sigtab[10] = "EeSsPpAaBb"; ··· 1977 1977 * strings <press>, <repeat>, <release> for these respective events. 1978 1978 * Returns the pointer to the new key if ok, NULL if the key could not be bound. 1979 1979 */ 1980 - static struct logical_input *panel_bind_key(char *name, char *press, 1981 - char *repeat, char *release) 1980 + static struct logical_input *panel_bind_key(const char *name, const char *press, 1981 + const char *repeat, 1982 + const char *release) 1982 1983 { 1983 1984 struct logical_input *key; 1984 1985 ··· 2179 2178 }; 2180 2179 2181 2180 /* init function */ 2182 - int panel_init(void) 2181 + static int panel_init(void) 2183 2182 { 2184 2183 /* for backwards compatibility */ 2185 2184 if (keypad_type < 0)