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

ALSA: caiaq: More constifications

Apply const prefix to each possible place: the rate table, the
controller tables, and the key tables.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-13-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>

+16 -16
+1 -1
sound/usb/caiaq/audio.c
··· 179 179 #error "Change this table" 180 180 #endif 181 181 182 - static unsigned int rates[] = { 5512, 8000, 11025, 16000, 22050, 32000, 44100, 182 + static const unsigned int rates[] = { 5512, 8000, 11025, 16000, 22050, 32000, 44100, 183 183 48000, 64000, 88200, 96000, 176400, 192000 }; 184 184 185 185 static int snd_usb_caiaq_pcm_prepare(struct snd_pcm_substream *substream)
+10 -10
sound/usb/caiaq/control.c
··· 163 163 int index; 164 164 }; 165 165 166 - static struct caiaq_controller ak1_controller[] = { 166 + static const struct caiaq_controller ak1_controller[] = { 167 167 { "LED left", 2 }, 168 168 { "LED middle", 1 }, 169 169 { "LED right", 0 }, 170 170 { "LED ring", 3 } 171 171 }; 172 172 173 - static struct caiaq_controller rk2_controller[] = { 173 + static const struct caiaq_controller rk2_controller[] = { 174 174 { "LED 1", 5 }, 175 175 { "LED 2", 4 }, 176 176 { "LED 3", 3 }, ··· 196 196 { "LED 7seg_3g", 23 } 197 197 }; 198 198 199 - static struct caiaq_controller rk3_controller[] = { 199 + static const struct caiaq_controller rk3_controller[] = { 200 200 { "LED 7seg_1a", 0 + 0 }, 201 201 { "LED 7seg_1b", 0 + 1 }, 202 202 { "LED 7seg_1c", 0 + 2 }, ··· 244 244 { "LED pedal", 32 + 8 } 245 245 }; 246 246 247 - static struct caiaq_controller kore_controller[] = { 247 + static const struct caiaq_controller kore_controller[] = { 248 248 { "LED F1", 8 | CNT_INTVAL }, 249 249 { "LED F2", 12 | CNT_INTVAL }, 250 250 { "LED F3", 0 | CNT_INTVAL }, ··· 278 278 { "LED control", 26 | CNT_INTVAL } 279 279 }; 280 280 281 - static struct caiaq_controller a8dj_controller[] = { 281 + static const struct caiaq_controller a8dj_controller[] = { 282 282 { "Current input mode", 0 | CNT_INTVAL }, 283 283 { "GND lift for TC Vinyl mode", 24 + 0 }, 284 284 { "GND lift for TC CD/Line mode", 24 + 1 }, ··· 286 286 { "Software lock", 40 } 287 287 }; 288 288 289 - static struct caiaq_controller a4dj_controller[] = { 289 + static const struct caiaq_controller a4dj_controller[] = { 290 290 { "Current input mode", 0 | CNT_INTVAL } 291 291 }; 292 292 293 - static struct caiaq_controller kontrolx1_controller[] = { 293 + static const struct caiaq_controller kontrolx1_controller[] = { 294 294 { "LED FX A: ON", 7 | CNT_INTVAL }, 295 295 { "LED FX A: 1", 6 | CNT_INTVAL }, 296 296 { "LED FX A: 2", 5 | CNT_INTVAL }, ··· 327 327 { "LED Deck B: SYNC", 8 | CNT_INTVAL }, 328 328 }; 329 329 330 - static struct caiaq_controller kontrols4_controller[] = { 330 + static const struct caiaq_controller kontrols4_controller[] = { 331 331 { "LED: Master: Quant", 10 | CNT_INTVAL }, 332 332 { "LED: Master: Headphone", 11 | CNT_INTVAL }, 333 333 { "LED: Master: Master", 12 | CNT_INTVAL }, ··· 500 500 { "LED: FX2: Mode", 133 | CNT_INTVAL }, 501 501 }; 502 502 503 - static struct caiaq_controller maschine_controller[] = { 503 + static const struct caiaq_controller maschine_controller[] = { 504 504 { "LED: Pad 1", 3 | CNT_INTVAL }, 505 505 { "LED: Pad 2", 2 | CNT_INTVAL }, 506 506 { "LED: Pad 3", 1 | CNT_INTVAL }, ··· 568 568 { "Backlight Display", 59 | CNT_INTVAL } 569 569 }; 570 570 571 - static int add_controls(struct caiaq_controller *c, int num, 571 + static int add_controls(const struct caiaq_controller *c, int num, 572 572 struct snd_usb_caiaqdev *cdev) 573 573 { 574 574 int i, ret;
+5 -5
sound/usb/caiaq/input.c
··· 14 14 #include "device.h" 15 15 #include "input.h" 16 16 17 - static unsigned short keycode_ak1[] = { KEY_C, KEY_B, KEY_A }; 18 - static unsigned short keycode_rk2[] = { KEY_1, KEY_2, KEY_3, KEY_4, 17 + static const unsigned short keycode_ak1[] = { KEY_C, KEY_B, KEY_A }; 18 + static const unsigned short keycode_rk2[] = { KEY_1, KEY_2, KEY_3, KEY_4, 19 19 KEY_5, KEY_6, KEY_7 }; 20 - static unsigned short keycode_rk3[] = { KEY_1, KEY_2, KEY_3, KEY_4, 20 + static const unsigned short keycode_rk3[] = { KEY_1, KEY_2, KEY_3, KEY_4, 21 21 KEY_5, KEY_6, KEY_7, KEY_8, KEY_9 }; 22 22 23 - static unsigned short keycode_kore[] = { 23 + static const unsigned short keycode_kore[] = { 24 24 KEY_FN_F1, /* "menu" */ 25 25 KEY_FN_F7, /* "lcd backlight */ 26 26 KEY_FN_F2, /* "control" */ ··· 60 60 #define MASCHINE_PADS (16) 61 61 #define MASCHINE_PAD(X) ((X) + ABS_PRESSURE) 62 62 63 - static unsigned short keycode_maschine[] = { 63 + static const unsigned short keycode_maschine[] = { 64 64 MASCHINE_BUTTON(40), /* mute */ 65 65 MASCHINE_BUTTON(39), /* solo */ 66 66 MASCHINE_BUTTON(38), /* select */