From d577b6c8cf8ccaafda419a40af05c2eadac27bf7 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 9 Dec 2019 10:48:42 +0100 Subject: ALSA: ad1816a: Use managed buffer allocation Clean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped. Link: https://lore.kernel.org/r/20191209094943.14984-11-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/ad1816a/ad1816a_lib.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/ad1816a/ad1816a_lib.c b/sound/isa/ad1816a/ad1816a_lib.c index c4c60ebe2417..adc35051c5e9 100644 --- a/sound/isa/ad1816a/ad1816a_lib.c +++ b/sound/isa/ad1816a/ad1816a_lib.c @@ -206,17 +206,6 @@ static int snd_ad1816a_capture_trigger(struct snd_pcm_substream *substream, int SNDRV_PCM_STREAM_CAPTURE, cmd, 1); } -static int snd_ad1816a_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *hw_params) -{ - return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); -} - -static int snd_ad1816a_hw_free(struct snd_pcm_substream *substream) -{ - return snd_pcm_lib_free_pages(substream); -} - static int snd_ad1816a_playback_prepare(struct snd_pcm_substream *substream) { struct snd_ad1816a *chip = snd_pcm_substream_chip(substream); @@ -645,8 +634,6 @@ static const struct snd_pcm_ops snd_ad1816a_playback_ops = { .open = snd_ad1816a_playback_open, .close = snd_ad1816a_playback_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_ad1816a_hw_params, - .hw_free = snd_ad1816a_hw_free, .prepare = snd_ad1816a_playback_prepare, .trigger = snd_ad1816a_playback_trigger, .pointer = snd_ad1816a_playback_pointer, @@ -656,8 +643,6 @@ static const struct snd_pcm_ops snd_ad1816a_capture_ops = { .open = snd_ad1816a_capture_open, .close = snd_ad1816a_capture_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_ad1816a_hw_params, - .hw_free = snd_ad1816a_hw_free, .prepare = snd_ad1816a_capture_prepare, .trigger = snd_ad1816a_capture_trigger, .pointer = snd_ad1816a_capture_pointer, @@ -680,9 +665,8 @@ int snd_ad1816a_pcm(struct snd_ad1816a *chip, int device) strcpy(pcm->name, snd_ad1816a_chip_id(chip)); snd_ad1816a_init(chip); - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, - chip->card->dev, - 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024); + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, chip->card->dev, + 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024); chip->pcm = pcm; return 0; -- cgit From 427f0ea46fb041c5397abc83906b910ec9b96825 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 9 Dec 2019 10:48:43 +0100 Subject: ALSA: cmi8330: Use managed buffer allocation Clean up the driver with the new managed buffer allocation API. The actual removal of superfluous code will be done in ad1848 and sb codec drivers later. Link: https://lore.kernel.org/r/20191209094943.14984-12-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/cmi8330.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c index bb7d4940ac25..f8ec59a5bb8f 100644 --- a/sound/isa/cmi8330.c +++ b/sound/isa/cmi8330.c @@ -455,9 +455,8 @@ static int snd_cmi8330_pcm(struct snd_card *card, struct snd_cmi8330 *chip) snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &chip->streams[SNDRV_PCM_STREAM_PLAYBACK].ops); snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &chip->streams[SNDRV_PCM_STREAM_CAPTURE].ops); - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, - card->dev, - 64*1024, 128*1024); + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, + card->dev, 64*1024, 128*1024); chip->pcm = pcm; return 0; -- cgit From eb40b64f289717e0e9d07bc57a241e692ff31640 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 9 Dec 2019 10:48:44 +0100 Subject: ALSA: es1688: Use managed buffer allocation Clean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped. Link: https://lore.kernel.org/r/20191209094943.14984-13-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/es1688/es1688_lib.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/es1688/es1688_lib.c b/sound/isa/es1688/es1688_lib.c index a28dabaae0d3..d2c268595168 100644 --- a/sound/isa/es1688/es1688_lib.c +++ b/sound/isa/es1688/es1688_lib.c @@ -341,17 +341,6 @@ static int snd_es1688_trigger(struct snd_es1688 *chip, int cmd, unsigned char va return 0; } -static int snd_es1688_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *hw_params) -{ - return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); -} - -static int snd_es1688_hw_free(struct snd_pcm_substream *substream) -{ - return snd_pcm_lib_free_pages(substream); -} - static int snd_es1688_playback_prepare(struct snd_pcm_substream *substream) { unsigned long flags; @@ -693,8 +682,6 @@ static const struct snd_pcm_ops snd_es1688_playback_ops = { .open = snd_es1688_playback_open, .close = snd_es1688_playback_close, .ioctl = snd_es1688_ioctl, - .hw_params = snd_es1688_hw_params, - .hw_free = snd_es1688_hw_free, .prepare = snd_es1688_playback_prepare, .trigger = snd_es1688_playback_trigger, .pointer = snd_es1688_playback_pointer, @@ -704,8 +691,6 @@ static const struct snd_pcm_ops snd_es1688_capture_ops = { .open = snd_es1688_capture_open, .close = snd_es1688_capture_close, .ioctl = snd_es1688_ioctl, - .hw_params = snd_es1688_hw_params, - .hw_free = snd_es1688_hw_free, .prepare = snd_es1688_capture_prepare, .trigger = snd_es1688_capture_trigger, .pointer = snd_es1688_capture_pointer, @@ -728,9 +713,8 @@ int snd_es1688_pcm(struct snd_card *card, struct snd_es1688 *chip, int device) strcpy(pcm->name, snd_es1688_chip_id(chip)); chip->pcm = pcm; - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, - card->dev, - 64*1024, 64*1024); + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, card->dev, + 64*1024, 64*1024); return 0; } -- cgit From 9ce57056d8ce15972b5547559e8f4e5d2013c4ec Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 9 Dec 2019 10:48:45 +0100 Subject: ALSA: es18xx: Use managed buffer allocation Clean up the driver with the new managed buffer allocation API. The hw_free callback became superfluous and got dropped. Link: https://lore.kernel.org/r/20191209094943.14984-14-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/es18xx.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 01ad15086c4a..1346447ffe01 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c @@ -434,7 +434,7 @@ static int snd_es18xx_playback_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) { struct snd_es18xx *chip = snd_pcm_substream_chip(substream); - int shift, err; + int shift; shift = 0; if (params_channels(hw_params) == 2) @@ -453,16 +453,9 @@ static int snd_es18xx_playback_hw_params(struct snd_pcm_substream *substream, } else { chip->dma1_shift = shift; } - if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0) - return err; return 0; } -static int snd_es18xx_pcm_hw_free(struct snd_pcm_substream *substream) -{ - return snd_pcm_lib_free_pages(substream); -} - static int snd_es18xx_playback1_prepare(struct snd_es18xx *chip, struct snd_pcm_substream *substream) { @@ -543,7 +536,7 @@ static int snd_es18xx_capture_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) { struct snd_es18xx *chip = snd_pcm_substream_chip(substream); - int shift, err; + int shift; shift = 0; if ((chip->caps & ES18XX_DUPLEX_MONO) && @@ -557,8 +550,6 @@ static int snd_es18xx_capture_hw_params(struct snd_pcm_substream *substream, if (snd_pcm_format_width(params_format(hw_params)) == 16) shift++; chip->dma1_shift = shift; - if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0) - return err; return 0; } @@ -915,7 +906,6 @@ static int snd_es18xx_playback_close(struct snd_pcm_substream *substream) else chip->playback_b_substream = NULL; - snd_pcm_lib_free_pages(substream); return 0; } @@ -924,7 +914,6 @@ static int snd_es18xx_capture_close(struct snd_pcm_substream *substream) struct snd_es18xx *chip = snd_pcm_substream_chip(substream); chip->capture_a_substream = NULL; - snd_pcm_lib_free_pages(substream); return 0; } @@ -1656,7 +1645,6 @@ static const struct snd_pcm_ops snd_es18xx_playback_ops = { .close = snd_es18xx_playback_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_es18xx_playback_hw_params, - .hw_free = snd_es18xx_pcm_hw_free, .prepare = snd_es18xx_playback_prepare, .trigger = snd_es18xx_playback_trigger, .pointer = snd_es18xx_playback_pointer, @@ -1667,7 +1655,6 @@ static const struct snd_pcm_ops snd_es18xx_capture_ops = { .close = snd_es18xx_capture_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_es18xx_capture_hw_params, - .hw_free = snd_es18xx_pcm_hw_free, .prepare = snd_es18xx_capture_prepare, .trigger = snd_es18xx_capture_trigger, .pointer = snd_es18xx_capture_pointer, @@ -1701,10 +1688,9 @@ static int snd_es18xx_pcm(struct snd_card *card, int device) sprintf(pcm->name, "ESS AudioDrive ES%x", chip->version); chip->pcm = pcm; - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, - card->dev, - 64*1024, - chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024); + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, card->dev, + 64*1024, + chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024); return 0; } -- cgit From 07ed72ba4d45601313848664e97cb2fc5d71f45d Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 9 Dec 2019 10:48:46 +0100 Subject: ALSA: sb: Use managed buffer allocation Clean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and got dropped. Link: https://lore.kernel.org/r/20191209094943.14984-15-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/sb/sb16_main.c | 21 ++------------------- sound/isa/sb/sb8_main.c | 21 ++------------------- 2 files changed, 4 insertions(+), 38 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/sb/sb16_main.c b/sound/isa/sb/sb16_main.c index 0768bbf8fd71..07ebf2c49443 100644 --- a/sound/isa/sb/sb16_main.c +++ b/sound/isa/sb/sb16_main.c @@ -232,18 +232,6 @@ static void snd_sb16_setup_rate(struct snd_sb *chip, spin_unlock_irqrestore(&chip->reg_lock, flags); } -static int snd_sb16_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *hw_params) -{ - return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); -} - -static int snd_sb16_hw_free(struct snd_pcm_substream *substream) -{ - snd_pcm_lib_free_pages(substream); - return 0; -} - static int snd_sb16_playback_prepare(struct snd_pcm_substream *substream) { unsigned long flags; @@ -830,8 +818,6 @@ static const struct snd_pcm_ops snd_sb16_playback_ops = { .open = snd_sb16_playback_open, .close = snd_sb16_playback_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_sb16_hw_params, - .hw_free = snd_sb16_hw_free, .prepare = snd_sb16_playback_prepare, .trigger = snd_sb16_playback_trigger, .pointer = snd_sb16_playback_pointer, @@ -841,8 +827,6 @@ static const struct snd_pcm_ops snd_sb16_capture_ops = { .open = snd_sb16_capture_open, .close = snd_sb16_capture_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_sb16_hw_params, - .hw_free = snd_sb16_hw_free, .prepare = snd_sb16_capture_prepare, .trigger = snd_sb16_capture_trigger, .pointer = snd_sb16_capture_pointer, @@ -873,9 +857,8 @@ int snd_sb16dsp_pcm(struct snd_sb *chip, int device) pcm->info_flags = SNDRV_PCM_INFO_HALF_DUPLEX; } - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, - card->dev, - 64*1024, 128*1024); + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, + card->dev, 64*1024, 128*1024); return 0; } diff --git a/sound/isa/sb/sb8_main.c b/sound/isa/sb/sb8_main.c index 8221b85bb330..5804fa523600 100644 --- a/sound/isa/sb/sb8_main.c +++ b/sound/isa/sb/sb8_main.c @@ -225,18 +225,6 @@ static int snd_sb8_playback_trigger(struct snd_pcm_substream *substream, return 0; } -static int snd_sb8_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *hw_params) -{ - return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); -} - -static int snd_sb8_hw_free(struct snd_pcm_substream *substream) -{ - snd_pcm_lib_free_pages(substream); - return 0; -} - static int snd_sb8_capture_prepare(struct snd_pcm_substream *substream) { unsigned long flags; @@ -559,8 +547,6 @@ static const struct snd_pcm_ops snd_sb8_playback_ops = { .open = snd_sb8_open, .close = snd_sb8_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_sb8_hw_params, - .hw_free = snd_sb8_hw_free, .prepare = snd_sb8_playback_prepare, .trigger = snd_sb8_playback_trigger, .pointer = snd_sb8_playback_pointer, @@ -570,8 +556,6 @@ static const struct snd_pcm_ops snd_sb8_capture_ops = { .open = snd_sb8_open, .close = snd_sb8_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_sb8_hw_params, - .hw_free = snd_sb8_hw_free, .prepare = snd_sb8_capture_prepare, .trigger = snd_sb8_capture_trigger, .pointer = snd_sb8_capture_pointer, @@ -595,9 +579,8 @@ int snd_sb8dsp_pcm(struct snd_sb *chip, int device) if (chip->dma8 > 3 || chip->dma16 >= 0) max_prealloc = 128 * 1024; - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, - card->dev, - 64*1024, max_prealloc); + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, + card->dev, 64*1024, max_prealloc); return 0; } -- cgit From a57214e5486254d3242b863fe82309633c4cdb06 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 9 Dec 2019 10:48:47 +0100 Subject: ALSA: gus: Use managed buffer allocation Clean up the driver with the new managed buffer allocation API. The hw_free callback became superfluous and got dropped. Link: https://lore.kernel.org/r/20191209094943.14984-16-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/gus/gus_pcm.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/gus/gus_pcm.c b/sound/isa/gus/gus_pcm.c index 6385b61aa094..bd3a54bc4a94 100644 --- a/sound/isa/gus/gus_pcm.c +++ b/sound/isa/gus/gus_pcm.c @@ -423,11 +423,8 @@ static int snd_gf1_pcm_playback_hw_params(struct snd_pcm_substream *substream, struct snd_gus_card *gus = snd_pcm_substream_chip(substream); struct snd_pcm_runtime *runtime = substream->runtime; struct gus_pcm_private *pcmp = runtime->private_data; - int err; - - if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0) - return err; - if (err > 0) { /* change */ + + if (runtime->buffer_changed) { struct snd_gf1_mem_block *block; if (pcmp->memory > 0) { snd_gf1_mem_free(&gus->gf1.mem_alloc, pcmp->memory); @@ -471,7 +468,6 @@ static int snd_gf1_pcm_playback_hw_free(struct snd_pcm_substream *substream) struct snd_pcm_runtime *runtime = substream->runtime; struct gus_pcm_private *pcmp = runtime->private_data; - snd_pcm_lib_free_pages(substream); if (pcmp->pvoices[0]) { snd_gf1_free_voice(pcmp->gus, pcmp->pvoices[0]); pcmp->pvoices[0] = NULL; @@ -574,12 +570,7 @@ static int snd_gf1_pcm_capture_hw_params(struct snd_pcm_substream *substream, gus->gf1.pcm_rcntrl_reg |= 4; if (snd_pcm_format_unsigned(params_format(hw_params))) gus->gf1.pcm_rcntrl_reg |= 0x80; - return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); -} - -static int snd_gf1_pcm_capture_hw_free(struct snd_pcm_substream *substream) -{ - return snd_pcm_lib_free_pages(substream); + return 0; } static int snd_gf1_pcm_capture_prepare(struct snd_pcm_substream *substream) @@ -846,7 +837,6 @@ static const struct snd_pcm_ops snd_gf1_pcm_capture_ops = { .close = snd_gf1_pcm_capture_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_gf1_pcm_capture_hw_params, - .hw_free = snd_gf1_pcm_capture_hw_free, .prepare = snd_gf1_pcm_capture_prepare, .trigger = snd_gf1_pcm_capture_trigger, .pointer = snd_gf1_pcm_capture_pointer, @@ -875,9 +865,9 @@ int snd_gf1_pcm_new(struct snd_gus_card *gus, int pcm_dev, int control_index) snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_gf1_pcm_playback_ops); for (substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; substream; substream = substream->next) - snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV, - card->dev, - 64*1024, gus->gf1.dma1 > 3 ? 128*1024 : 64*1024); + snd_pcm_set_managed_buffer(substream, SNDRV_DMA_TYPE_DEV, + card->dev, + 64*1024, gus->gf1.dma1 > 3 ? 128*1024 : 64*1024); pcm->info_flags = 0; pcm->dev_subclass = SNDRV_PCM_SUBCLASS_GENERIC_MIX; @@ -885,9 +875,9 @@ int snd_gf1_pcm_new(struct snd_gus_card *gus, int pcm_dev, int control_index) snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_gf1_pcm_capture_ops); if (gus->gf1.dma2 == gus->gf1.dma1) pcm->info_flags |= SNDRV_PCM_INFO_HALF_DUPLEX; - snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream, - SNDRV_DMA_TYPE_DEV, card->dev, - 64*1024, gus->gf1.dma2 > 3 ? 128*1024 : 64*1024); + snd_pcm_set_managed_buffer(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream, + SNDRV_DMA_TYPE_DEV, card->dev, + 64*1024, gus->gf1.dma2 > 3 ? 128*1024 : 64*1024); } strcpy(pcm->name, pcm->id); if (gus->interwave) { -- cgit From 15fbacfe3d32d60044e27e7d00f24bfaca943449 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 9 Dec 2019 10:48:48 +0100 Subject: ALSA: wss: Use managed buffer allocation Clean up the driver with the new managed buffer allocation API. The hw_free callback became superfluous and got dropped. Link: https://lore.kernel.org/r/20191209094943.14984-17-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/wss/wss_lib.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/wss/wss_lib.c b/sound/isa/wss/wss_lib.c index c43f2602249b..0ef89c97ccd2 100644 --- a/sound/isa/wss/wss_lib.c +++ b/sound/isa/wss/wss_lib.c @@ -982,10 +982,7 @@ static int snd_wss_playback_hw_params(struct snd_pcm_substream *substream, { struct snd_wss *chip = snd_pcm_substream_chip(substream); unsigned char new_pdfr; - int err; - if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0) - return err; new_pdfr = snd_wss_get_format(chip, params_format(hw_params), params_channels(hw_params)) | snd_wss_get_rate(params_rate(hw_params)); @@ -993,11 +990,6 @@ static int snd_wss_playback_hw_params(struct snd_pcm_substream *substream, return 0; } -static int snd_wss_playback_hw_free(struct snd_pcm_substream *substream) -{ - return snd_pcm_lib_free_pages(substream); -} - static int snd_wss_playback_prepare(struct snd_pcm_substream *substream) { struct snd_wss *chip = snd_pcm_substream_chip(substream); @@ -1025,10 +1017,7 @@ static int snd_wss_capture_hw_params(struct snd_pcm_substream *substream, { struct snd_wss *chip = snd_pcm_substream_chip(substream); unsigned char new_cdfr; - int err; - if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0) - return err; new_cdfr = snd_wss_get_format(chip, params_format(hw_params), params_channels(hw_params)) | snd_wss_get_rate(params_rate(hw_params)); @@ -1036,11 +1025,6 @@ static int snd_wss_capture_hw_params(struct snd_pcm_substream *substream, return 0; } -static int snd_wss_capture_hw_free(struct snd_pcm_substream *substream) -{ - return snd_pcm_lib_free_pages(substream); -} - static int snd_wss_capture_prepare(struct snd_pcm_substream *substream) { struct snd_wss *chip = snd_pcm_substream_chip(substream); @@ -1889,7 +1873,6 @@ static const struct snd_pcm_ops snd_wss_playback_ops = { .close = snd_wss_playback_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_wss_playback_hw_params, - .hw_free = snd_wss_playback_hw_free, .prepare = snd_wss_playback_prepare, .trigger = snd_wss_trigger, .pointer = snd_wss_playback_pointer, @@ -1900,7 +1883,6 @@ static const struct snd_pcm_ops snd_wss_capture_ops = { .close = snd_wss_capture_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_wss_capture_hw_params, - .hw_free = snd_wss_capture_hw_free, .prepare = snd_wss_capture_prepare, .trigger = snd_wss_trigger, .pointer = snd_wss_capture_pointer, @@ -1927,9 +1909,8 @@ int snd_wss_pcm(struct snd_wss *chip, int device) pcm->info_flags |= SNDRV_PCM_INFO_JOINT_DUPLEX; strcpy(pcm->name, snd_wss_chip_id(chip)); - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, - chip->card->dev, - 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024); + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, chip->card->dev, + 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024); chip->pcm = pcm; return 0; -- cgit From 2251612e2f992092e9f010d30c8820fcf47d7f29 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 10 Dec 2019 07:11:28 +0100 Subject: ALSA: es1688: Drop superfluous ioctl PCM ops snd_es1688_ioctl() does nothing but calling the default handler. Now PCM core accepts NULL as the default ioctl ops(*), so let's drop altogether. (*) commit fc033cbf6fb7 ("ALSA: pcm: Allow NULL ioctl ops") Link: https://lore.kernel.org/r/20191210061145.24641-7-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/es1688/es1688_lib.c | 8 -------- 1 file changed, 8 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/es1688/es1688_lib.c b/sound/isa/es1688/es1688_lib.c index d2c268595168..474d713085c7 100644 --- a/sound/isa/es1688/es1688_lib.c +++ b/sound/isa/es1688/es1688_lib.c @@ -309,12 +309,6 @@ static void snd_es1688_set_rate(struct snd_es1688 *chip, struct snd_pcm_substrea snd_es1688_write(chip, 0xa2, divider); } -static int snd_es1688_ioctl(struct snd_pcm_substream *substream, - unsigned int cmd, void *arg) -{ - return snd_pcm_lib_ioctl(substream, cmd, arg); -} - static int snd_es1688_trigger(struct snd_es1688 *chip, int cmd, unsigned char value) { int val; @@ -681,7 +675,6 @@ exit: static const struct snd_pcm_ops snd_es1688_playback_ops = { .open = snd_es1688_playback_open, .close = snd_es1688_playback_close, - .ioctl = snd_es1688_ioctl, .prepare = snd_es1688_playback_prepare, .trigger = snd_es1688_playback_trigger, .pointer = snd_es1688_playback_pointer, @@ -690,7 +683,6 @@ static const struct snd_pcm_ops snd_es1688_playback_ops = { static const struct snd_pcm_ops snd_es1688_capture_ops = { .open = snd_es1688_capture_open, .close = snd_es1688_capture_close, - .ioctl = snd_es1688_ioctl, .prepare = snd_es1688_capture_prepare, .trigger = snd_es1688_capture_trigger, .pointer = snd_es1688_capture_pointer, -- cgit From 86940651eaf4ae596e83ea68070e60462f387b6f Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 10 Dec 2019 07:11:29 +0100 Subject: ALSA: isa: Drop superfluous ioctl PCM ops PCM core deals the empty ioctl field now as default(*). Let's kill the redundant lines. (*) commit fc033cbf6fb7 ("ALSA: pcm: Allow NULL ioctl ops") Link: https://lore.kernel.org/r/20191210061145.24641-8-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/ad1816a/ad1816a_lib.c | 2 -- sound/isa/es18xx.c | 2 -- sound/isa/gus/gus_pcm.c | 2 -- sound/isa/msnd/msnd.c | 2 -- sound/isa/sb/emu8000_pcm.c | 1 - sound/isa/sb/sb16_main.c | 2 -- sound/isa/sb/sb8_main.c | 2 -- sound/isa/wss/wss_lib.c | 2 -- 8 files changed, 15 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/ad1816a/ad1816a_lib.c b/sound/isa/ad1816a/ad1816a_lib.c index adc35051c5e9..b9d340c752b4 100644 --- a/sound/isa/ad1816a/ad1816a_lib.c +++ b/sound/isa/ad1816a/ad1816a_lib.c @@ -633,7 +633,6 @@ int snd_ad1816a_create(struct snd_card *card, static const struct snd_pcm_ops snd_ad1816a_playback_ops = { .open = snd_ad1816a_playback_open, .close = snd_ad1816a_playback_close, - .ioctl = snd_pcm_lib_ioctl, .prepare = snd_ad1816a_playback_prepare, .trigger = snd_ad1816a_playback_trigger, .pointer = snd_ad1816a_playback_pointer, @@ -642,7 +641,6 @@ static const struct snd_pcm_ops snd_ad1816a_playback_ops = { static const struct snd_pcm_ops snd_ad1816a_capture_ops = { .open = snd_ad1816a_capture_open, .close = snd_ad1816a_capture_close, - .ioctl = snd_pcm_lib_ioctl, .prepare = snd_ad1816a_capture_prepare, .trigger = snd_ad1816a_capture_trigger, .pointer = snd_ad1816a_capture_pointer, diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 1346447ffe01..87a0a33807e7 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c @@ -1643,7 +1643,6 @@ static int snd_es18xx_probe(struct snd_es18xx *chip, static const struct snd_pcm_ops snd_es18xx_playback_ops = { .open = snd_es18xx_playback_open, .close = snd_es18xx_playback_close, - .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_es18xx_playback_hw_params, .prepare = snd_es18xx_playback_prepare, .trigger = snd_es18xx_playback_trigger, @@ -1653,7 +1652,6 @@ static const struct snd_pcm_ops snd_es18xx_playback_ops = { static const struct snd_pcm_ops snd_es18xx_capture_ops = { .open = snd_es18xx_capture_open, .close = snd_es18xx_capture_close, - .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_es18xx_capture_hw_params, .prepare = snd_es18xx_capture_prepare, .trigger = snd_es18xx_capture_trigger, diff --git a/sound/isa/gus/gus_pcm.c b/sound/isa/gus/gus_pcm.c index bd3a54bc4a94..aca4ab90e5bc 100644 --- a/sound/isa/gus/gus_pcm.c +++ b/sound/isa/gus/gus_pcm.c @@ -821,7 +821,6 @@ static const struct snd_kcontrol_new snd_gf1_pcm_volume_control1 = static const struct snd_pcm_ops snd_gf1_pcm_playback_ops = { .open = snd_gf1_pcm_playback_open, .close = snd_gf1_pcm_playback_close, - .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_gf1_pcm_playback_hw_params, .hw_free = snd_gf1_pcm_playback_hw_free, .prepare = snd_gf1_pcm_playback_prepare, @@ -835,7 +834,6 @@ static const struct snd_pcm_ops snd_gf1_pcm_playback_ops = { static const struct snd_pcm_ops snd_gf1_pcm_capture_ops = { .open = snd_gf1_pcm_capture_open, .close = snd_gf1_pcm_capture_close, - .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_gf1_pcm_capture_hw_params, .prepare = snd_gf1_pcm_capture_prepare, .trigger = snd_gf1_pcm_capture_trigger, diff --git a/sound/isa/msnd/msnd.c b/sound/isa/msnd/msnd.c index 82d071492201..4fbc22a5bc5a 100644 --- a/sound/isa/msnd/msnd.c +++ b/sound/isa/msnd/msnd.c @@ -562,7 +562,6 @@ snd_msnd_playback_pointer(struct snd_pcm_substream *substream) static const struct snd_pcm_ops snd_msnd_playback_ops = { .open = snd_msnd_playback_open, .close = snd_msnd_playback_close, - .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_msnd_playback_hw_params, .prepare = snd_msnd_playback_prepare, .trigger = snd_msnd_playback_trigger, @@ -659,7 +658,6 @@ static int snd_msnd_capture_hw_params(struct snd_pcm_substream *substream, static const struct snd_pcm_ops snd_msnd_capture_ops = { .open = snd_msnd_capture_open, .close = snd_msnd_capture_close, - .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_msnd_capture_hw_params, .prepare = snd_msnd_capture_prepare, .trigger = snd_msnd_capture_trigger, diff --git a/sound/isa/sb/emu8000_pcm.c b/sound/isa/sb/emu8000_pcm.c index 83b7ff5e9880..e377ac93f37f 100644 --- a/sound/isa/sb/emu8000_pcm.c +++ b/sound/isa/sb/emu8000_pcm.c @@ -660,7 +660,6 @@ static snd_pcm_uframes_t emu8k_pcm_pointer(struct snd_pcm_substream *subs) static const struct snd_pcm_ops emu8k_pcm_ops = { .open = emu8k_pcm_open, .close = emu8k_pcm_close, - .ioctl = snd_pcm_lib_ioctl, .hw_params = emu8k_pcm_hw_params, .hw_free = emu8k_pcm_hw_free, .prepare = emu8k_pcm_prepare, diff --git a/sound/isa/sb/sb16_main.c b/sound/isa/sb/sb16_main.c index 07ebf2c49443..38dc1fde25f3 100644 --- a/sound/isa/sb/sb16_main.c +++ b/sound/isa/sb/sb16_main.c @@ -817,7 +817,6 @@ int snd_sb16dsp_configure(struct snd_sb * chip) static const struct snd_pcm_ops snd_sb16_playback_ops = { .open = snd_sb16_playback_open, .close = snd_sb16_playback_close, - .ioctl = snd_pcm_lib_ioctl, .prepare = snd_sb16_playback_prepare, .trigger = snd_sb16_playback_trigger, .pointer = snd_sb16_playback_pointer, @@ -826,7 +825,6 @@ static const struct snd_pcm_ops snd_sb16_playback_ops = { static const struct snd_pcm_ops snd_sb16_capture_ops = { .open = snd_sb16_capture_open, .close = snd_sb16_capture_close, - .ioctl = snd_pcm_lib_ioctl, .prepare = snd_sb16_capture_prepare, .trigger = snd_sb16_capture_trigger, .pointer = snd_sb16_capture_pointer, diff --git a/sound/isa/sb/sb8_main.c b/sound/isa/sb/sb8_main.c index 5804fa523600..e33dfe165276 100644 --- a/sound/isa/sb/sb8_main.c +++ b/sound/isa/sb/sb8_main.c @@ -546,7 +546,6 @@ static int snd_sb8_close(struct snd_pcm_substream *substream) static const struct snd_pcm_ops snd_sb8_playback_ops = { .open = snd_sb8_open, .close = snd_sb8_close, - .ioctl = snd_pcm_lib_ioctl, .prepare = snd_sb8_playback_prepare, .trigger = snd_sb8_playback_trigger, .pointer = snd_sb8_playback_pointer, @@ -555,7 +554,6 @@ static const struct snd_pcm_ops snd_sb8_playback_ops = { static const struct snd_pcm_ops snd_sb8_capture_ops = { .open = snd_sb8_open, .close = snd_sb8_close, - .ioctl = snd_pcm_lib_ioctl, .prepare = snd_sb8_capture_prepare, .trigger = snd_sb8_capture_trigger, .pointer = snd_sb8_capture_pointer, diff --git a/sound/isa/wss/wss_lib.c b/sound/isa/wss/wss_lib.c index 0ef89c97ccd2..9114e8911712 100644 --- a/sound/isa/wss/wss_lib.c +++ b/sound/isa/wss/wss_lib.c @@ -1871,7 +1871,6 @@ EXPORT_SYMBOL(snd_wss_create); static const struct snd_pcm_ops snd_wss_playback_ops = { .open = snd_wss_playback_open, .close = snd_wss_playback_close, - .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_wss_playback_hw_params, .prepare = snd_wss_playback_prepare, .trigger = snd_wss_trigger, @@ -1881,7 +1880,6 @@ static const struct snd_pcm_ops snd_wss_playback_ops = { static const struct snd_pcm_ops snd_wss_capture_ops = { .open = snd_wss_capture_open, .close = snd_wss_capture_close, - .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_wss_capture_hw_params, .prepare = snd_wss_capture_prepare, .trigger = snd_wss_trigger, -- cgit From 0dbba47eb4e9428d8563278123992243c3c62c3e Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 10 Dec 2019 07:34:38 +0100 Subject: ALSA: ad1816a: Support PCM sync_stop The driver invokes snd_pcm_period_elapsed() simply from the interrupt handler. Set card->sync_irq for enabling the missing sync_stop PCM operation. Link: https://lore.kernel.org/r/20191210063454.31603-40-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/ad1816a/ad1816a_lib.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound/isa') diff --git a/sound/isa/ad1816a/ad1816a_lib.c b/sound/isa/ad1816a/ad1816a_lib.c index b9d340c752b4..e1aa5372c483 100644 --- a/sound/isa/ad1816a/ad1816a_lib.c +++ b/sound/isa/ad1816a/ad1816a_lib.c @@ -597,6 +597,7 @@ int snd_ad1816a_create(struct snd_card *card, return -EBUSY; } chip->irq = irq; + card->sync_irq = chip->irq; if (request_dma(dma1, "AD1816A - 1")) { snd_printk(KERN_ERR "ad1816a: can't grab DMA1 %d\n", dma1); snd_ad1816a_free(chip); -- cgit From f5ac512085b5c2667f8db5f09ce8b87648e5cce4 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 10 Dec 2019 07:34:39 +0100 Subject: ALSA: es1688: Support PCM sync_stop The driver invokes snd_pcm_period_elapsed() simply from the interrupt handler. Set card->sync_irq for enabling the missing sync_stop PCM operation. Link: https://lore.kernel.org/r/20191210063454.31603-41-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/es1688/es1688_lib.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound/isa') diff --git a/sound/isa/es1688/es1688_lib.c b/sound/isa/es1688/es1688_lib.c index 474d713085c7..632e867c5766 100644 --- a/sound/isa/es1688/es1688_lib.c +++ b/sound/isa/es1688/es1688_lib.c @@ -638,6 +638,7 @@ int snd_es1688_create(struct snd_card *card, } chip->irq = irq; + card->sync_irq = chip->irq; err = request_dma(dma8, "ES1688"); if (err < 0) { -- cgit From 58dad836f98cdba69bb4f0b0a9a19af8e39e9fbf Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 10 Dec 2019 07:34:40 +0100 Subject: ALSA: es18xx: Support PCM sync_stop The driver invokes snd_pcm_period_elapsed() simply from the interrupt handler. Set card->sync_irq for enabling the missing sync_stop PCM operation. Link: https://lore.kernel.org/r/20191210063454.31603-42-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/es18xx.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound/isa') diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 87a0a33807e7..a581083b876b 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c @@ -1781,6 +1781,7 @@ static int snd_es18xx_new_device(struct snd_card *card, return -EBUSY; } chip->irq = irq; + card->sync_irq = chip->irq; if (request_dma(dma1, "ES18xx DMA 1")) { snd_es18xx_free(card); -- cgit From 914da689090c094dd1ffce02b1fa13d7e9411ea0 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 10 Dec 2019 07:34:41 +0100 Subject: ALSA: gus: Support PCM sync_stop The driver invokes snd_pcm_period_elapsed() simply from the interrupt handler. Set card->sync_irq for enabling the missing sync_stop PCM operation. Link: https://lore.kernel.org/r/20191210063454.31603-43-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/gus/gus_main.c | 1 + sound/isa/gus/gusmax.c | 3 ++- sound/isa/gus/interwave.c | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) (limited to 'sound/isa') diff --git a/sound/isa/gus/gus_main.c b/sound/isa/gus/gus_main.c index af6b4d89d695..9f94b5f3b029 100644 --- a/sound/isa/gus/gus_main.c +++ b/sound/isa/gus/gus_main.c @@ -181,6 +181,7 @@ int snd_gus_create(struct snd_card *card, return -EBUSY; } gus->gf1.irq = irq; + card->sync_irq = irq; if (request_dma(dma1, "GUS - 1")) { snd_printk(KERN_ERR "gus: can't grab DMA1 %d\n", dma1); snd_gus_free(gus); diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c index 53eca205f870..efe576625f48 100644 --- a/sound/isa/gus/gusmax.c +++ b/sound/isa/gus/gusmax.c @@ -282,7 +282,8 @@ static int snd_gusmax_probe(struct device *pdev, unsigned int dev) goto _err; } maxcard->irq = xirq; - + card->sync_irq = maxcard->irq; + err = snd_wss_create(card, gus->gf1.port + 0x10c, -1, xirq, xdma2 < 0 ? xdma1 : xdma2, xdma1, diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c index bc006dcf8de3..5cd4aa477ba7 100644 --- a/sound/isa/gus/interwave.c +++ b/sound/isa/gus/interwave.c @@ -667,6 +667,7 @@ static int snd_interwave_probe(struct snd_card *card, int dev) return -EBUSY; } iwcard->irq = xirq; + card->sync_irq = iwcard->irq; err = snd_wss_create(card, gus->gf1.port + 0x10c, -1, xirq, -- cgit From 52f623d0a84d7c6240e53e964caaaec61b62aa9d Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 10 Dec 2019 07:34:42 +0100 Subject: ALSA: msnd: Support PCM sync_stop The driver invokes snd_pcm_period_elapsed() simply from the interrupt handler. Set card->sync_irq for enabling the missing sync_stop PCM operation. Link: https://lore.kernel.org/r/20191210063454.31603-44-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/msnd/msnd_pinnacle.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound/isa') diff --git a/sound/isa/msnd/msnd_pinnacle.c b/sound/isa/msnd/msnd_pinnacle.c index e435ebd0ced4..9e7f03eec7e6 100644 --- a/sound/isa/msnd/msnd_pinnacle.c +++ b/sound/isa/msnd/msnd_pinnacle.c @@ -538,6 +538,7 @@ static int snd_msnd_attach(struct snd_card *card) printk(KERN_ERR LOGNAME ": Couldn't grab IRQ %d\n", chip->irq); return err; } + card->sync_irq = chip->irq; if (request_region(chip->io, DSP_NUMIO, card->shortname) == NULL) { free_irq(chip->irq, chip); return -EBUSY; -- cgit From d3e163bfff972f810c67d766219807eee2d23c82 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 10 Dec 2019 07:34:43 +0100 Subject: ALSA: opl3sa2: Support PCM sync_stop The driver invokes snd_pcm_period_elapsed() simply from the interrupt handler. Set card->sync_irq for enabling the missing sync_stop PCM operation. Link: https://lore.kernel.org/r/20191210063454.31603-45-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/opl3sa2.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound/isa') diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index 941d0bd5460b..6d19ab458291 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c @@ -659,6 +659,7 @@ static int snd_opl3sa2_probe(struct snd_card *card, int dev) return -ENODEV; } chip->irq = xirq; + card->sync_irq = chip->irq; err = snd_wss_create(card, wss_port[dev] + 4, -1, xirq, xdma1, xdma2, -- cgit From 16d9fb1deef8cf0c83c86a6538f8522a89676d4c Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 10 Dec 2019 07:34:44 +0100 Subject: ALSA: opti9xx: Support PCM sync_stop The driver invokes snd_pcm_period_elapsed() simply from the interrupt handler. Set card->sync_irq for enabling the missing sync_stop PCM operation. Link: https://lore.kernel.org/r/20191210063454.31603-46-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/opti9xx/opti92x-ad1848.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound/isa') diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index fb36bb5d55df..b40ab806c349 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c @@ -869,6 +869,7 @@ static int snd_opti9xx_probe(struct snd_card *card) } #endif chip->irq = irq; + card->sync_irq = chip->irq; strcpy(card->driver, chip->name); sprintf(card->shortname, "OPTi %s", card->driver); #if defined(CS4231) || defined(OPTi93X) -- cgit From f9236dd027b85846f2fb7f959cc4baaf165d339f Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 10 Dec 2019 07:34:45 +0100 Subject: ALSA: sb: Support PCM sync_stop The driver invokes snd_pcm_period_elapsed() simply from the interrupt handler. Set card->sync_irq for enabling the missing sync_stop PCM operation. Link: https://lore.kernel.org/r/20191210063454.31603-47-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/sb/sb_common.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound/isa') diff --git a/sound/isa/sb/sb_common.c b/sound/isa/sb/sb_common.c index ff031d670400..4aaf9ab82afe 100644 --- a/sound/isa/sb/sb_common.c +++ b/sound/isa/sb/sb_common.c @@ -233,6 +233,7 @@ int snd_sbdsp_create(struct snd_card *card, return -EBUSY; } chip->irq = irq; + card->sync_irq = chip->irq; if (hardware == SB_HW_ALS4000) goto __skip_allocation; -- cgit From 48094a75cd7090aecc1b9b0dd0c5f1f70c7443cb Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 10 Dec 2019 07:34:46 +0100 Subject: ALSA: wavefront: Support PCM sync_stop The driver invokes snd_pcm_period_elapsed() simply from the interrupt handler. Set card->sync_irq for enabling the missing sync_stop PCM operation. Link: https://lore.kernel.org/r/20191210063454.31603-48-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/wavefront/wavefront.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound/isa') diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c index 95e6deb7b8d4..9e0f6b226775 100644 --- a/sound/isa/wavefront/wavefront.c +++ b/sound/isa/wavefront/wavefront.c @@ -409,6 +409,7 @@ snd_wavefront_probe (struct snd_card *card, int dev) } acard->wavefront.irq = ics2115_irq[dev]; + card->sync_irq = acard->wavefront.irq; acard->wavefront.base = ics2115_port[dev]; wavefront_synth = snd_wavefront_new_synth(card, hw_dev, acard); -- cgit From 959d4c806d386cd28aa74d65db8f0a226defab10 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 10 Dec 2019 07:34:47 +0100 Subject: ALSA: wss: Support PCM sync_stop The driver invokes snd_pcm_period_elapsed() simply from the interrupt handler. Set card->sync_irq for enabling the missing sync_stop PCM operation. Link: https://lore.kernel.org/r/20191210063454.31603-49-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/wss/wss_lib.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound/isa') diff --git a/sound/isa/wss/wss_lib.c b/sound/isa/wss/wss_lib.c index 9114e8911712..100e8b547d27 100644 --- a/sound/isa/wss/wss_lib.c +++ b/sound/isa/wss/wss_lib.c @@ -1811,6 +1811,7 @@ int snd_wss_create(struct snd_card *card, return -EBUSY; } chip->irq = irq; + card->sync_irq = chip->irq; if (!(hwshare & WSS_HWSHARE_DMA1) && request_dma(dma1, "WSS - 1")) { snd_printk(KERN_ERR "wss: can't grab DMA1 %d\n", dma1); snd_wss_free(chip); -- cgit From cb5b83580c6101ce3c7de4640ecc7f1ca6e006bf Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Wed, 1 Jan 2020 08:43:19 +0100 Subject: ALSA: ad1816a: constify copied structure The snd_ad1816a_timer_table structure is only copied into another structure, so make it const. The opportunity for this change was found using Coccinelle. Signed-off-by: Julia Lawall Link: https://lore.kernel.org/r/1577864614-5543-2-git-send-email-Julia.Lawall@inria.fr Signed-off-by: Takashi Iwai --- sound/isa/ad1816a/ad1816a_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound/isa') diff --git a/sound/isa/ad1816a/ad1816a_lib.c b/sound/isa/ad1816a/ad1816a_lib.c index e1aa5372c483..da6f68b8c248 100644 --- a/sound/isa/ad1816a/ad1816a_lib.c +++ b/sound/isa/ad1816a/ad1816a_lib.c @@ -409,7 +409,7 @@ static int snd_ad1816a_timer_stop(struct snd_timer *timer) return 0; } -static struct snd_timer_hardware snd_ad1816a_timer_table = { +static const struct snd_timer_hardware snd_ad1816a_timer_table = { .flags = SNDRV_TIMER_HW_AUTO, .resolution = 10000, .ticks = 65535, -- cgit From 99f664df4fead60e31d96cc2b5044c9b2fee0767 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 3 Jan 2020 09:16:23 +0100 Subject: ALSA: isa: Constify snd_device_ops definitions Now we may declare const for snd_device_ops definitions, so let's do it for optimization. There should be no functional changes by this patch. Link: https://lore.kernel.org/r/20200103081714.9560-8-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/ad1816a/ad1816a_lib.c | 2 +- sound/isa/es1688/es1688_lib.c | 2 +- sound/isa/es18xx.c | 2 +- sound/isa/gus/gus_main.c | 2 +- sound/isa/msnd/msnd_pinnacle.c | 2 +- sound/isa/sb/emu8000.c | 2 +- sound/isa/sb/sb_common.c | 2 +- sound/isa/wss/wss_lib.c | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/ad1816a/ad1816a_lib.c b/sound/isa/ad1816a/ad1816a_lib.c index da6f68b8c248..560885fbc983 100644 --- a/sound/isa/ad1816a/ad1816a_lib.c +++ b/sound/isa/ad1816a/ad1816a_lib.c @@ -577,7 +577,7 @@ int snd_ad1816a_create(struct snd_card *card, unsigned long port, int irq, int dma1, int dma2, struct snd_ad1816a *chip) { - static struct snd_device_ops ops = { + static const struct snd_device_ops ops = { .dev_free = snd_ad1816a_dev_free, }; int error; diff --git a/sound/isa/es1688/es1688_lib.c b/sound/isa/es1688/es1688_lib.c index 632e867c5766..99a833f29544 100644 --- a/sound/isa/es1688/es1688_lib.c +++ b/sound/isa/es1688/es1688_lib.c @@ -612,7 +612,7 @@ int snd_es1688_create(struct snd_card *card, int dma8, unsigned short hardware) { - static struct snd_device_ops ops = { + static const struct snd_device_ops ops = { .dev_free = snd_es1688_dev_free, }; diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index a581083b876b..f9cd05d2b3bd 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c @@ -1753,7 +1753,7 @@ static int snd_es18xx_new_device(struct snd_card *card, int irq, int dma1, int dma2) { struct snd_es18xx *chip = card->private_data; - static struct snd_device_ops ops = { + static const struct snd_device_ops ops = { .dev_free = snd_es18xx_dev_free, }; int err; diff --git a/sound/isa/gus/gus_main.c b/sound/isa/gus/gus_main.c index 9f94b5f3b029..e9fc333c0fcb 100644 --- a/sound/isa/gus/gus_main.c +++ b/sound/isa/gus/gus_main.c @@ -134,7 +134,7 @@ int snd_gus_create(struct snd_card *card, { struct snd_gus_card *gus; int err; - static struct snd_device_ops ops = { + static const struct snd_device_ops ops = { .dev_free = snd_gus_dev_free, }; diff --git a/sound/isa/msnd/msnd_pinnacle.c b/sound/isa/msnd/msnd_pinnacle.c index 9e7f03eec7e6..7fca418a64f8 100644 --- a/sound/isa/msnd/msnd_pinnacle.c +++ b/sound/isa/msnd/msnd_pinnacle.c @@ -528,7 +528,7 @@ static int snd_msnd_attach(struct snd_card *card) { struct snd_msnd *chip = card->private_data; int err; - static struct snd_device_ops ops = { + static const struct snd_device_ops ops = { .dev_free = snd_msnd_dev_free, }; diff --git a/sound/isa/sb/emu8000.c b/sound/isa/sb/emu8000.c index 433e32e254f9..bc47e8e51523 100644 --- a/sound/isa/sb/emu8000.c +++ b/sound/isa/sb/emu8000.c @@ -1075,7 +1075,7 @@ snd_emu8000_new(struct snd_card *card, int index, long port, int seq_ports, struct snd_seq_device *awe; struct snd_emu8000 *hw; int err; - static struct snd_device_ops ops = { + static const struct snd_device_ops ops = { .dev_free = snd_emu8000_dev_free, }; diff --git a/sound/isa/sb/sb_common.c b/sound/isa/sb/sb_common.c index 4aaf9ab82afe..61ea4078aa95 100644 --- a/sound/isa/sb/sb_common.c +++ b/sound/isa/sb/sb_common.c @@ -204,7 +204,7 @@ int snd_sbdsp_create(struct snd_card *card, { struct snd_sb *chip; int err; - static struct snd_device_ops ops = { + static const struct snd_device_ops ops = { .dev_free = snd_sbdsp_dev_free, }; diff --git a/sound/isa/wss/wss_lib.c b/sound/isa/wss/wss_lib.c index 100e8b547d27..b51b50154e8a 100644 --- a/sound/isa/wss/wss_lib.c +++ b/sound/isa/wss/wss_lib.c @@ -1772,7 +1772,7 @@ int snd_wss_create(struct snd_card *card, unsigned short hwshare, struct snd_wss **rchip) { - static struct snd_device_ops ops = { + static const struct snd_device_ops ops = { .dev_free = snd_wss_dev_free, }; struct snd_wss *chip; -- cgit From 5ff16a3d48ef58be8fd93035ae9272d4cc990c49 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 3 Jan 2020 09:16:37 +0100 Subject: ALSA: Constify snd_timer_hardware definitions Most of snd_timer_hardware definitions do simply copying to another struct as-is. Mark them as const for further optimization. There should be no functional changes by this patch. Link: https://lore.kernel.org/r/20200103081714.9560-22-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/gus/gus_timer.c | 4 ++-- sound/isa/wss/wss_lib.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/gus/gus_timer.c b/sound/isa/gus/gus_timer.c index 4e9664e434fe..047ddbc6192f 100644 --- a/sound/isa/gus/gus_timer.c +++ b/sound/isa/gus/gus_timer.c @@ -108,7 +108,7 @@ static void snd_gf1_interrupt_timer2(struct snd_gus_card * gus) */ -static struct snd_timer_hardware snd_gf1_timer1 = +static const struct snd_timer_hardware snd_gf1_timer1 = { .flags = SNDRV_TIMER_HW_STOP, .resolution = 80000, @@ -117,7 +117,7 @@ static struct snd_timer_hardware snd_gf1_timer1 = .stop = snd_gf1_timer1_stop, }; -static struct snd_timer_hardware snd_gf1_timer2 = +static const struct snd_timer_hardware snd_gf1_timer2 = { .flags = SNDRV_TIMER_HW_STOP, .resolution = 320000, diff --git a/sound/isa/wss/wss_lib.c b/sound/isa/wss/wss_lib.c index b51b50154e8a..0d019b238399 100644 --- a/sound/isa/wss/wss_lib.c +++ b/sound/isa/wss/wss_lib.c @@ -961,7 +961,7 @@ static int snd_wss_timer_close(struct snd_timer *timer) return 0; } -static struct snd_timer_hardware snd_wss_timer_table = +static const struct snd_timer_hardware snd_wss_timer_table = { .flags = SNDRV_TIMER_HW_AUTO, .resolution = 9945, -- cgit From d25ff26840bd0af3283d8e478669abc104bb873a Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 3 Jan 2020 09:16:44 +0100 Subject: ALSA: info: Make snd_info_entry_ops as const The reference to snd_info_entry_ops is rather read-only, so declare it as a const pointer. This allows a bit more optimization. There should be no functional changes by this patch. Link: https://lore.kernel.org/r/20200103081714.9560-29-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/gus/gus_mem_proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound/isa') diff --git a/sound/isa/gus/gus_mem_proc.c b/sound/isa/gus/gus_mem_proc.c index 54510e2d78c2..b5e1d1649500 100644 --- a/sound/isa/gus/gus_mem_proc.c +++ b/sound/isa/gus/gus_mem_proc.c @@ -37,7 +37,7 @@ static void snd_gf1_mem_proc_free(struct snd_info_entry *entry) kfree(priv); } -static struct snd_info_entry_ops snd_gf1_mem_proc_ops = { +static const struct snd_info_entry_ops snd_gf1_mem_proc_ops = { .read = snd_gf1_mem_proc_dump, }; -- cgit From fdd1f6fd328ff2e3723fe2a5c94378ef6f217edc Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 3 Jan 2020 09:16:51 +0100 Subject: ALSA: isa: Constify snd_kcontrol_new items Most of snd_kcontrol_new definitions are read-only and passed as-is. Let's declare them as const for further optimization. There should be no functional changes by this patch. Link: https://lore.kernel.org/r/20200103081714.9560-36-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/ad1816a/ad1816a_lib.c | 2 +- sound/isa/cmi8330.c | 2 +- sound/isa/cs423x/cs4236_lib.c | 14 +++++++------- sound/isa/es1688/es1688_lib.c | 2 +- sound/isa/es18xx.c | 26 +++++++++++++------------- sound/isa/gus/gus_mixer.c | 4 ++-- sound/isa/msnd/msnd_pinnacle_mixer.c | 2 +- sound/isa/opl3sa2.c | 4 ++-- sound/isa/opti9xx/miro.c | 14 +++++++------- sound/isa/opti9xx/opti92x-ad1848.c | 2 +- sound/isa/sb/emu8000.c | 14 +++++++------- sound/isa/sb/sb_mixer.c | 2 +- sound/isa/wss/wss_lib.c | 2 +- 13 files changed, 45 insertions(+), 45 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/ad1816a/ad1816a_lib.c b/sound/isa/ad1816a/ad1816a_lib.c index 560885fbc983..01381fe7c0c9 100644 --- a/sound/isa/ad1816a/ad1816a_lib.c +++ b/sound/isa/ad1816a/ad1816a_lib.c @@ -884,7 +884,7 @@ static const DECLARE_TLV_DB_SCALE(db_scale_6bit, -9450, 150, 0); static const DECLARE_TLV_DB_SCALE(db_scale_5bit_12db_max, -3450, 150, 0); static const DECLARE_TLV_DB_SCALE(db_scale_rec_gain, 0, 150, 0); -static struct snd_kcontrol_new snd_ad1816a_controls[] = { +static const struct snd_kcontrol_new snd_ad1816a_controls[] = { AD1816A_DOUBLE("Master Playback Switch", AD1816A_MASTER_ATT, 15, 7, 1, 1), AD1816A_DOUBLE_TLV("Master Playback Volume", AD1816A_MASTER_ATT, 8, 0, 31, 1, db_scale_5bit), diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c index f8ec59a5bb8f..61d6944a69c7 100644 --- a/sound/isa/cmi8330.c +++ b/sound/isa/cmi8330.c @@ -179,7 +179,7 @@ MODULE_DEVICE_TABLE(pnp_card, snd_cmi8330_pnpids); #endif -static struct snd_kcontrol_new snd_cmi8330_controls[] = { +static const struct snd_kcontrol_new snd_cmi8330_controls[] = { WSS_DOUBLE("Master Playback Volume", 0, CMI8330_MASTVOL, CMI8330_MASTVOL, 4, 0, 15, 0), WSS_SINGLE("Loud Playback Switch", 0, diff --git a/sound/isa/cs423x/cs4236_lib.c b/sound/isa/cs423x/cs4236_lib.c index be48c60355d0..ca6646f9b58d 100644 --- a/sound/isa/cs423x/cs4236_lib.c +++ b/sound/isa/cs423x/cs4236_lib.c @@ -758,7 +758,7 @@ static const DECLARE_TLV_DB_SCALE(db_scale_4bit, -4500, 300, 0); static const DECLARE_TLV_DB_SCALE(db_scale_2bit, -1800, 600, 0); static const DECLARE_TLV_DB_SCALE(db_scale_rec_gain, 0, 150, 0); -static struct snd_kcontrol_new snd_cs4236_controls[] = { +static const struct snd_kcontrol_new snd_cs4236_controls[] = { CS4236_DOUBLE("Master Digital Playback Switch", 0, CS4236_LEFT_MASTER, CS4236_RIGHT_MASTER, 7, 7, 1, 1), @@ -853,7 +853,7 @@ CS4236_DOUBLE1_TLV("Loopback Digital Playback Volume", 0, static const DECLARE_TLV_DB_SCALE(db_scale_5bit_6db_max, -5600, 200, 0); static const DECLARE_TLV_DB_SCALE(db_scale_2bit_16db_max, -2400, 800, 0); -static struct snd_kcontrol_new snd_cs4235_controls[] = { +static const struct snd_kcontrol_new snd_cs4235_controls[] = { WSS_DOUBLE("Master Playback Switch", 0, CS4235_LEFT_MASTER, CS4235_RIGHT_MASTER, 7, 7, 1, 1), @@ -986,7 +986,7 @@ static int snd_cs4236_put_iec958_switch(struct snd_kcontrol *kcontrol, struct sn return change; } -static struct snd_kcontrol_new snd_cs4236_iec958_controls[] = { +static const struct snd_kcontrol_new snd_cs4236_iec958_controls[] = { CS4236_IEC958_ENABLE("IEC958 Output Enable", 0), CS4236_SINGLEC("IEC958 Output Validity", 0, 4, 4, 1, 0), CS4236_SINGLEC("IEC958 Output User", 0, 4, 5, 1, 0), @@ -995,12 +995,12 @@ CS4236_SINGLEC("IEC958 Output Channel Status Low", 0, 5, 1, 127, 0), CS4236_SINGLEC("IEC958 Output Channel Status High", 0, 6, 0, 255, 0) }; -static struct snd_kcontrol_new snd_cs4236_3d_controls_cs4235[] = { +static const struct snd_kcontrol_new snd_cs4236_3d_controls_cs4235[] = { CS4236_SINGLEC("3D Control - Switch", 0, 3, 4, 1, 0), CS4236_SINGLEC("3D Control - Space", 0, 2, 4, 15, 1) }; -static struct snd_kcontrol_new snd_cs4236_3d_controls_cs4237[] = { +static const struct snd_kcontrol_new snd_cs4236_3d_controls_cs4237[] = { CS4236_SINGLEC("3D Control - Switch", 0, 3, 7, 1, 0), CS4236_SINGLEC("3D Control - Space", 0, 2, 4, 15, 1), CS4236_SINGLEC("3D Control - Center", 0, 2, 0, 15, 1), @@ -1008,7 +1008,7 @@ CS4236_SINGLEC("3D Control - Mono", 0, 3, 6, 1, 0), CS4236_SINGLEC("3D Control - IEC958", 0, 3, 5, 1, 0) }; -static struct snd_kcontrol_new snd_cs4236_3d_controls_cs4238[] = { +static const struct snd_kcontrol_new snd_cs4236_3d_controls_cs4238[] = { CS4236_SINGLEC("3D Control - Switch", 0, 3, 4, 1, 0), CS4236_SINGLEC("3D Control - Space", 0, 2, 4, 15, 1), CS4236_SINGLEC("3D Control - Volume", 0, 2, 0, 15, 1), @@ -1020,7 +1020,7 @@ int snd_cs4236_mixer(struct snd_wss *chip) struct snd_card *card; unsigned int idx, count; int err; - struct snd_kcontrol_new *kcontrol; + const struct snd_kcontrol_new *kcontrol; if (snd_BUG_ON(!chip || !chip->card)) return -EINVAL; diff --git a/sound/isa/es1688/es1688_lib.c b/sound/isa/es1688/es1688_lib.c index 99a833f29544..1568d0bfd1a8 100644 --- a/sound/isa/es1688/es1688_lib.c +++ b/sound/isa/es1688/es1688_lib.c @@ -924,7 +924,7 @@ static int snd_es1688_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_e return change; } -static struct snd_kcontrol_new snd_es1688_controls[] = { +static const struct snd_kcontrol_new snd_es1688_controls[] = { ES1688_DOUBLE("Master Playback Volume", 0, ES1688_MASTER_DEV, ES1688_MASTER_DEV, 4, 0, 15, 0), ES1688_DOUBLE("PCM Playback Volume", 0, ES1688_PCM_DEV, ES1688_PCM_DEV, 4, 0, 15, 0), ES1688_DOUBLE("Line Playback Volume", 0, ES1688_LINE_DEV, ES1688_LINE_DEV, 4, 0, 15, 0), diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index f9cd05d2b3bd..6ce5b5c76980 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c @@ -1246,7 +1246,7 @@ static int snd_es18xx_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_e * The controls that are universal to all chipsets are fully initialized * here. */ -static struct snd_kcontrol_new snd_es18xx_base_controls[] = { +static const struct snd_kcontrol_new snd_es18xx_base_controls[] = { ES18XX_DOUBLE("Master Playback Volume", 0, 0x60, 0x62, 0, 0, 63, 0), ES18XX_DOUBLE("Master Playback Switch", 0, 0x60, 0x62, 6, 6, 1, 1), ES18XX_DOUBLE("Line Playback Volume", 0, 0x3e, 0x3e, 4, 0, 15, 0), @@ -1265,7 +1265,7 @@ ES18XX_DOUBLE("Capture Volume", 0, 0xb4, 0xb4, 4, 0, 15, 0), } }; -static struct snd_kcontrol_new snd_es18xx_recmix_controls[] = { +static const struct snd_kcontrol_new snd_es18xx_recmix_controls[] = { ES18XX_DOUBLE("PCM Capture Volume", 0, 0x69, 0x69, 4, 0, 15, 0), ES18XX_DOUBLE("Mic Capture Volume", 0, 0x68, 0x68, 4, 0, 15, 0), ES18XX_DOUBLE("Line Capture Volume", 0, 0x6e, 0x6e, 4, 0, 15, 0), @@ -1277,35 +1277,35 @@ ES18XX_DOUBLE("Aux Capture Volume", 0, 0x6c, 0x6c, 4, 0, 15, 0) /* * The chipset specific mixer controls */ -static struct snd_kcontrol_new snd_es18xx_opt_speaker = +static const struct snd_kcontrol_new snd_es18xx_opt_speaker = ES18XX_SINGLE("Beep Playback Volume", 0, 0x3c, 0, 7, 0); -static struct snd_kcontrol_new snd_es18xx_opt_1869[] = { +static const struct snd_kcontrol_new snd_es18xx_opt_1869[] = { ES18XX_SINGLE("Capture Switch", 0, 0x1c, 4, 1, ES18XX_FL_INVERT), ES18XX_SINGLE("Video Playback Switch", 0, 0x7f, 0, 1, 0), ES18XX_DOUBLE("Mono Playback Volume", 0, 0x6d, 0x6d, 4, 0, 15, 0), ES18XX_DOUBLE("Mono Capture Volume", 0, 0x6f, 0x6f, 4, 0, 15, 0) }; -static struct snd_kcontrol_new snd_es18xx_opt_1878 = +static const struct snd_kcontrol_new snd_es18xx_opt_1878 = ES18XX_DOUBLE("Video Playback Volume", 0, 0x68, 0x68, 4, 0, 15, 0); -static struct snd_kcontrol_new snd_es18xx_opt_1879[] = { +static const struct snd_kcontrol_new snd_es18xx_opt_1879[] = { ES18XX_SINGLE("Video Playback Switch", 0, 0x71, 6, 1, 0), ES18XX_DOUBLE("Video Playback Volume", 0, 0x6d, 0x6d, 4, 0, 15, 0), ES18XX_DOUBLE("Video Capture Volume", 0, 0x6f, 0x6f, 4, 0, 15, 0) }; -static struct snd_kcontrol_new snd_es18xx_pcm1_controls[] = { +static const struct snd_kcontrol_new snd_es18xx_pcm1_controls[] = { ES18XX_DOUBLE("PCM Playback Volume", 0, 0x14, 0x14, 4, 0, 15, 0), }; -static struct snd_kcontrol_new snd_es18xx_pcm2_controls[] = { +static const struct snd_kcontrol_new snd_es18xx_pcm2_controls[] = { ES18XX_DOUBLE("PCM Playback Volume", 0, 0x7c, 0x7c, 4, 0, 15, 0), ES18XX_DOUBLE("PCM Playback Volume", 1, 0x14, 0x14, 4, 0, 15, 0) }; -static struct snd_kcontrol_new snd_es18xx_spatializer_controls[] = { +static const struct snd_kcontrol_new snd_es18xx_spatializer_controls[] = { ES18XX_SINGLE("3D Control - Level", 0, 0x52, 0, 63, 0), { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, @@ -1316,13 +1316,13 @@ ES18XX_SINGLE("3D Control - Level", 0, 0x52, 0, 63, 0), } }; -static struct snd_kcontrol_new snd_es18xx_micpre1_control = +static const struct snd_kcontrol_new snd_es18xx_micpre1_control = ES18XX_SINGLE("Mic Boost (+26dB)", 0, 0xa9, 2, 1, 0); -static struct snd_kcontrol_new snd_es18xx_micpre2_control = +static const struct snd_kcontrol_new snd_es18xx_micpre2_control = ES18XX_SINGLE("Mic Boost (+26dB)", 0, 0x7d, 3, 1, 0); -static struct snd_kcontrol_new snd_es18xx_hw_volume_controls[] = { +static const struct snd_kcontrol_new snd_es18xx_hw_volume_controls[] = { { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Hardware Master Playback Volume", @@ -1340,7 +1340,7 @@ static struct snd_kcontrol_new snd_es18xx_hw_volume_controls[] = { ES18XX_SINGLE("Hardware Master Volume Split", 0, 0x64, 7, 1, 0), }; -static struct snd_kcontrol_new snd_es18xx_opt_gpo_2bit[] = { +static const struct snd_kcontrol_new snd_es18xx_opt_gpo_2bit[] = { ES18XX_SINGLE("GPO0 Switch", 0, ES18XX_PM, 0, 1, ES18XX_FL_PMPORT), ES18XX_SINGLE("GPO1 Switch", 0, ES18XX_PM, 1, 1, ES18XX_FL_PMPORT), }; diff --git a/sound/isa/gus/gus_mixer.c b/sound/isa/gus/gus_mixer.c index 94e0c75ee417..201d0c40d0d9 100644 --- a/sound/isa/gus/gus_mixer.c +++ b/sound/isa/gus/gus_mixer.c @@ -120,13 +120,13 @@ static int snd_ics_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem return change; } -static struct snd_kcontrol_new snd_gf1_controls[] = { +static const struct snd_kcontrol_new snd_gf1_controls[] = { GF1_SINGLE("Master Playback Switch", 0, 1, 1), GF1_SINGLE("Line Switch", 0, 0, 1), GF1_SINGLE("Mic Switch", 0, 2, 0) }; -static struct snd_kcontrol_new snd_ics_controls[] = { +static const struct snd_kcontrol_new snd_ics_controls[] = { GF1_SINGLE("Master Playback Switch", 0, 1, 1), ICS_DOUBLE("Master Playback Volume", 0, SNDRV_ICS_MASTER_DEV), ICS_DOUBLE("Synth Playback Volume", 0, SNDRV_ICS_GF1_DEV), diff --git a/sound/isa/msnd/msnd_pinnacle_mixer.c b/sound/isa/msnd/msnd_pinnacle_mixer.c index d0770e2aedca..02c566fca9e5 100644 --- a/sound/isa/msnd/msnd_pinnacle_mixer.c +++ b/sound/isa/msnd/msnd_pinnacle_mixer.c @@ -275,7 +275,7 @@ static int snd_msndmix_volume_put(struct snd_kcontrol *kcontrol, .private_value = addr } -static struct snd_kcontrol_new snd_msnd_controls[] = { +static const struct snd_kcontrol_new snd_msnd_controls[] = { DUMMY_VOLUME("Master Volume", 0, MSND_MIXER_VOLUME), DUMMY_VOLUME("PCM Volume", 0, MSND_MIXER_PCM), DUMMY_VOLUME("Aux Volume", 0, MSND_MIXER_AUX), diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index 6d19ab458291..85a181acd388 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c @@ -457,7 +457,7 @@ static int snd_opl3sa2_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_ static const DECLARE_TLV_DB_SCALE(db_scale_master, -3000, 200, 0); static const DECLARE_TLV_DB_SCALE(db_scale_5bit_12db_max, -3450, 150, 0); -static struct snd_kcontrol_new snd_opl3sa2_controls[] = { +static const struct snd_kcontrol_new snd_opl3sa2_controls[] = { OPL3SA2_DOUBLE("Master Playback Switch", 0, 0x07, 0x08, 7, 7, 1, 1), OPL3SA2_DOUBLE_TLV("Master Playback Volume", 0, 0x07, 0x08, 0, 0, 15, 1, db_scale_master), @@ -467,7 +467,7 @@ OPL3SA2_SINGLE_TLV("Mic Playback Volume", 0, 0x09, 0, 31, 1, OPL3SA2_SINGLE("ZV Port Switch", 0, 0x02, 0, 1, 0), }; -static struct snd_kcontrol_new snd_opl3sa2_tone_controls[] = { +static const struct snd_kcontrol_new snd_opl3sa2_tone_controls[] = { OPL3SA2_DOUBLE("3D Control - Wide", 0, 0x14, 0x14, 4, 0, 7, 0), OPL3SA2_DOUBLE("Tone Control - Bass", 0, 0x15, 0x15, 4, 0, 7, 0), OPL3SA2_DOUBLE("Tone Control - Treble", 0, 0x16, 0x16, 4, 0, 7, 0) diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c index 0458934de1c7..a9c773b9f471 100644 --- a/sound/isa/opti9xx/miro.c +++ b/sound/isa/opti9xx/miro.c @@ -577,7 +577,7 @@ static int snd_miro_put_double(struct snd_kcontrol *kcontrol, return change; } -static struct snd_kcontrol_new snd_miro_controls[] = { +static const struct snd_kcontrol_new snd_miro_controls[] = { MIRO_DOUBLE("Master Playback Volume", 0, ACI_GET_MASTER, ACI_SET_MASTER), MIRO_DOUBLE("Mic Playback Volume", 1, ACI_GET_MIC, ACI_SET_MIC), MIRO_DOUBLE("Line Playback Volume", 1, ACI_GET_LINE, ACI_SET_LINE), @@ -589,7 +589,7 @@ MIRO_DOUBLE("Aux Playback Volume", 2, ACI_GET_LINE2, ACI_SET_LINE2), /* Equalizer with seven bands (only PCM20) from -12dB up to +12dB on each band */ -static struct snd_kcontrol_new snd_miro_eq_controls[] = { +static const struct snd_kcontrol_new snd_miro_eq_controls[] = { MIRO_DOUBLE("Tone Control - 28 Hz", 0, ACI_GET_EQ1, ACI_SET_EQ1), MIRO_DOUBLE("Tone Control - 160 Hz", 0, ACI_GET_EQ2, ACI_SET_EQ2), MIRO_DOUBLE("Tone Control - 400 Hz", 0, ACI_GET_EQ3, ACI_SET_EQ3), @@ -599,15 +599,15 @@ MIRO_DOUBLE("Tone Control - 6.3 kHz", 0, ACI_GET_EQ6, ACI_SET_EQ6), MIRO_DOUBLE("Tone Control - 16 kHz", 0, ACI_GET_EQ7, ACI_SET_EQ7), }; -static struct snd_kcontrol_new snd_miro_radio_control[] = { +static const struct snd_kcontrol_new snd_miro_radio_control[] = { MIRO_DOUBLE("Radio Playback Volume", 0, ACI_GET_LINE1, ACI_SET_LINE1), }; -static struct snd_kcontrol_new snd_miro_line_control[] = { +static const struct snd_kcontrol_new snd_miro_line_control[] = { MIRO_DOUBLE("Line Playback Volume", 2, ACI_GET_LINE1, ACI_SET_LINE1), }; -static struct snd_kcontrol_new snd_miro_preamp_control[] = { +static const struct snd_kcontrol_new snd_miro_preamp_control[] = { { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Mic Boost", @@ -617,7 +617,7 @@ static struct snd_kcontrol_new snd_miro_preamp_control[] = { .put = snd_miro_put_preamp, }}; -static struct snd_kcontrol_new snd_miro_amp_control[] = { +static const struct snd_kcontrol_new snd_miro_amp_control[] = { { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Line Boost", @@ -627,7 +627,7 @@ static struct snd_kcontrol_new snd_miro_amp_control[] = { .put = snd_miro_put_amp, }}; -static struct snd_kcontrol_new snd_miro_capture_control[] = { +static const struct snd_kcontrol_new snd_miro_capture_control[] = { { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "PCM Capture Switch", diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index b40ab806c349..697576459f71 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c @@ -550,7 +550,7 @@ static const DECLARE_TLV_DB_SCALE(db_scale_5bit_3db_step, -9300, 300, 0); static const DECLARE_TLV_DB_SCALE(db_scale_5bit, -4650, 150, 0); static const DECLARE_TLV_DB_SCALE(db_scale_4bit_12db_max, -3300, 300, 0); -static struct snd_kcontrol_new snd_opti93x_controls[] = { +static const struct snd_kcontrol_new snd_opti93x_controls[] = { WSS_DOUBLE("Master Playback Switch", 0, OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 7, 7, 1, 1), WSS_DOUBLE_TLV("Master Playback Volume", 0, diff --git a/sound/isa/sb/emu8000.c b/sound/isa/sb/emu8000.c index bc47e8e51523..455dd5fa3ccb 100644 --- a/sound/isa/sb/emu8000.c +++ b/sound/isa/sb/emu8000.c @@ -855,7 +855,7 @@ static int mixer_bass_treble_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e return change; } -static struct snd_kcontrol_new mixer_bass_control = +static const struct snd_kcontrol_new mixer_bass_control = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Synth Tone Control - Bass", @@ -865,7 +865,7 @@ static struct snd_kcontrol_new mixer_bass_control = .private_value = 0, }; -static struct snd_kcontrol_new mixer_treble_control = +static const struct snd_kcontrol_new mixer_treble_control = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Synth Tone Control - Treble", @@ -922,7 +922,7 @@ static int mixer_chorus_reverb_put(struct snd_kcontrol *kcontrol, struct snd_ctl return change; } -static struct snd_kcontrol_new mixer_chorus_mode_control = +static const struct snd_kcontrol_new mixer_chorus_mode_control = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Chorus Mode", @@ -932,7 +932,7 @@ static struct snd_kcontrol_new mixer_chorus_mode_control = .private_value = 1, }; -static struct snd_kcontrol_new mixer_reverb_mode_control = +static const struct snd_kcontrol_new mixer_reverb_mode_control = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Reverb Mode", @@ -984,7 +984,7 @@ static int mixer_fm_depth_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem return change; } -static struct snd_kcontrol_new mixer_fm_chorus_depth_control = +static const struct snd_kcontrol_new mixer_fm_chorus_depth_control = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "FM Chorus Depth", @@ -994,7 +994,7 @@ static struct snd_kcontrol_new mixer_fm_chorus_depth_control = .private_value = 1, }; -static struct snd_kcontrol_new mixer_fm_reverb_depth_control = +static const struct snd_kcontrol_new mixer_fm_reverb_depth_control = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "FM Reverb Depth", @@ -1005,7 +1005,7 @@ static struct snd_kcontrol_new mixer_fm_reverb_depth_control = }; -static struct snd_kcontrol_new *mixer_defs[EMU8000_NUM_CONTROLS] = { +static const struct snd_kcontrol_new *mixer_defs[EMU8000_NUM_CONTROLS] = { &mixer_bass_control, &mixer_treble_control, &mixer_chorus_mode_control, diff --git a/sound/isa/sb/sb_mixer.c b/sound/isa/sb/sb_mixer.c index bd65ef0412a6..789dcf279a26 100644 --- a/sound/isa/sb/sb_mixer.c +++ b/sound/isa/sb/sb_mixer.c @@ -438,7 +438,7 @@ static int snd_sb16mixer_put_input_sw(struct snd_kcontrol *kcontrol, struct snd_ */ int snd_sbmixer_add_ctl(struct snd_sb *chip, const char *name, int index, int type, unsigned long value) { - static struct snd_kcontrol_new newctls[] = { + static const struct snd_kcontrol_new newctls[] = { [SB_MIX_SINGLE] = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .info = snd_sbmixer_info_single, diff --git a/sound/isa/wss/wss_lib.c b/sound/isa/wss/wss_lib.c index 0d019b238399..d37f4642162a 100644 --- a/sound/isa/wss/wss_lib.c +++ b/sound/isa/wss/wss_lib.c @@ -2157,7 +2157,7 @@ static const DECLARE_TLV_DB_SCALE(db_scale_5bit_12db_max, -3450, 150, 0); static const DECLARE_TLV_DB_SCALE(db_scale_rec_gain, 0, 150, 0); static const DECLARE_TLV_DB_SCALE(db_scale_4bit, -4500, 300, 0); -static struct snd_kcontrol_new snd_wss_controls[] = { +static const struct snd_kcontrol_new snd_wss_controls[] = { WSS_DOUBLE("PCM Playback Switch", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), WSS_DOUBLE_TLV("PCM Playback Volume", 0, -- cgit From f3c0916946706f6aa8e9041f41378d9c26ba57d6 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Sun, 5 Jan 2020 15:47:58 +0100 Subject: ALSA: cmi8328: More constifications Apply const prefix to the static resource tables. Just for minor optimization and no functional changes. Link: https://lore.kernel.org/r/20200105144823.29547-44-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/cmi8328.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/cmi8328.c b/sound/isa/cmi8328.c index 250db35109a2..faca5dd95bfe 100644 --- a/sound/isa/cmi8328.c +++ b/sound/isa/cmi8328.c @@ -32,7 +32,7 @@ MODULE_LICENSE("GPL"); #endif /* I/O port is configured by jumpers on the card to one of these */ -static int cmi8328_ports[] = { 0x530, 0xe80, 0xf40, 0x604 }; +static const int cmi8328_ports[] = { 0x530, 0xe80, 0xf40, 0x604 }; #define CMI8328_MAX ARRAY_SIZE(cmi8328_ports) static int index[CMI8328_MAX] = {[0 ... (CMI8328_MAX-1)] = -1}; @@ -193,7 +193,7 @@ static int snd_cmi8328_mixer(struct snd_wss *chip) } /* find index of an item in "-1"-ended array */ -static int array_find(int array[], int item) +static int array_find(const int array[], int item) { int i; @@ -204,7 +204,7 @@ static int array_find(int array[], int item) return -1; } /* the same for long */ -static int array_find_l(long array[], long item) +static int array_find_l(const long array[], long item) { int i; @@ -224,16 +224,16 @@ static int snd_cmi8328_probe(struct device *pdev, unsigned int ndev) struct resource *res; #endif int err, pos; - static long mpu_ports[] = { 0x330, 0x300, 0x310, 0x320, 0x332, 0x334, + static const long mpu_ports[] = { 0x330, 0x300, 0x310, 0x320, 0x332, 0x334, 0x336, -1 }; - static u8 mpu_port_bits[] = { 3, 0, 1, 2, 4, 5, 6 }; - static int mpu_irqs[] = { 9, 7, 5, 3, -1 }; - static u8 mpu_irq_bits[] = { 3, 2, 1, 0 }; - static int irqs[] = { 9, 10, 11, 7, -1 }; - static u8 irq_bits[] = { 2, 3, 4, 1 }; - static int dma1s[] = { 3, 1, 0, -1 }; - static u8 dma_bits[] = { 3, 2, 1 }; - static int dma2s[][2] = { {1, -1}, {0, -1}, {-1, -1}, {0, -1} }; + static const u8 mpu_port_bits[] = { 3, 0, 1, 2, 4, 5, 6 }; + static const int mpu_irqs[] = { 9, 7, 5, 3, -1 }; + static const u8 mpu_irq_bits[] = { 3, 2, 1, 0 }; + static const int irqs[] = { 9, 10, 11, 7, -1 }; + static const u8 irq_bits[] = { 2, 3, 4, 1 }; + static const int dma1s[] = { 3, 1, 0, -1 }; + static const u8 dma_bits[] = { 3, 2, 1 }; + static const int dma2s[][2] = { {1, -1}, {0, -1}, {-1, -1}, {0, -1} }; u16 port = cmi8328_ports[ndev]; u8 val; -- cgit From 58b5b363702de28e95541efeeb04626a0f2b43c4 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Sun, 5 Jan 2020 15:47:59 +0100 Subject: ALSA: cs423x: More constification Apply const prefix to the static mapping table. Just for minor optimization and no functional changes. Link: https://lore.kernel.org/r/20200105144823.29547-45-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/cs423x/cs4236_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound/isa') diff --git a/sound/isa/cs423x/cs4236_lib.c b/sound/isa/cs423x/cs4236_lib.c index ca6646f9b58d..4a028f42bb74 100644 --- a/sound/isa/cs423x/cs4236_lib.c +++ b/sound/isa/cs423x/cs4236_lib.c @@ -80,7 +80,7 @@ * */ -static unsigned char snd_cs4236_ext_map[18] = { +static const unsigned char snd_cs4236_ext_map[18] = { /* CS4236_LEFT_LINE */ 0xff, /* CS4236_RIGHT_LINE */ 0xff, /* CS4236_LEFT_MIC */ 0xdf, -- cgit From 2a076d0af49875d2806ff300b632ebc6a43720ee Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Sun, 5 Jan 2020 15:48:00 +0100 Subject: ALSA: sb: More constifications Apply const prefix to each possible place: the static tables for the resources, controls, registers, values and parameters. Just for minor optimization and no functional changes. Link: https://lore.kernel.org/r/20200105144823.29547-46-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/sb/emu8000.c | 16 ++++++++-------- sound/isa/sb/jazz16.c | 10 +++++----- sound/isa/sb/sb16.c | 8 ++++---- sound/isa/sb/sb8.c | 2 +- sound/isa/sb/sb_mixer.c | 38 +++++++++++++++++++------------------- 5 files changed, 37 insertions(+), 37 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/sb/emu8000.c b/sound/isa/sb/emu8000.c index 455dd5fa3ccb..0aa545ac6e60 100644 --- a/sound/isa/sb/emu8000.c +++ b/sound/isa/sb/emu8000.c @@ -222,7 +222,7 @@ init_dma(struct snd_emu8000 *emu) /* * initialization arrays; from ADIP */ -static unsigned short init1[128] = { +static const unsigned short init1[128] = { 0x03ff, 0x0030, 0x07ff, 0x0130, 0x0bff, 0x0230, 0x0fff, 0x0330, 0x13ff, 0x0430, 0x17ff, 0x0530, 0x1bff, 0x0630, 0x1fff, 0x0730, 0x23ff, 0x0830, 0x27ff, 0x0930, 0x2bff, 0x0a30, 0x2fff, 0x0b30, @@ -244,7 +244,7 @@ static unsigned short init1[128] = { 0xf3ff, 0x0c30, 0xf7ff, 0x0d30, 0xfbff, 0x0e30, 0xffff, 0x0f30, }; -static unsigned short init2[128] = { +static const unsigned short init2[128] = { 0x03ff, 0x8030, 0x07ff, 0x8130, 0x0bff, 0x8230, 0x0fff, 0x8330, 0x13ff, 0x8430, 0x17ff, 0x8530, 0x1bff, 0x8630, 0x1fff, 0x8730, 0x23ff, 0x8830, 0x27ff, 0x8930, 0x2bff, 0x8a30, 0x2fff, 0x8b30, @@ -266,7 +266,7 @@ static unsigned short init2[128] = { 0xf3ff, 0x8c30, 0xf7ff, 0x8d30, 0xfbff, 0x8e30, 0xffff, 0x8f30, }; -static unsigned short init3[128] = { +static const unsigned short init3[128] = { 0x0C10, 0x8470, 0x14FE, 0xB488, 0x167F, 0xA470, 0x18E7, 0x84B5, 0x1B6E, 0x842A, 0x1F1D, 0x852A, 0x0DA3, 0x8F7C, 0x167E, 0xF254, 0x0000, 0x842A, 0x0001, 0x852A, 0x18E6, 0x8BAA, 0x1B6D, 0xF234, @@ -288,7 +288,7 @@ static unsigned short init3[128] = { 0x1342, 0xD36E, 0x3EC7, 0xB3FF, 0x0000, 0x8365, 0x1420, 0x9570, }; -static unsigned short init4[128] = { +static const unsigned short init4[128] = { 0x0C10, 0x8470, 0x14FE, 0xB488, 0x167F, 0xA470, 0x18E7, 0x84B5, 0x1B6E, 0x842A, 0x1F1D, 0x852A, 0x0DA3, 0x0F7C, 0x167E, 0x7254, 0x0000, 0x842A, 0x0001, 0x852A, 0x18E6, 0x0BAA, 0x1B6D, 0x7234, @@ -315,10 +315,10 @@ static unsigned short init4[128] = { * is meant to work */ static void -send_array(struct snd_emu8000 *emu, unsigned short *data, int size) +send_array(struct snd_emu8000 *emu, const unsigned short *data, int size) { int i; - unsigned short *p; + const unsigned short *p; p = data; for (i = 0; i < size; i++, p++) @@ -548,7 +548,7 @@ snd_emu8000_init_hw(struct snd_emu8000 *emu) * Bass/Treble Equalizer *----------------------------------------------------------------*/ -static unsigned short bass_parm[12][3] = { +static const unsigned short bass_parm[12][3] = { {0xD26A, 0xD36A, 0x0000}, /* -12 dB */ {0xD25B, 0xD35B, 0x0000}, /* -8 */ {0xD24C, 0xD34C, 0x0000}, /* -6 */ @@ -563,7 +563,7 @@ static unsigned short bass_parm[12][3] = { {0xC26A, 0xC36A, 0x0002}, /* +12 dB */ }; -static unsigned short treble_parm[12][9] = { +static const unsigned short treble_parm[12][9] = { {0x821E, 0xC26A, 0x031E, 0xC36A, 0x021E, 0xD208, 0x831E, 0xD308, 0x0001}, /* -12 dB */ {0x821E, 0xC25B, 0x031E, 0xC35B, 0x021E, 0xD208, 0x831E, 0xD308, 0x0001}, {0x821E, 0xC24C, 0x031E, 0xC34C, 0x021E, 0xD208, 0x831E, 0xD308, 0x0001}, diff --git a/sound/isa/sb/jazz16.c b/sound/isa/sb/jazz16.c index 7a313ff589c7..ee379bbf70a4 100644 --- a/sound/isa/sb/jazz16.c +++ b/sound/isa/sb/jazz16.c @@ -158,9 +158,9 @@ err_unmap: static int jazz16_configure_board(struct snd_sb *chip, int mpu_irq) { - static unsigned char jazz_irq_bits[] = { 0, 0, 2, 3, 0, 1, 0, 4, + static const unsigned char jazz_irq_bits[] = { 0, 0, 2, 3, 0, 1, 0, 4, 0, 2, 5, 0, 0, 0, 0, 6 }; - static unsigned char jazz_dma_bits[] = { 0, 1, 0, 2, 0, 3, 0, 4 }; + static const unsigned char jazz_dma_bits[] = { 0, 1, 0, 2, 0, 3, 0, 4 }; if (jazz_dma_bits[chip->dma8] == 0 || jazz_dma_bits[chip->dma16] == 0 || @@ -224,9 +224,9 @@ static int snd_jazz16_probe(struct device *devptr, unsigned int dev) struct snd_card_jazz16 *jazz16; struct snd_sb *chip; struct snd_opl3 *opl3; - static int possible_irqs[] = {2, 3, 5, 7, 9, 10, 15, -1}; - static int possible_dmas8[] = {1, 3, -1}; - static int possible_dmas16[] = {5, 7, -1}; + static const int possible_irqs[] = {2, 3, 5, 7, 9, 10, 15, -1}; + static const int possible_dmas8[] = {1, 3, -1}; + static const int possible_dmas16[] = {5, 7, -1}; int err, xirq, xdma8, xdma16, xmpu_port, xmpu_irq; err = snd_card_new(devptr, index[dev], id[dev], THIS_MODULE, diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c index b528238675fe..479197c13803 100644 --- a/sound/isa/sb/sb16.c +++ b/sound/isa/sb/sb16.c @@ -509,9 +509,9 @@ static int snd_sb16_isa_match(struct device *pdev, unsigned int dev) static int snd_sb16_isa_probe(struct device *pdev, unsigned int dev) { int err; - static int possible_irqs[] = {5, 9, 10, 7, -1}; - static int possible_dmas8[] = {1, 3, 0, -1}; - static int possible_dmas16[] = {5, 6, 7, -1}; + static const int possible_irqs[] = {5, 9, 10, 7, -1}; + static const int possible_dmas8[] = {1, 3, 0, -1}; + static const int possible_dmas16[] = {5, 6, 7, -1}; if (irq[dev] == SNDRV_AUTO_IRQ) { if ((irq[dev] = snd_legacy_find_free_irq(possible_irqs)) < 0) { @@ -535,7 +535,7 @@ static int snd_sb16_isa_probe(struct device *pdev, unsigned int dev) if (port[dev] != SNDRV_AUTO_PORT) return snd_sb16_isa_probe1(dev, pdev); else { - static int possible_ports[] = {0x220, 0x240, 0x260, 0x280}; + static const int possible_ports[] = {0x220, 0x240, 0x260, 0x280}; int i; for (i = 0; i < ARRAY_SIZE(possible_ports); i++) { port[dev] = possible_ports[i]; diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c index d67eae3988bd..438109f167d6 100644 --- a/sound/isa/sb/sb8.c +++ b/sound/isa/sb/sb8.c @@ -111,7 +111,7 @@ static int snd_sb8_probe(struct device *pdev, unsigned int dev) goto _err; } else { /* auto-probe legacy ports */ - static unsigned long possible_ports[] = { + static const unsigned long possible_ports[] = { 0x220, 0x240, 0x260, }; int i; diff --git a/sound/isa/sb/sb_mixer.c b/sound/isa/sb/sb_mixer.c index 789dcf279a26..3f703b4a304d 100644 --- a/sound/isa/sb/sb_mixer.c +++ b/sound/isa/sb/sb_mixer.c @@ -494,14 +494,14 @@ int snd_sbmixer_add_ctl(struct snd_sb *chip, const char *name, int index, int ty * SB 2.0 specific mixer elements */ -static struct sbmix_elem snd_sb20_controls[] = { +static const struct sbmix_elem snd_sb20_controls[] = { SB_SINGLE("Master Playback Volume", SB_DSP20_MASTER_DEV, 1, 7), SB_SINGLE("PCM Playback Volume", SB_DSP20_PCM_DEV, 1, 3), SB_SINGLE("Synth Playback Volume", SB_DSP20_FM_DEV, 1, 7), SB_SINGLE("CD Playback Volume", SB_DSP20_CD_DEV, 1, 7) }; -static unsigned char snd_sb20_init_values[][2] = { +static const unsigned char snd_sb20_init_values[][2] = { { SB_DSP20_MASTER_DEV, 0 }, { SB_DSP20_FM_DEV, 0 }, }; @@ -509,7 +509,7 @@ static unsigned char snd_sb20_init_values[][2] = { /* * SB Pro specific mixer elements */ -static struct sbmix_elem snd_sbpro_controls[] = { +static const struct sbmix_elem snd_sbpro_controls[] = { SB_DOUBLE("Master Playback Volume", SB_DSP_MASTER_DEV, SB_DSP_MASTER_DEV, 5, 1, 7), SB_DOUBLE("PCM Playback Volume", @@ -529,7 +529,7 @@ static struct sbmix_elem snd_sbpro_controls[] = { SB_SINGLE("Capture Low-Pass Filter", SB_DSP_CAPTURE_FILT, 3, 1) }; -static unsigned char snd_sbpro_init_values[][2] = { +static const unsigned char snd_sbpro_init_values[][2] = { { SB_DSP_MASTER_DEV, 0 }, { SB_DSP_PCM_DEV, 0 }, { SB_DSP_FM_DEV, 0 }, @@ -538,7 +538,7 @@ static unsigned char snd_sbpro_init_values[][2] = { /* * SB16 specific mixer elements */ -static struct sbmix_elem snd_sb16_controls[] = { +static const struct sbmix_elem snd_sb16_controls[] = { SB_DOUBLE("Master Playback Volume", SB_DSP4_MASTER_DEV, (SB_DSP4_MASTER_DEV + 1), 3, 3, 31), SB_DOUBLE("PCM Playback Volume", @@ -576,7 +576,7 @@ static struct sbmix_elem snd_sb16_controls[] = { SB_DSP4_TREBLE_DEV, (SB_DSP4_TREBLE_DEV + 1), 4, 4, 15) }; -static unsigned char snd_sb16_init_values[][2] = { +static const unsigned char snd_sb16_init_values[][2] = { { SB_DSP4_MASTER_DEV + 0, 0 }, { SB_DSP4_MASTER_DEV + 1, 0 }, { SB_DSP4_PCM_DEV + 0, 0 }, @@ -592,7 +592,7 @@ static unsigned char snd_sb16_init_values[][2] = { /* * DT019x specific mixer elements */ -static struct sbmix_elem snd_dt019x_controls[] = { +static const struct sbmix_elem snd_dt019x_controls[] = { /* ALS4000 below has some parts which we might be lacking, * e.g. snd_als4000_ctl_mono_playback_switch - check it! */ SB_DOUBLE("Master Playback Volume", @@ -622,7 +622,7 @@ static struct sbmix_elem snd_dt019x_controls[] = { } }; -static unsigned char snd_dt019x_init_values[][2] = { +static const unsigned char snd_dt019x_init_values[][2] = { { SB_DT019X_MASTER_DEV, 0 }, { SB_DT019X_PCM_DEV, 0 }, { SB_DT019X_SYNTH_DEV, 0 }, @@ -637,7 +637,7 @@ static unsigned char snd_dt019x_init_values[][2] = { /* * ALS4000 specific mixer elements */ -static struct sbmix_elem snd_als4000_controls[] = { +static const struct sbmix_elem snd_als4000_controls[] = { SB_DOUBLE("PCM Playback Switch", SB_DT019X_OUTPUT_SW2, SB_DT019X_OUTPUT_SW2, 2, 1, 1), SB_DOUBLE("Synth Playback Switch", @@ -671,7 +671,7 @@ static struct sbmix_elem snd_als4000_controls[] = { #endif }; -static unsigned char snd_als4000_init_values[][2] = { +static const unsigned char snd_als4000_init_values[][2] = { { SB_DSP4_MASTER_DEV + 0, 0 }, { SB_DSP4_MASTER_DEV + 1, 0 }, { SB_DSP4_PCM_DEV + 0, 0 }, @@ -689,9 +689,9 @@ static unsigned char snd_als4000_init_values[][2] = { /* */ static int snd_sbmixer_init(struct snd_sb *chip, - struct sbmix_elem *controls, + const struct sbmix_elem *controls, int controls_count, - unsigned char map[][2], + const unsigned char map[][2], int map_count, char *name) { @@ -800,14 +800,14 @@ int snd_sbmixer_new(struct snd_sb *chip) } #ifdef CONFIG_PM -static unsigned char sb20_saved_regs[] = { +static const unsigned char sb20_saved_regs[] = { SB_DSP20_MASTER_DEV, SB_DSP20_PCM_DEV, SB_DSP20_FM_DEV, SB_DSP20_CD_DEV, }; -static unsigned char sbpro_saved_regs[] = { +static const unsigned char sbpro_saved_regs[] = { SB_DSP_MASTER_DEV, SB_DSP_PCM_DEV, SB_DSP_PLAYBACK_FILT, @@ -819,7 +819,7 @@ static unsigned char sbpro_saved_regs[] = { SB_DSP_CAPTURE_FILT, }; -static unsigned char sb16_saved_regs[] = { +static const unsigned char sb16_saved_regs[] = { SB_DSP4_MASTER_DEV, SB_DSP4_MASTER_DEV + 1, SB_DSP4_3DSE, SB_DSP4_BASS_DEV, SB_DSP4_BASS_DEV + 1, @@ -837,7 +837,7 @@ static unsigned char sb16_saved_regs[] = { SB_DSP4_MIC_AGC }; -static unsigned char dt019x_saved_regs[] = { +static const unsigned char dt019x_saved_regs[] = { SB_DT019X_MASTER_DEV, SB_DT019X_PCM_DEV, SB_DT019X_SYNTH_DEV, @@ -850,7 +850,7 @@ static unsigned char dt019x_saved_regs[] = { SB_DT019X_CAPTURE_SW, }; -static unsigned char als4000_saved_regs[] = { +static const unsigned char als4000_saved_regs[] = { /* please verify in dsheet whether regs to be added are actually real H/W or just dummy */ SB_DSP4_MASTER_DEV, SB_DSP4_MASTER_DEV + 1, @@ -872,7 +872,7 @@ static unsigned char als4000_saved_regs[] = { SB_ALS4000_CR3_CONFIGURATION, }; -static void save_mixer(struct snd_sb *chip, unsigned char *regs, int num_regs) +static void save_mixer(struct snd_sb *chip, const unsigned char *regs, int num_regs) { unsigned char *val = chip->saved_regs; if (snd_BUG_ON(num_regs > ARRAY_SIZE(chip->saved_regs))) @@ -881,7 +881,7 @@ static void save_mixer(struct snd_sb *chip, unsigned char *regs, int num_regs) *val++ = snd_sbmixer_read(chip, *regs++); } -static void restore_mixer(struct snd_sb *chip, unsigned char *regs, int num_regs) +static void restore_mixer(struct snd_sb *chip, const unsigned char *regs, int num_regs) { unsigned char *val = chip->saved_regs; if (snd_BUG_ON(num_regs > ARRAY_SIZE(chip->saved_regs))) -- cgit From 350f613f37e63ca0162e6ea42df4c1f9c5cc49db Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Sun, 5 Jan 2020 15:48:01 +0100 Subject: ALSA: cmi8330: More constifications Apply const prefix to the static tables for the register, controls and callbacks. Just for minor optimization and no functional changes. Link: https://lore.kernel.org/r/20200105144823.29547-47-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/cmi8330.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c index 61d6944a69c7..4669eb0cc8ce 100644 --- a/sound/isa/cmi8330.c +++ b/sound/isa/cmi8330.c @@ -120,7 +120,7 @@ static int pnp_registered; #define CMI8330_LINGAIN 25 #define CMI8330_CDINGAIN 26 -static unsigned char snd_cmi8330_image[((CMI8330_CDINGAIN)-16) + 1] = +static const unsigned char snd_cmi8330_image[((CMI8330_CDINGAIN)-16) + 1] = { 0x40, /* 16 - recording mux (SB-mixer-enabled) */ #ifdef ENABLE_SB_MIXER @@ -235,7 +235,7 @@ WSS_SINGLE(SNDRV_CTL_NAME_IEC958("Input ", PLAYBACK, SWITCH), 0, }; #ifdef ENABLE_SB_MIXER -static struct sbmix_elem cmi8330_sb_mixers[] = { +static const struct sbmix_elem cmi8330_sb_mixers[] = { SB_DOUBLE("SB Master Playback Volume", SB_DSP4_MASTER_DEV, (SB_DSP4_MASTER_DEV + 1), 3, 3, 31), SB_DOUBLE("Tone Control - Bass", SB_DSP4_BASS_DEV, (SB_DSP4_BASS_DEV + 1), 4, 4, 15), SB_DOUBLE("Tone Control - Treble", SB_DSP4_TREBLE_DEV, (SB_DSP4_TREBLE_DEV + 1), 4, 4, 15), @@ -253,7 +253,7 @@ SB_DOUBLE("SB Playback Volume", SB_DSP4_OGAIN_DEV, (SB_DSP4_OGAIN_DEV + 1), 6, 6 SB_SINGLE("SB Mic Auto Gain", SB_DSP4_MIC_AGC, 0, 1), }; -static unsigned char cmi8330_sb_init_values[][2] = { +static const unsigned char cmi8330_sb_init_values[][2] = { { SB_DSP4_MASTER_DEV + 0, 0 }, { SB_DSP4_MASTER_DEV + 1, 0 }, { SB_DSP4_PCM_DEV + 0, 0 }, @@ -428,7 +428,7 @@ static int snd_cmi8330_pcm(struct snd_card *card, struct snd_cmi8330 *chip) struct snd_pcm *pcm; const struct snd_pcm_ops *ops; int err; - static snd_pcm_open_callback_t cmi_open_callbacks[2] = { + static const snd_pcm_open_callback_t cmi_open_callbacks[2] = { snd_cmi8330_playback_open, snd_cmi8330_capture_open }; -- cgit From 748f51812182788703c3bf664282a41e70ae3386 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Sun, 5 Jan 2020 15:48:02 +0100 Subject: ALSA: es1688: More constifications Apply const prefix to the static resource tables and init tables. Just for minor optimization and no functional changes. Link: https://lore.kernel.org/r/20200105144823.29547-48-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/es1688/es1688.c | 6 +++--- sound/isa/es1688/es1688_lib.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/es1688/es1688.c b/sound/isa/es1688/es1688.c index 9be89377171b..ff3a05ad99c0 100644 --- a/sound/isa/es1688/es1688.c +++ b/sound/isa/es1688/es1688.c @@ -84,9 +84,9 @@ static int snd_es1688_legacy_create(struct snd_card *card, struct device *dev, unsigned int n) { struct snd_es1688 *chip = card->private_data; - static long possible_ports[] = {0x220, 0x240, 0x260}; - static int possible_irqs[] = {5, 9, 10, 7, -1}; - static int possible_dmas[] = {1, 3, 0, -1}; + static const long possible_ports[] = {0x220, 0x240, 0x260}; + static const int possible_irqs[] = {5, 9, 10, 7, -1}; + static const int possible_dmas[] = {1, 3, 0, -1}; int i, error; diff --git a/sound/isa/es1688/es1688_lib.c b/sound/isa/es1688/es1688_lib.c index 1568d0bfd1a8..1816e55c6edf 100644 --- a/sound/isa/es1688/es1688_lib.c +++ b/sound/isa/es1688/es1688_lib.c @@ -180,7 +180,7 @@ static int snd_es1688_probe(struct snd_es1688 *chip) static int snd_es1688_init(struct snd_es1688 * chip, int enable) { - static int irqs[16] = {-1, -1, 0, -1, -1, 1, -1, 2, -1, 0, 3, -1, -1, -1, -1, -1}; + static const int irqs[16] = {-1, -1, 0, -1, -1, 1, -1, 2, -1, 0, 3, -1, -1, -1, -1, -1}; unsigned long flags; int cfg, irq_bits, dma, dma_bits, tmp, tmp1; @@ -946,7 +946,7 @@ ES1688_SINGLE("Capture Switch", 0, ES1688_REC_DEV, 4, 1, 1), #define ES1688_INIT_TABLE_SIZE (sizeof(snd_es1688_init_table)/2) -static unsigned char snd_es1688_init_table[][2] = { +static const unsigned char snd_es1688_init_table[][2] = { { ES1688_MASTER_DEV, 0 }, { ES1688_PCM_DEV, 0 }, { ES1688_LINE_DEV, 0 }, -- cgit From fce6709730255f3b81e98ea3b78859b079521077 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Sun, 5 Jan 2020 15:48:03 +0100 Subject: ALSA: es18xx: More constifications Apply const prefix to the static map tables and the static resource tables. Just for minor optimization and no functional changes. Link: https://lore.kernel.org/r/20200105144823.29547-49-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/es18xx.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 6ce5b5c76980..d1135f6ae104 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c @@ -965,7 +965,7 @@ static int snd_es18xx_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_ele static int snd_es18xx_get_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - static unsigned char invMap4Source[8] = {0, 0, 1, 1, 0, 0, 2, 3}; + static const unsigned char invMap4Source[8] = {0, 0, 1, 1, 0, 0, 2, 3}; struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol); int muxSource = snd_es18xx_mixer_read(chip, 0x1c) & 0x07; if (!(chip->version == 0x1869 || chip->version == 0x1879)) { @@ -982,7 +982,7 @@ static int snd_es18xx_get_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem static int snd_es18xx_put_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - static unsigned char map4Source[4] = {0, 2, 6, 7}; + static const unsigned char map4Source[4] = {0, 2, 6, 7}; struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol); unsigned char val = ucontrol->value.enumerated.item[0]; unsigned char retVal = 0; @@ -2173,8 +2173,8 @@ static int snd_es18xx_isa_probe1(int dev, struct device *devptr) static int snd_es18xx_isa_probe(struct device *pdev, unsigned int dev) { int err; - static int possible_irqs[] = {5, 9, 10, 7, 11, 12, -1}; - static int possible_dmas[] = {1, 0, 3, 5, -1}; + static const int possible_irqs[] = {5, 9, 10, 7, 11, 12, -1}; + static const int possible_dmas[] = {1, 0, 3, 5, -1}; if (irq[dev] == SNDRV_AUTO_IRQ) { if ((irq[dev] = snd_legacy_find_free_irq(possible_irqs)) < 0) { @@ -2198,7 +2198,7 @@ static int snd_es18xx_isa_probe(struct device *pdev, unsigned int dev) if (port[dev] != SNDRV_AUTO_PORT) { return snd_es18xx_isa_probe1(dev, pdev); } else { - static unsigned long possible_ports[] = {0x220, 0x240, 0x260, 0x280}; + static const unsigned long possible_ports[] = {0x220, 0x240, 0x260, 0x280}; int i; for (i = 0; i < ARRAY_SIZE(possible_ports); i++) { port[dev] = possible_ports[i]; -- cgit From 15a1af95d65729d35071445b9459c1e22f776347 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Sun, 5 Jan 2020 15:48:04 +0100 Subject: ALSA: gus: More constifications Apply const prefix to each possible place: the static resource tables, the volume table, etc. Just for minor optimization and no functional changes. Link: https://lore.kernel.org/r/20200105144823.29547-50-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/gus/gus_io.c | 2 +- sound/isa/gus/gus_main.c | 4 ++-- sound/isa/gus/gus_volume.c | 9 +++++---- sound/isa/gus/gusclassic.c | 6 +++--- sound/isa/gus/gusextreme.c | 10 +++++----- sound/isa/gus/gusmax.c | 6 +++--- sound/isa/gus/interwave.c | 10 +++++----- 7 files changed, 24 insertions(+), 23 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/gus/gus_io.c b/sound/isa/gus/gus_io.c index 0ab550bc80f2..fb7b5e2636b8 100644 --- a/sound/isa/gus/gus_io.c +++ b/sound/isa/gus/gus_io.c @@ -403,7 +403,7 @@ void snd_gf1_select_active_voices(struct snd_gus_card * gus) { unsigned short voices; - static unsigned short voices_tbl[32 - 14 + 1] = + static const unsigned short voices_tbl[32 - 14 + 1] = { 44100, 41160, 38587, 36317, 34300, 32494, 30870, 29400, 28063, 26843, 25725, 24696, 23746, 22866, 22050, 21289, 20580, 19916, 19293 diff --git a/sound/isa/gus/gus_main.c b/sound/isa/gus/gus_main.c index e9fc333c0fcb..afc088f0377c 100644 --- a/sound/isa/gus/gus_main.c +++ b/sound/isa/gus/gus_main.c @@ -267,9 +267,9 @@ static int snd_gus_init_dma_irq(struct snd_gus_card * gus, int latches) struct snd_card *card; unsigned long flags; int irq, dma1, dma2; - static unsigned char irqs[16] = + static const unsigned char irqs[16] = {0, 0, 1, 3, 0, 2, 0, 4, 0, 1, 0, 5, 6, 0, 0, 7}; - static unsigned char dmas[8] = + static const unsigned char dmas[8] = {6, 1, 0, 2, 0, 3, 4, 5}; if (snd_BUG_ON(!gus)) diff --git a/sound/isa/gus/gus_volume.c b/sound/isa/gus/gus_volume.c index 39a2e5bd6c0a..ed72196a361b 100644 --- a/sound/isa/gus/gus_volume.c +++ b/sound/isa/gus/gus_volume.c @@ -62,7 +62,7 @@ unsigned int snd_gf1_calc_ramp_rate(struct snd_gus_card * gus, unsigned short end, unsigned int us) { - static unsigned char vol_rates[19] = + static const unsigned char vol_rates[19] = { 23, 24, 26, 28, 29, 31, 32, 34, 36, 37, 39, 40, 42, 44, 45, 47, @@ -113,7 +113,7 @@ unsigned short snd_gf1_translate_freq(struct snd_gus_card * gus, unsigned int fr short snd_gf1_compute_vibrato(short cents, unsigned short fc_register) { - static short vibrato_table[] = + static const short vibrato_table[] = { 0, 0, 32, 592, 61, 1175, 93, 1808, 124, 2433, 152, 3007, 182, 3632, 213, 4290, @@ -121,7 +121,8 @@ short snd_gf1_compute_vibrato(short cents, unsigned short fc_register) }; long depth; - short *vi1, *vi2, pcents, v1; + const short *vi1, *vi2; + short pcents, v1; pcents = cents < 0 ? -cents : cents; for (vi1 = vibrato_table, vi2 = vi1 + 2; pcents > *vi2; vi1 = vi2, vi2 += 2); @@ -145,7 +146,7 @@ short snd_gf1_compute_vibrato(short cents, unsigned short fc_register) unsigned short snd_gf1_compute_pitchbend(unsigned short pitchbend, unsigned short sens) { - static long log_table[] = {1024, 1085, 1149, 1218, 1290, 1367, 1448, 1534, 1625, 1722, 1825, 1933}; + static const long log_table[] = {1024, 1085, 1149, 1218, 1290, 1367, 1448, 1534, 1625, 1722, 1825, 1933}; int wheel, sensitivity; unsigned int mantissa, f1, f2; unsigned short semitones, f1_index, f2_index, f1_power, f2_power; diff --git a/sound/isa/gus/gusclassic.c b/sound/isa/gus/gusclassic.c index f7e869771d16..7419b1939754 100644 --- a/sound/isa/gus/gusclassic.c +++ b/sound/isa/gus/gusclassic.c @@ -67,9 +67,9 @@ static int snd_gusclassic_create(struct snd_card *card, struct device *dev, unsigned int n, struct snd_gus_card **rgus) { - static long possible_ports[] = {0x220, 0x230, 0x240, 0x250, 0x260}; - static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, 4, -1}; - static int possible_dmas[] = {5, 6, 7, 1, 3, -1}; + static const long possible_ports[] = {0x220, 0x230, 0x240, 0x250, 0x260}; + static const int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, 4, -1}; + static const int possible_dmas[] = {5, 6, 7, 1, 3, -1}; int i, error; diff --git a/sound/isa/gus/gusextreme.c b/sound/isa/gus/gusextreme.c index 8cf366bbdd8d..ed2f9d64efae 100644 --- a/sound/isa/gus/gusextreme.c +++ b/sound/isa/gus/gusextreme.c @@ -83,9 +83,9 @@ static int snd_gusextreme_es1688_create(struct snd_card *card, struct snd_es1688 *chip, struct device *dev, unsigned int n) { - static long possible_ports[] = {0x220, 0x240, 0x260}; - static int possible_irqs[] = {5, 9, 10, 7, -1}; - static int possible_dmas[] = {1, 3, 0, -1}; + static const long possible_ports[] = {0x220, 0x240, 0x260}; + static const int possible_irqs[] = {5, 9, 10, 7, -1}; + static const int possible_dmas[] = {1, 3, 0, -1}; int i, error; @@ -122,8 +122,8 @@ static int snd_gusextreme_gus_card_create(struct snd_card *card, struct device *dev, unsigned int n, struct snd_gus_card **rgus) { - static int possible_irqs[] = {11, 12, 15, 9, 5, 7, 3, -1}; - static int possible_dmas[] = {5, 6, 7, 3, 1, -1}; + static const int possible_irqs[] = {11, 12, 15, 9, 5, 7, 3, -1}; + static const int possible_dmas[] = {5, 6, 7, 3, 1, -1}; if (gf1_irq[n] == SNDRV_AUTO_IRQ) { gf1_irq[n] = snd_legacy_find_free_irq(possible_irqs); diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c index efe576625f48..05cd9be4dd8a 100644 --- a/sound/isa/gus/gusmax.c +++ b/sound/isa/gus/gusmax.c @@ -191,8 +191,8 @@ static int snd_gusmax_match(struct device *pdev, unsigned int dev) static int snd_gusmax_probe(struct device *pdev, unsigned int dev) { - static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1}; - static int possible_dmas[] = {5, 6, 7, 1, 3, -1}; + static const int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1}; + static const int possible_dmas[] = {5, 6, 7, 1, 3, -1}; int xirq, xdma1, xdma2, err; struct snd_card *card; struct snd_gus_card *gus = NULL; @@ -241,7 +241,7 @@ static int snd_gusmax_probe(struct device *pdev, unsigned int dev) pcm_channels[dev], 0, &gus); } else { - static unsigned long possible_ports[] = { + static const unsigned long possible_ports[] = { 0x220, 0x230, 0x240, 0x250, 0x260 }; int i; diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c index 5cd4aa477ba7..3e9ad930deae 100644 --- a/sound/isa/gus/interwave.c +++ b/sound/isa/gus/interwave.c @@ -364,7 +364,7 @@ struct rom_hdr { static void snd_interwave_detect_memory(struct snd_gus_card *gus) { - static unsigned int lmc[13] = + static const unsigned int lmc[13] = { 0x00000001, 0x00000101, 0x01010101, 0x00000401, 0x04040401, 0x00040101, 0x04040101, 0x00000004, @@ -475,7 +475,7 @@ static void snd_interwave_init(int dev, struct snd_gus_card *gus) } -static struct snd_kcontrol_new snd_interwave_controls[] = { +static const struct snd_kcontrol_new snd_interwave_controls[] = { WSS_DOUBLE("Master Playback Switch", 0, CS4231_LINE_LEFT_OUTPUT, CS4231_LINE_RIGHT_OUTPUT, 7, 7, 1, 1), WSS_DOUBLE("Master Playback Volume", 0, @@ -788,8 +788,8 @@ static int snd_interwave_isa_probe(struct device *pdev, unsigned int dev) { int err; - static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1}; - static int possible_dmas[] = {0, 1, 3, 5, 6, 7, -1}; + static const int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1}; + static const int possible_dmas[] = {0, 1, 3, 5, 6, 7, -1}; if (irq[dev] == SNDRV_AUTO_IRQ) { if ((irq[dev] = snd_legacy_find_free_irq(possible_irqs)) < 0) { @@ -813,7 +813,7 @@ static int snd_interwave_isa_probe(struct device *pdev, if (port[dev] != SNDRV_AUTO_PORT) return snd_interwave_isa_probe1(dev, pdev); else { - static long possible_ports[] = {0x210, 0x220, 0x230, 0x240, 0x250, 0x260}; + static const long possible_ports[] = {0x210, 0x220, 0x230, 0x240, 0x250, 0x260}; int i; for (i = 0; i < ARRAY_SIZE(possible_ports); i++) { port[dev] = possible_ports[i]; -- cgit From 80e0a7c095462e24f48908e6effd7a44099249f9 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Sun, 5 Jan 2020 15:48:05 +0100 Subject: ALSA: opti9xx: More constifications Apply const prefix to the static resource tables, the mc size tables and the string arrays. Just for minor optimization and no functional changes. Link: https://lore.kernel.org/r/20200105144823.29547-51-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/opti9xx/miro.c | 18 +++++++++--------- sound/isa/opti9xx/opti92x-ad1848.c | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c index a9c773b9f471..e764816a8f7a 100644 --- a/sound/isa/opti9xx/miro.c +++ b/sound/isa/opti9xx/miro.c @@ -119,7 +119,7 @@ struct snd_miro { static struct snd_miro_aci aci_device; -static char * snd_opti9xx_names[] = { +static const char * const snd_opti9xx_names[] = { "unknown", "82C928", "82C929", "82C924", "82C925", @@ -637,7 +637,7 @@ static const struct snd_kcontrol_new snd_miro_capture_control[] = { .put = snd_miro_put_capture, }}; -static unsigned char aci_init_values[][2] = { +static const unsigned char aci_init_values[][2] = { { ACI_SET_MUTE, 0x00 }, { ACI_SET_POWERAMP, 0x00 }, { ACI_SET_PREAMP, 0x00 }, @@ -764,7 +764,7 @@ static int snd_miro_mixer(struct snd_card *card, static int snd_miro_init(struct snd_miro *chip, unsigned short hardware) { - static int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2}; + static const int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2}; chip->hardware = hardware; strcpy(chip->name, snd_opti9xx_names[hardware]); @@ -1387,12 +1387,12 @@ static int snd_miro_isa_match(struct device *devptr, unsigned int n) static int snd_miro_isa_probe(struct device *devptr, unsigned int n) { - static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; - static long possible_mpu_ports[] = {0x330, 0x300, 0x310, 0x320, -1}; - static int possible_irqs[] = {11, 9, 10, 7, -1}; - static int possible_mpu_irqs[] = {10, 5, 9, 7, -1}; - static int possible_dma1s[] = {3, 1, 0, -1}; - static int possible_dma2s[][2] = { {1, -1}, {0, -1}, {-1, -1}, + static const long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; + static const long possible_mpu_ports[] = {0x330, 0x300, 0x310, 0x320, -1}; + static const int possible_irqs[] = {11, 9, 10, 7, -1}; + static const int possible_mpu_irqs[] = {10, 5, 9, 7, -1}; + static const int possible_dma1s[] = {3, 1, 0, -1}; + static const int possible_dma2s[][2] = { {1, -1}, {0, -1}, {-1, -1}, {0, -1} }; int error; diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index 697576459f71..d06b29693c85 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c @@ -163,7 +163,7 @@ MODULE_DEVICE_TABLE(pnp_card, snd_opti9xx_pnpids); #define DEV_NAME KBUILD_MODNAME -static char * snd_opti9xx_names[] = { +static const char * const snd_opti9xx_names[] = { "unknown", "82C928", "82C929", "82C924", "82C925", @@ -173,7 +173,7 @@ static char * snd_opti9xx_names[] = { static int snd_opti9xx_init(struct snd_opti9xx *chip, unsigned short hardware) { - static int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2}; + static const int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2}; chip->hardware = hardware; strcpy(chip->name, snd_opti9xx_names[hardware]); @@ -808,7 +808,7 @@ static void snd_card_opti9xx_free(struct snd_card *card) static int snd_opti9xx_probe(struct snd_card *card) { - static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; + static const long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; int error; int xdma2; struct snd_opti9xx *chip = card->private_data; @@ -958,16 +958,16 @@ static int snd_opti9xx_isa_probe(struct device *devptr, { struct snd_card *card; int error; - static long possible_mpu_ports[] = {0x300, 0x310, 0x320, 0x330, -1}; + static const long possible_mpu_ports[] = {0x300, 0x310, 0x320, 0x330, -1}; #ifdef OPTi93X - static int possible_irqs[] = {5, 9, 10, 11, 7, -1}; + static const int possible_irqs[] = {5, 9, 10, 11, 7, -1}; #else - static int possible_irqs[] = {9, 10, 11, 7, -1}; + static const int possible_irqs[] = {9, 10, 11, 7, -1}; #endif /* OPTi93X */ - static int possible_mpu_irqs[] = {5, 9, 10, 7, -1}; - static int possible_dma1s[] = {3, 1, 0, -1}; + static const int possible_mpu_irqs[] = {5, 9, 10, 7, -1}; + static const int possible_dma1s[] = {3, 1, 0, -1}; #if defined(CS4231) || defined(OPTi93X) - static int possible_dma2s[][2] = {{1,-1}, {0,-1}, {-1,-1}, {0,-1}}; + static const int possible_dma2s[][2] = {{1,-1}, {0,-1}, {-1,-1}, {0,-1}}; #endif /* CS4231 || OPTi93X */ if (mpu_port == SNDRV_AUTO_PORT) { -- cgit From 429bca4d76b406302de4d06d6f4e20e2a36afb08 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Sun, 5 Jan 2020 15:48:06 +0100 Subject: ALSA: wss: More constifications Apply const prefix to the static tables for parameters. Just for minor optimization and no functional changes. Link: https://lore.kernel.org/r/20200105144823.29547-52-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/wss/wss_lib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/wss/wss_lib.c b/sound/isa/wss/wss_lib.c index d37f4642162a..ea5d3cdfe4e4 100644 --- a/sound/isa/wss/wss_lib.c +++ b/sound/isa/wss/wss_lib.c @@ -38,7 +38,7 @@ MODULE_LICENSE("GPL"); * Some variables */ -static unsigned char freq_bits[14] = { +static const unsigned char freq_bits[14] = { /* 5510 */ 0x00 | CS4231_XTAL2, /* 6620 */ 0x0E | CS4231_XTAL2, /* 8000 */ 0x00 | CS4231_XTAL1, @@ -72,7 +72,7 @@ static int snd_wss_xrate(struct snd_pcm_runtime *runtime) &hw_constraints_rates); } -static unsigned char snd_wss_original_image[32] = +static const unsigned char snd_wss_original_image[32] = { 0x00, /* 00/00 - lic */ 0x00, /* 01/01 - ric */ @@ -108,7 +108,7 @@ static unsigned char snd_wss_original_image[32] = 0x00, /* 1f/31 - cbrl */ }; -static unsigned char snd_opti93x_original_image[32] = +static const unsigned char snd_opti93x_original_image[32] = { 0x00, /* 00/00 - l_mixout_outctrl */ 0x00, /* 01/01 - r_mixout_outctrl */ -- cgit From 8fc179162df5b307d8d1f8f4b6b7bb507742cd55 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Sun, 5 Jan 2020 15:48:07 +0100 Subject: ALSA: sc6000: More constification Apply const prefix to the static resource tables. Just for minor optimization and no functional changes. Link: https://lore.kernel.org/r/20200105144823.29547-53-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/isa/sc6000.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/sc6000.c b/sound/isa/sc6000.c index 395ee3b1794d..3d0bea44f454 100644 --- a/sound/isa/sc6000.c +++ b/sound/isa/sc6000.c @@ -534,8 +534,8 @@ static int snd_sc6000_match(struct device *devptr, unsigned int dev) static int snd_sc6000_probe(struct device *devptr, unsigned int dev) { - static int possible_irqs[] = { 5, 7, 9, 10, 11, -1 }; - static int possible_dmas[] = { 1, 3, 0, -1 }; + static const int possible_irqs[] = { 5, 7, 9, 10, 11, -1 }; + static const int possible_dmas[] = { 1, 3, 0, -1 }; int err; int xirq = irq[dev]; int xdma = dma[dev]; -- cgit