From c6e486ffb2e5a3a3e8f34fb24a6f6f2683cf010b Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Tue, 18 Jul 2017 13:48:08 +0200 Subject: ALSA: mixart: fix string overflow warning Using a temporary string produces warnings about a possible overflow in sprintf: sound/pci/mixart/mixart.c: In function 'snd_mixart_probe': sound/pci/mixart/mixart.c:1353:28: error: ' [PCM #' directive writing 7 bytes into a region of size between 1 and 32 [-Werror=format-overflow=] sprintf(card->shortname, "%s [PCM #%d]", mgr->shortname, i); ^~~~~~~~~~~~~~ sound/pci/mixart/mixart.c:1353:28: note: using the range [-2147483648, 2147483647] for directive argument sound/pci/mixart/mixart.c:1353:3: note: 'sprintf' output between 10 and 51 bytes into a destination of size 32 sprintf(card->shortname, "%s [PCM #%d]", mgr->shortname, i); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sound/pci/mixart/mixart.c:1354:27: error: ' [PCM #' directive writing 7 bytes into a region of size between 1 and 80 [-Werror=format-overflow=] sprintf(card->longname, "%s [PCM #%d]", mgr->longname, i); ^~~~~~~~~~~~~~ sound/pci/mixart/mixart.c:1354:27: note: using the range [-2147483648, 2147483647] for directive argument sound/pci/mixart/mixart.c:1354:3: note: 'sprintf' output between 10 and 99 bytes into a destination of size 80 Skipping the intermediate, we can get gcc to see that it is in fact safe here. Signed-off-by: Arnd Bergmann Signed-off-by: Takashi Iwai --- sound/pci/mixart/mixart.c | 10 +++++----- sound/pci/mixart/mixart.h | 4 ---- 2 files changed, 5 insertions(+), 9 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c index 80d439944cb5..6d7fbf30618b 100644 --- a/sound/pci/mixart/mixart.c +++ b/sound/pci/mixart/mixart.c @@ -1313,9 +1313,6 @@ static int snd_mixart_probe(struct pci_dev *pci, } mgr->irq = pci->irq; - sprintf(mgr->shortname, "Digigram miXart"); - sprintf(mgr->longname, "%s at 0x%lx & 0x%lx, irq %i", mgr->shortname, mgr->mem[0].phys, mgr->mem[1].phys, mgr->irq); - /* init mailbox */ mgr->msg_fifo_readptr = 0; mgr->msg_fifo_writeptr = 0; @@ -1350,8 +1347,11 @@ static int snd_mixart_probe(struct pci_dev *pci, } strcpy(card->driver, CARD_NAME); - sprintf(card->shortname, "%s [PCM #%d]", mgr->shortname, i); - sprintf(card->longname, "%s [PCM #%d]", mgr->longname, i); + snprintf(card->shortname, sizeof(card->shortname), + "Digigram miXart [PCM #%d]", i); + snprintf(card->longname, sizeof(card->longname), + "Digigram miXart at 0x%lx & 0x%lx, irq %i [PCM #%d]", + mgr->mem[0].phys, mgr->mem[1].phys, mgr->irq, i); if ((err = snd_mixart_create(mgr, card, i)) < 0) { snd_card_free(card); diff --git a/sound/pci/mixart/mixart.h b/sound/pci/mixart/mixart.h index 426743871540..69b3ece099ad 100644 --- a/sound/pci/mixart/mixart.h +++ b/sound/pci/mixart/mixart.h @@ -74,10 +74,6 @@ struct mixart_mgr { /* memory-maps */ struct mem_area mem[2]; - /* share the name */ - char shortname[32]; /* short name of this soundcard */ - char longname[80]; /* name of this soundcard */ - /* one and only blocking message or notification may be pending */ u32 pending_event; wait_queue_head_t msg_sleep; -- cgit From 7ad210ace5c1701421a4defa9d9e830a6f2ee56b Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Tue, 18 Jul 2017 13:48:09 +0200 Subject: ALSA: rme9652: fix format overflow warnings gcc-7 warns about a possible sprintf format string overflow with a temporary buffer that is used to print from another buffer of the same size: sound/pci/rme9652/hdspm.c: In function 'snd_hdspm_create_alsa_devices': sound/pci/rme9652/hdspm.c:2123:17: error: ' MIDIoverMADI' directive writing 13 bytes into a region of size between 1 and 32 [-Werror=format-overflow=] This extends the temporary buffer to twice the size, and changes the code to use the safer snprintf() across the entire file. The longer buffer is still necessary to avoid a format-truncation warning. Signed-off-by: Arnd Bergmann Signed-off-by: Takashi Iwai --- sound/pci/rme9652/hdspm.c | 48 +++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 254c3d040118..2a3a916e5d15 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -2061,7 +2061,7 @@ static int snd_hdspm_create_midi(struct snd_card *card, struct hdspm *hdspm, int id) { int err; - char buf[32]; + char buf[64]; hdspm->midi[id].id = id; hdspm->midi[id].hdspm = hdspm; @@ -2120,19 +2120,23 @@ static int snd_hdspm_create_midi(struct snd_card *card, if ((id < 2) || ((2 == id) && ((MADI == hdspm->io_type) || (MADIface == hdspm->io_type)))) { if ((id == 0) && (MADIface == hdspm->io_type)) { - sprintf(buf, "%s MIDIoverMADI", card->shortname); + snprintf(buf, sizeof(buf), "%s MIDIoverMADI", + card->shortname); } else if ((id == 2) && (MADI == hdspm->io_type)) { - sprintf(buf, "%s MIDIoverMADI", card->shortname); + snprintf(buf, sizeof(buf), "%s MIDIoverMADI", + card->shortname); } else { - sprintf(buf, "%s MIDI %d", card->shortname, id+1); + snprintf(buf, sizeof(buf), "%s MIDI %d", + card->shortname, id+1); } err = snd_rawmidi_new(card, buf, id, 1, 1, &hdspm->midi[id].rmidi); if (err < 0) return err; - sprintf(hdspm->midi[id].rmidi->name, "%s MIDI %d", - card->id, id+1); + snprintf(hdspm->midi[id].rmidi->name, + sizeof(hdspm->midi[id].rmidi->name), + "%s MIDI %d", card->id, id+1); hdspm->midi[id].rmidi->private_data = &hdspm->midi[id]; snd_rawmidi_set_ops(hdspm->midi[id].rmidi, @@ -2148,14 +2152,16 @@ static int snd_hdspm_create_midi(struct snd_card *card, SNDRV_RAWMIDI_INFO_DUPLEX; } else { /* TCO MTC, read only */ - sprintf(buf, "%s MTC %d", card->shortname, id+1); + snprintf(buf, sizeof(buf), "%s MTC %d", + card->shortname, id+1); err = snd_rawmidi_new(card, buf, id, 1, 1, &hdspm->midi[id].rmidi); if (err < 0) return err; - sprintf(hdspm->midi[id].rmidi->name, - "%s MTC %d", card->id, id+1); + snprintf(hdspm->midi[id].rmidi->name, + sizeof(hdspm->midi[id].rmidi->name), + "%s MTC %d", card->id, id+1); hdspm->midi[id].rmidi->private_data = &hdspm->midi[id]; snd_rawmidi_set_ops(hdspm->midi[id].rmidi, @@ -6869,7 +6875,8 @@ static int snd_hdspm_create(struct snd_card *card, * when running with multiple cards. */ if (NULL == id[hdspm->dev] && hdspm->serial != 0xFFFFFF) { - sprintf(card->id, "HDSPMx%06x", hdspm->serial); + snprintf(card->id, sizeof(card->id), + "HDSPMx%06x", hdspm->serial); snd_card_set_id(card, card->id); } } @@ -6954,17 +6961,18 @@ static int snd_hdspm_probe(struct pci_dev *pci, } if (hdspm->io_type != MADIface) { - sprintf(card->shortname, "%s_%x", - hdspm->card_name, - hdspm->serial); - sprintf(card->longname, "%s S/N 0x%x at 0x%lx, irq %d", - hdspm->card_name, - hdspm->serial, - hdspm->port, hdspm->irq); + snprintf(card->shortname, sizeof(card->shortname), "%s_%x", + hdspm->card_name, hdspm->serial); + snprintf(card->longname, sizeof(card->longname), + "%s S/N 0x%x at 0x%lx, irq %d", + hdspm->card_name, hdspm->serial, + hdspm->port, hdspm->irq); } else { - sprintf(card->shortname, "%s", hdspm->card_name); - sprintf(card->longname, "%s at 0x%lx, irq %d", - hdspm->card_name, hdspm->port, hdspm->irq); + snprintf(card->shortname, sizeof(card->shortname), "%s", + hdspm->card_name); + snprintf(card->longname, sizeof(card->longname), + "%s at 0x%lx, irq %d", + hdspm->card_name, hdspm->port, hdspm->irq); } err = snd_card_register(card); -- cgit From 5051735221ba50cb5794b9194a8ad10a13368f2f Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Tue, 18 Jul 2017 13:48:10 +0200 Subject: ALSA: pcxhr: fix string overflow warnings With gcc-7, we get a warning about a possible string overflow: sound/pci/pcxhr/pcxhr.c: In function 'pcxhr_probe': sound/pci/pcxhr/pcxhr.c:1647:28: error: ' [PCM #' directive writing 7 bytes into a region of size between 1 and 32 [-Werror=format-overflow=] The shortname can simply be removed, and the longname can be changed into a shorter "name" string that is used in three places. Making it a little shorter (40 bytes) avoids the risk of overflowing completely, but I also use snprintf() here for extra clarity. Signed-off-by: Arnd Bergmann Signed-off-by: Takashi Iwai --- sound/pci/pcxhr/pcxhr.c | 19 ++++++++++--------- sound/pci/pcxhr/pcxhr.h | 3 +-- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c index bb7eee9d0c2b..fa919f52e225 100644 --- a/sound/pci/pcxhr/pcxhr.c +++ b/sound/pci/pcxhr/pcxhr.c @@ -1165,7 +1165,7 @@ int pcxhr_create_pcm(struct snd_pcxhr *chip) struct snd_pcm *pcm; char name[32]; - sprintf(name, "pcxhr %d", chip->chip_idx); + snprintf(name, sizeof(name), "pcxhr %d", chip->chip_idx); if ((err = snd_pcm_new(chip->card, name, 0, chip->nb_streams_play, chip->nb_streams_capt, &pcm)) < 0) { @@ -1252,7 +1252,7 @@ static void pcxhr_proc_info(struct snd_info_entry *entry, struct snd_pcxhr *chip = entry->private_data; struct pcxhr_mgr *mgr = chip->mgr; - snd_iprintf(buffer, "\n%s\n", mgr->longname); + snd_iprintf(buffer, "\n%s\n", mgr->name); /* stats available when embedded DSP is running */ if (mgr->dsp_loaded & (1 << PCXHR_FIRMWARE_DSP_MAIN_INDEX)) { @@ -1339,7 +1339,7 @@ static void pcxhr_proc_sync(struct snd_info_entry *entry, max_clock = PCXHR_CLOCK_TYPE_MAX; } - snd_iprintf(buffer, "\n%s\n", mgr->longname); + snd_iprintf(buffer, "\n%s\n", mgr->name); snd_iprintf(buffer, "Current Sample Clock\t: %s\n", texts[mgr->cur_clock_type]); snd_iprintf(buffer, "Current Sample Rate\t= %d\n", @@ -1597,10 +1597,9 @@ static int pcxhr_probe(struct pci_dev *pci, } mgr->irq = pci->irq; - sprintf(mgr->shortname, "Digigram %s", card_name); - sprintf(mgr->longname, "%s at 0x%lx & 0x%lx, 0x%lx irq %i", - mgr->shortname, - mgr->port[0], mgr->port[1], mgr->port[2], mgr->irq); + snprintf(mgr->name, sizeof(mgr->name), + "Digigram at 0x%lx & 0x%lx, 0x%lx irq %i", + mgr->port[0], mgr->port[1], mgr->port[2], mgr->irq); /* ISR lock */ mutex_init(&mgr->lock); @@ -1644,8 +1643,10 @@ static int pcxhr_probe(struct pci_dev *pci, } strcpy(card->driver, DRIVER_NAME); - sprintf(card->shortname, "%s [PCM #%d]", mgr->shortname, i); - sprintf(card->longname, "%s [PCM #%d]", mgr->longname, i); + snprintf(card->shortname, sizeof(card->shortname), + "Digigram [PCM #%d]", i); + snprintf(card->longname, sizeof(card->longname), + "%s [PCM #%d]", mgr->name, i); if ((err = pcxhr_create(mgr, card, i)) < 0) { snd_card_free(card); diff --git a/sound/pci/pcxhr/pcxhr.h b/sound/pci/pcxhr/pcxhr.h index 9e39e509a3ef..d799cbd37301 100644 --- a/sound/pci/pcxhr/pcxhr.h +++ b/sound/pci/pcxhr/pcxhr.h @@ -75,8 +75,7 @@ struct pcxhr_mgr { unsigned long port[3]; /* share the name */ - char shortname[32]; /* short name of this soundcard */ - char longname[96]; /* name of this soundcard */ + char name[40]; /* name of this soundcard */ struct pcxhr_rmh *prmh; -- cgit From 4647e8d512224265afad63aa27a6b22561f50d46 Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Fri, 4 Aug 2017 21:04:41 +0530 Subject: ALSA: ice1712: add const to snd_ak4xxx_private structures Declare snd_ak4xxx_private structures as const as they are only passed to the function snd_ice1712_akm4xxx_init. This argument is of type const, so make the structures const. Done using Coccinelle: @match disable optional_qualifier@ identifier s; position p; @@ static struct snd_ak4xxx_private s@p={...}; @good1@ identifier match.s; position p; @@ snd_ice1712_akm4xxx_init(...,&s@p,...) @bad@ identifier match.s; position p!={match.p,good1.p}; @@ s@p @depends on !bad disable optional_qualifier@ identifier match.s; @@ static +const struct snd_ak4xxx_private s={...}; Signed-off-by: Bhumika Goyal Signed-off-by: Takashi Iwai --- sound/pci/ice1712/delta.c | 12 ++++++------ sound/pci/ice1712/ews.c | 6 +++--- sound/pci/ice1712/hoontech.c | 2 +- sound/pci/ice1712/phase.c | 2 +- sound/pci/ice1712/revo.c | 10 +++++----- 5 files changed, 16 insertions(+), 16 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/ice1712/delta.c b/sound/pci/ice1712/delta.c index da5f37b7fdd0..4e470f09e215 100644 --- a/sound/pci/ice1712/delta.c +++ b/sound/pci/ice1712/delta.c @@ -454,7 +454,7 @@ static struct snd_akm4xxx akm_audiophile = { } }; -static struct snd_ak4xxx_private akm_audiophile_priv = { +static const struct snd_ak4xxx_private akm_audiophile_priv = { .caddr = 2, .cif = 0, .data_mask = ICE1712_DELTA_AP_DOUT, @@ -475,7 +475,7 @@ static struct snd_akm4xxx akm_delta410 = { } }; -static struct snd_ak4xxx_private akm_delta410_priv = { +static const struct snd_ak4xxx_private akm_delta410_priv = { .caddr = 0, .cif = 0, .data_mask = ICE1712_DELTA_AP_DOUT, @@ -497,7 +497,7 @@ static struct snd_akm4xxx akm_delta1010lt = { } }; -static struct snd_ak4xxx_private akm_delta1010lt_priv = { +static const struct snd_ak4xxx_private akm_delta1010lt_priv = { .caddr = 2, .cif = 0, /* the default level of the CIF pin from AK4524 */ .data_mask = ICE1712_DELTA_1010LT_DOUT, @@ -519,7 +519,7 @@ static struct snd_akm4xxx akm_delta66e = { } }; -static struct snd_ak4xxx_private akm_delta66e_priv = { +static const struct snd_ak4xxx_private akm_delta66e_priv = { .caddr = 2, .cif = 0, /* the default level of the CIF pin from AK4524 */ .data_mask = ICE1712_DELTA_66E_DOUT, @@ -542,7 +542,7 @@ static struct snd_akm4xxx akm_delta44 = { } }; -static struct snd_ak4xxx_private akm_delta44_priv = { +static const struct snd_ak4xxx_private akm_delta44_priv = { .caddr = 2, .cif = 0, /* the default level of the CIF pin from AK4524 */ .data_mask = ICE1712_DELTA_CODEC_SERIAL_DATA, @@ -564,7 +564,7 @@ static struct snd_akm4xxx akm_vx442 = { } }; -static struct snd_ak4xxx_private akm_vx442_priv = { +static const struct snd_ak4xxx_private akm_vx442_priv = { .caddr = 2, .cif = 0, .data_mask = ICE1712_VX442_DOUT, diff --git a/sound/pci/ice1712/ews.c b/sound/pci/ice1712/ews.c index ec07136fc288..5bc14e8806a7 100644 --- a/sound/pci/ice1712/ews.c +++ b/sound/pci/ice1712/ews.c @@ -354,7 +354,7 @@ static struct snd_akm4xxx akm_ews88mt = { } }; -static struct snd_ak4xxx_private akm_ews88mt_priv = { +static const struct snd_ak4xxx_private akm_ews88mt_priv = { .caddr = 2, .cif = 1, /* CIF high */ .data_mask = ICE1712_EWS88_SERIAL_DATA, @@ -375,7 +375,7 @@ static struct snd_akm4xxx akm_ewx2496 = { } }; -static struct snd_ak4xxx_private akm_ewx2496_priv = { +static const struct snd_ak4xxx_private akm_ewx2496_priv = { .caddr = 2, .cif = 1, /* CIF high */ .data_mask = ICE1712_EWS88_SERIAL_DATA, @@ -396,7 +396,7 @@ static struct snd_akm4xxx akm_6fire = { } }; -static struct snd_ak4xxx_private akm_6fire_priv = { +static const struct snd_ak4xxx_private akm_6fire_priv = { .caddr = 2, .cif = 1, /* CIF high */ .data_mask = ICE1712_6FIRE_SERIAL_DATA, diff --git a/sound/pci/ice1712/hoontech.c b/sound/pci/ice1712/hoontech.c index a40001c1d9e8..de2fcc9a983e 100644 --- a/sound/pci/ice1712/hoontech.c +++ b/sound/pci/ice1712/hoontech.c @@ -278,7 +278,7 @@ static int snd_ice1712_value_init(struct snd_ice1712 *ice) } }; - static struct snd_ak4xxx_private akm_stdsp24_mv_priv = { + static const struct snd_ak4xxx_private akm_stdsp24_mv_priv = { .caddr = 2, .cif = 1, /* CIF high */ .data_mask = ICE1712_STDSP24_SERIAL_DATA, diff --git a/sound/pci/ice1712/phase.c b/sound/pci/ice1712/phase.c index e9ca89c9174b..4f85482f3407 100644 --- a/sound/pci/ice1712/phase.c +++ b/sound/pci/ice1712/phase.c @@ -108,7 +108,7 @@ static struct snd_akm4xxx akm_phase22 = { .num_adcs = 2, }; -static struct snd_ak4xxx_private akm_phase22_priv = { +static const struct snd_ak4xxx_private akm_phase22_priv = { .caddr = 2, .cif = 1, .data_mask = 1 << 4, diff --git a/sound/pci/ice1712/revo.c b/sound/pci/ice1712/revo.c index 1d81ae677573..5cc4213fcad0 100644 --- a/sound/pci/ice1712/revo.c +++ b/sound/pci/ice1712/revo.c @@ -244,7 +244,7 @@ static struct snd_akm4xxx akm_revo_front = { .dac_info = revo71_front, }; -static struct snd_ak4xxx_private akm_revo_front_priv = { +static const struct snd_ak4xxx_private akm_revo_front_priv = { .caddr = 1, .cif = 0, .data_mask = VT1724_REVO_CDOUT, @@ -266,7 +266,7 @@ static struct snd_akm4xxx akm_revo_surround = { .dac_info = revo71_surround, }; -static struct snd_ak4xxx_private akm_revo_surround_priv = { +static const struct snd_ak4xxx_private akm_revo_surround_priv = { .caddr = 3, .cif = 0, .data_mask = VT1724_REVO_CDOUT, @@ -287,7 +287,7 @@ static struct snd_akm4xxx akm_revo51 = { .dac_info = revo51_dac, }; -static struct snd_ak4xxx_private akm_revo51_priv = { +static const struct snd_ak4xxx_private akm_revo51_priv = { .caddr = 2, .cif = 0, .data_mask = VT1724_REVO_CDOUT, @@ -305,7 +305,7 @@ static struct snd_akm4xxx akm_revo51_adc = { .adc_info = revo51_adc, }; -static struct snd_ak4xxx_private akm_revo51_adc_priv = { +static const struct snd_ak4xxx_private akm_revo51_adc_priv = { .caddr = 2, .cif = 0, .data_mask = VT1724_REVO_CDOUT, @@ -355,7 +355,7 @@ static struct snd_akm4xxx akm_ap192 = { .dac_info = ap192_dac, }; -static struct snd_ak4xxx_private akm_ap192_priv = { +static const struct snd_ak4xxx_private akm_ap192_priv = { .caddr = 2, .cif = 0, .data_mask = VT1724_REVO_CDOUT, -- cgit From 3135432e429ef9b69f75ad06e81071e648753a26 Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Fri, 4 Aug 2017 23:19:30 +0530 Subject: ALSA: ice1712: add const to snd_akm4xxx structures Declare snd_akm4xxx structures as const as they are only passed to the function snd_ice1712_akm4xxx_init. This argument is of type const, so make the structures const. Done using Coccinelle: @match disable optional_qualifier@ identifier s; position p; @@ static struct snd_akm4xxx s@p={...}; @good1@ identifier match.s; position p; @@ snd_ice1712_akm4xxx_init(...,&s@p,...) @bad@ identifier match.s; position p!={match.p,good1.p}; @@ s@p @depends on !bad disable optional_qualifier@ identifier match.s; @@ static +const struct snd_akm4xxx s={...}; Signed-off-by: Bhumika Goyal Signed-off-by: Takashi Iwai --- sound/pci/ice1712/delta.c | 12 ++++++------ sound/pci/ice1712/ews.c | 6 +++--- sound/pci/ice1712/hoontech.c | 2 +- sound/pci/ice1712/juli.c | 2 +- sound/pci/ice1712/phase.c | 2 +- sound/pci/ice1712/quartet.c | 2 +- sound/pci/ice1712/revo.c | 10 +++++----- 7 files changed, 18 insertions(+), 18 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/ice1712/delta.c b/sound/pci/ice1712/delta.c index 4e470f09e215..6808bed0105e 100644 --- a/sound/pci/ice1712/delta.c +++ b/sound/pci/ice1712/delta.c @@ -445,7 +445,7 @@ static const struct snd_kcontrol_new snd_ice1712_delta1010lt_wordclock_status = * initialize the chips on M-Audio cards */ -static struct snd_akm4xxx akm_audiophile = { +static const struct snd_akm4xxx akm_audiophile = { .type = SND_AK4528, .num_adcs = 2, .num_dacs = 2, @@ -466,7 +466,7 @@ static const struct snd_ak4xxx_private akm_audiophile_priv = { .mask_flags = 0, }; -static struct snd_akm4xxx akm_delta410 = { +static const struct snd_akm4xxx akm_delta410 = { .type = SND_AK4529, .num_adcs = 2, .num_dacs = 8, @@ -487,7 +487,7 @@ static const struct snd_ak4xxx_private akm_delta410_priv = { .mask_flags = 0, }; -static struct snd_akm4xxx akm_delta1010lt = { +static const struct snd_akm4xxx akm_delta1010lt = { .type = SND_AK4524, .num_adcs = 8, .num_dacs = 8, @@ -509,7 +509,7 @@ static const struct snd_ak4xxx_private akm_delta1010lt_priv = { .mask_flags = 0, }; -static struct snd_akm4xxx akm_delta66e = { +static const struct snd_akm4xxx akm_delta66e = { .type = SND_AK4524, .num_adcs = 4, .num_dacs = 4, @@ -532,7 +532,7 @@ static const struct snd_ak4xxx_private akm_delta66e_priv = { }; -static struct snd_akm4xxx akm_delta44 = { +static const struct snd_akm4xxx akm_delta44 = { .type = SND_AK4524, .num_adcs = 4, .num_dacs = 4, @@ -554,7 +554,7 @@ static const struct snd_ak4xxx_private akm_delta44_priv = { .mask_flags = 0, }; -static struct snd_akm4xxx akm_vx442 = { +static const struct snd_akm4xxx akm_vx442 = { .type = SND_AK4524, .num_adcs = 4, .num_dacs = 4, diff --git a/sound/pci/ice1712/ews.c b/sound/pci/ice1712/ews.c index 5bc14e8806a7..b8af747ecb43 100644 --- a/sound/pci/ice1712/ews.c +++ b/sound/pci/ice1712/ews.c @@ -344,7 +344,7 @@ static void ews88_setup_spdif(struct snd_ice1712 *ice, int rate) /* */ -static struct snd_akm4xxx akm_ews88mt = { +static const struct snd_akm4xxx akm_ews88mt = { .num_adcs = 8, .num_dacs = 8, .type = SND_AK4524, @@ -366,7 +366,7 @@ static const struct snd_ak4xxx_private akm_ews88mt_priv = { .mask_flags = 0, }; -static struct snd_akm4xxx akm_ewx2496 = { +static const struct snd_akm4xxx akm_ewx2496 = { .num_adcs = 2, .num_dacs = 2, .type = SND_AK4524, @@ -387,7 +387,7 @@ static const struct snd_ak4xxx_private akm_ewx2496_priv = { .mask_flags = 0, }; -static struct snd_akm4xxx akm_6fire = { +static const struct snd_akm4xxx akm_6fire = { .num_adcs = 6, .num_dacs = 6, .type = SND_AK4524, diff --git a/sound/pci/ice1712/hoontech.c b/sound/pci/ice1712/hoontech.c index de2fcc9a983e..f37ed0bc203d 100644 --- a/sound/pci/ice1712/hoontech.c +++ b/sound/pci/ice1712/hoontech.c @@ -269,7 +269,7 @@ static void stdsp24_ak4524_lock(struct snd_akm4xxx *ak, int chip) static int snd_ice1712_value_init(struct snd_ice1712 *ice) { /* Hoontech STDSP24 with modified hardware */ - static struct snd_akm4xxx akm_stdsp24_mv = { + static const struct snd_akm4xxx akm_stdsp24_mv = { .num_adcs = 2, .num_dacs = 2, .type = SND_AK4524, diff --git a/sound/pci/ice1712/juli.c b/sound/pci/ice1712/juli.c index 5bb146703738..0dbaccf61f33 100644 --- a/sound/pci/ice1712/juli.c +++ b/sound/pci/ice1712/juli.c @@ -282,7 +282,7 @@ static const struct snd_akm4xxx_dac_channel juli_dac[] = { }; -static struct snd_akm4xxx akm_juli_dac = { +static const struct snd_akm4xxx akm_juli_dac = { .type = SND_AK4358, .num_dacs = 8, /* DAC1 - analog out DAC2 - analog in monitor diff --git a/sound/pci/ice1712/phase.c b/sound/pci/ice1712/phase.c index 4f85482f3407..67fbb28bf033 100644 --- a/sound/pci/ice1712/phase.c +++ b/sound/pci/ice1712/phase.c @@ -102,7 +102,7 @@ static const unsigned char wm_vol[256] = { #define WM_VOL_MAX (sizeof(wm_vol) - 1) #define WM_VOL_MUTE 0x8000 -static struct snd_akm4xxx akm_phase22 = { +static const struct snd_akm4xxx akm_phase22 = { .type = SND_AK4524, .num_dacs = 2, .num_adcs = 2, diff --git a/sound/pci/ice1712/quartet.c b/sound/pci/ice1712/quartet.c index f1b3732cc6d2..d145b5eb7ff8 100644 --- a/sound/pci/ice1712/quartet.c +++ b/sound/pci/ice1712/quartet.c @@ -386,7 +386,7 @@ static const struct snd_akm4xxx_adc_channel qtet_adc[] = { AK_CONTROL(PCM_34_CAPTURE_VOLUME, 2), }; -static struct snd_akm4xxx akm_qtet_dac = { +static const struct snd_akm4xxx akm_qtet_dac = { .type = SND_AK4620, .num_dacs = 4, /* DAC1 - Output 12 */ diff --git a/sound/pci/ice1712/revo.c b/sound/pci/ice1712/revo.c index 5cc4213fcad0..6669c389f336 100644 --- a/sound/pci/ice1712/revo.c +++ b/sound/pci/ice1712/revo.c @@ -235,7 +235,7 @@ static const struct snd_akm4xxx_adc_channel revo51_adc[] = { }, }; -static struct snd_akm4xxx akm_revo_front = { +static const struct snd_akm4xxx akm_revo_front = { .type = SND_AK4381, .num_dacs = 2, .ops = { @@ -256,7 +256,7 @@ static const struct snd_ak4xxx_private akm_revo_front_priv = { .mask_flags = 0, }; -static struct snd_akm4xxx akm_revo_surround = { +static const struct snd_akm4xxx akm_revo_surround = { .type = SND_AK4355, .idx_offset = 1, .num_dacs = 6, @@ -278,7 +278,7 @@ static const struct snd_ak4xxx_private akm_revo_surround_priv = { .mask_flags = 0, }; -static struct snd_akm4xxx akm_revo51 = { +static const struct snd_akm4xxx akm_revo51 = { .type = SND_AK4358, .num_dacs = 8, .ops = { @@ -299,7 +299,7 @@ static const struct snd_ak4xxx_private akm_revo51_priv = { .mask_flags = 0, }; -static struct snd_akm4xxx akm_revo51_adc = { +static const struct snd_akm4xxx akm_revo51_adc = { .type = SND_AK5365, .num_adcs = 2, .adc_info = revo51_adc, @@ -346,7 +346,7 @@ static const struct snd_akm4xxx_dac_channel ap192_dac[] = { AK_DAC("PCM Playback Volume", 2) }; -static struct snd_akm4xxx akm_ap192 = { +static const struct snd_akm4xxx akm_ap192 = { .type = SND_AK4358, .num_dacs = 2, .ops = { -- cgit From 2357f6f00098a437f9de084c3c34254d20dea789 Mon Sep 17 00:00:00 2001 From: Guneshwor Singh Date: Sat, 5 Aug 2017 14:05:46 +0530 Subject: ALSA: hda: Add Cannonlake PCI ID Cannonlake is next generation Intel platform. This commit adds PCI ID for it. Signed-off-by: Guneshwor Singh Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_intel.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sound/pci') diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 5ae8ddab6412..f958d8d54d15 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -2389,6 +2389,9 @@ static const struct pci_device_id azx_ids[] = { /* Coffelake */ { PCI_DEVICE(0x8086, 0xa348), .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, + /* Cannonlake */ + { PCI_DEVICE(0x8086, 0x9dc8), + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, /* Broxton-P(Apollolake) */ { PCI_DEVICE(0x8086, 0x5a98), .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_BROXTON }, -- cgit From 844f88edf9dd6ef84599abe6909e1e19b6bfaeda Mon Sep 17 00:00:00 2001 From: Arvind Yadav Date: Thu, 10 Aug 2017 17:17:32 +0530 Subject: ALSA: ali5451: constify snd_pcm_ops structures snd_pcm_ops are not supposed to change at runtime. All functions working with snd_pcm_ops provided by work with const snd_pcm_ops. So mark the non-const structs as const. Signed-off-by: Arvind Yadav Signed-off-by: Takashi Iwai --- sound/pci/ali5451/ali5451.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c index 8567f1e5b9cf..39547e32e584 100644 --- a/sound/pci/ali5451/ali5451.c +++ b/sound/pci/ali5451/ali5451.c @@ -1540,7 +1540,7 @@ static int snd_ali_close(struct snd_pcm_substream *substream) return 0; } -static struct snd_pcm_ops snd_ali_playback_ops = { +static const struct snd_pcm_ops snd_ali_playback_ops = { .open = snd_ali_playback_open, .close = snd_ali_playback_close, .ioctl = snd_pcm_lib_ioctl, @@ -1551,7 +1551,7 @@ static struct snd_pcm_ops snd_ali_playback_ops = { .pointer = snd_ali_playback_pointer, }; -static struct snd_pcm_ops snd_ali_capture_ops = { +static const struct snd_pcm_ops snd_ali_capture_ops = { .open = snd_ali_capture_open, .close = snd_ali_close, .ioctl = snd_pcm_lib_ioctl, @@ -1626,7 +1626,7 @@ static int snd_ali_modem_capture_open(struct snd_pcm_substream *substream) return snd_ali_modem_open(substream, 1, ALI_MODEM_IN_CHANNEL); } -static struct snd_pcm_ops snd_ali_modem_playback_ops = { +static const struct snd_pcm_ops snd_ali_modem_playback_ops = { .open = snd_ali_modem_playback_open, .close = snd_ali_close, .ioctl = snd_pcm_lib_ioctl, @@ -1637,7 +1637,7 @@ static struct snd_pcm_ops snd_ali_modem_playback_ops = { .pointer = snd_ali_pointer, }; -static struct snd_pcm_ops snd_ali_modem_capture_ops = { +static const struct snd_pcm_ops snd_ali_modem_capture_ops = { .open = snd_ali_modem_capture_open, .close = snd_ali_close, .ioctl = snd_pcm_lib_ioctl, @@ -1653,8 +1653,8 @@ struct ali_pcm_description { char *name; unsigned int playback_num; unsigned int capture_num; - struct snd_pcm_ops *playback_ops; - struct snd_pcm_ops *capture_ops; + const struct snd_pcm_ops *playback_ops; + const struct snd_pcm_ops *capture_ops; unsigned short class; }; -- cgit From 0b5b233915b6ea8042f9dbb725a94e185dada530 Mon Sep 17 00:00:00 2001 From: Arvind Yadav Date: Thu, 10 Aug 2017 17:17:33 +0530 Subject: ALSA: au88x0: constify snd_pcm_ops structures snd_pcm_ops are not supposed to change at runtime. All functions working with snd_pcm_ops provided by work with const snd_pcm_ops. So mark the non-const structs as const. Signed-off-by: Arvind Yadav Signed-off-by: Takashi Iwai --- sound/pci/au88x0/au88x0_pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound/pci') diff --git a/sound/pci/au88x0/au88x0_pcm.c b/sound/pci/au88x0/au88x0_pcm.c index 1aa97012451d..848eb3cb18a8 100644 --- a/sound/pci/au88x0/au88x0_pcm.c +++ b/sound/pci/au88x0/au88x0_pcm.c @@ -439,7 +439,7 @@ static snd_pcm_uframes_t snd_vortex_pcm_pointer(struct snd_pcm_substream *substr } /* operators */ -static struct snd_pcm_ops snd_vortex_playback_ops = { +static const struct snd_pcm_ops snd_vortex_playback_ops = { .open = snd_vortex_pcm_open, .close = snd_vortex_pcm_close, .ioctl = snd_pcm_lib_ioctl, -- cgit From afa04880f46bbf84a90ac508c752b7ed0d76f8be Mon Sep 17 00:00:00 2001 From: Arvind Yadav Date: Thu, 10 Aug 2017 17:17:34 +0530 Subject: ALSA: echoaudio: constify snd_pcm_ops structures snd_pcm_ops are not supposed to change at runtime. All functions working with snd_pcm_ops provided by work with const snd_pcm_ops. So mark the non-const structs as const. Signed-off-by: Arvind Yadav Signed-off-by: Takashi Iwai --- sound/pci/echoaudio/echoaudio.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c index d15ecf9febbf..7326695bca33 100644 --- a/sound/pci/echoaudio/echoaudio.c +++ b/sound/pci/echoaudio/echoaudio.c @@ -826,7 +826,7 @@ static snd_pcm_uframes_t pcm_pointer(struct snd_pcm_substream *substream) /* pcm *_ops structures */ -static struct snd_pcm_ops analog_playback_ops = { +static const struct snd_pcm_ops analog_playback_ops = { .open = pcm_analog_out_open, .close = pcm_close, .ioctl = snd_pcm_lib_ioctl, @@ -837,7 +837,7 @@ static struct snd_pcm_ops analog_playback_ops = { .pointer = pcm_pointer, .page = snd_pcm_sgbuf_ops_page, }; -static struct snd_pcm_ops analog_capture_ops = { +static const struct snd_pcm_ops analog_capture_ops = { .open = pcm_analog_in_open, .close = pcm_close, .ioctl = snd_pcm_lib_ioctl, @@ -850,7 +850,7 @@ static struct snd_pcm_ops analog_capture_ops = { }; #ifdef ECHOCARD_HAS_DIGITAL_IO #ifndef ECHOCARD_HAS_VMIXER -static struct snd_pcm_ops digital_playback_ops = { +static const struct snd_pcm_ops digital_playback_ops = { .open = pcm_digital_out_open, .close = pcm_close, .ioctl = snd_pcm_lib_ioctl, @@ -862,7 +862,7 @@ static struct snd_pcm_ops digital_playback_ops = { .page = snd_pcm_sgbuf_ops_page, }; #endif /* !ECHOCARD_HAS_VMIXER */ -static struct snd_pcm_ops digital_capture_ops = { +static const struct snd_pcm_ops digital_capture_ops = { .open = pcm_digital_in_open, .close = pcm_close, .ioctl = snd_pcm_lib_ioctl, -- cgit From 17e12921c51f5025e748ab84087900a7a5ecc919 Mon Sep 17 00:00:00 2001 From: Arvind Yadav Date: Thu, 10 Aug 2017 17:17:35 +0530 Subject: ALSA: intel8x0: constify snd_pcm_ops structures snd_pcm_ops are not supposed to change at runtime. All functions working with snd_pcm_ops provided by work with const snd_pcm_ops. So mark the non-const structs as const. Signed-off-by: Arvind Yadav Signed-off-by: Takashi Iwai --- sound/pci/intel8x0.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index a8d7092e93dd..fcd032e3882d 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -1367,7 +1367,7 @@ static int snd_intel8x0_ali_spdifout_close(struct snd_pcm_substream *substream) } #endif -static struct snd_pcm_ops snd_intel8x0_playback_ops = { +static const struct snd_pcm_ops snd_intel8x0_playback_ops = { .open = snd_intel8x0_playback_open, .close = snd_intel8x0_playback_close, .ioctl = snd_pcm_lib_ioctl, @@ -1378,7 +1378,7 @@ static struct snd_pcm_ops snd_intel8x0_playback_ops = { .pointer = snd_intel8x0_pcm_pointer, }; -static struct snd_pcm_ops snd_intel8x0_capture_ops = { +static const struct snd_pcm_ops snd_intel8x0_capture_ops = { .open = snd_intel8x0_capture_open, .close = snd_intel8x0_capture_close, .ioctl = snd_pcm_lib_ioctl, @@ -1389,7 +1389,7 @@ static struct snd_pcm_ops snd_intel8x0_capture_ops = { .pointer = snd_intel8x0_pcm_pointer, }; -static struct snd_pcm_ops snd_intel8x0_capture_mic_ops = { +static const struct snd_pcm_ops snd_intel8x0_capture_mic_ops = { .open = snd_intel8x0_mic_open, .close = snd_intel8x0_mic_close, .ioctl = snd_pcm_lib_ioctl, @@ -1400,7 +1400,7 @@ static struct snd_pcm_ops snd_intel8x0_capture_mic_ops = { .pointer = snd_intel8x0_pcm_pointer, }; -static struct snd_pcm_ops snd_intel8x0_capture_mic2_ops = { +static const struct snd_pcm_ops snd_intel8x0_capture_mic2_ops = { .open = snd_intel8x0_mic2_open, .close = snd_intel8x0_mic2_close, .ioctl = snd_pcm_lib_ioctl, @@ -1411,7 +1411,7 @@ static struct snd_pcm_ops snd_intel8x0_capture_mic2_ops = { .pointer = snd_intel8x0_pcm_pointer, }; -static struct snd_pcm_ops snd_intel8x0_capture2_ops = { +static const struct snd_pcm_ops snd_intel8x0_capture2_ops = { .open = snd_intel8x0_capture2_open, .close = snd_intel8x0_capture2_close, .ioctl = snd_pcm_lib_ioctl, @@ -1422,7 +1422,7 @@ static struct snd_pcm_ops snd_intel8x0_capture2_ops = { .pointer = snd_intel8x0_pcm_pointer, }; -static struct snd_pcm_ops snd_intel8x0_spdif_ops = { +static const struct snd_pcm_ops snd_intel8x0_spdif_ops = { .open = snd_intel8x0_spdif_open, .close = snd_intel8x0_spdif_close, .ioctl = snd_pcm_lib_ioctl, @@ -1433,7 +1433,7 @@ static struct snd_pcm_ops snd_intel8x0_spdif_ops = { .pointer = snd_intel8x0_pcm_pointer, }; -static struct snd_pcm_ops snd_intel8x0_ali_playback_ops = { +static const struct snd_pcm_ops snd_intel8x0_ali_playback_ops = { .open = snd_intel8x0_playback_open, .close = snd_intel8x0_playback_close, .ioctl = snd_pcm_lib_ioctl, @@ -1444,7 +1444,7 @@ static struct snd_pcm_ops snd_intel8x0_ali_playback_ops = { .pointer = snd_intel8x0_pcm_pointer, }; -static struct snd_pcm_ops snd_intel8x0_ali_capture_ops = { +static const struct snd_pcm_ops snd_intel8x0_ali_capture_ops = { .open = snd_intel8x0_capture_open, .close = snd_intel8x0_capture_close, .ioctl = snd_pcm_lib_ioctl, @@ -1455,7 +1455,7 @@ static struct snd_pcm_ops snd_intel8x0_ali_capture_ops = { .pointer = snd_intel8x0_pcm_pointer, }; -static struct snd_pcm_ops snd_intel8x0_ali_capture_mic_ops = { +static const struct snd_pcm_ops snd_intel8x0_ali_capture_mic_ops = { .open = snd_intel8x0_mic_open, .close = snd_intel8x0_mic_close, .ioctl = snd_pcm_lib_ioctl, @@ -1466,7 +1466,7 @@ static struct snd_pcm_ops snd_intel8x0_ali_capture_mic_ops = { .pointer = snd_intel8x0_pcm_pointer, }; -static struct snd_pcm_ops snd_intel8x0_ali_ac97spdifout_ops = { +static const struct snd_pcm_ops snd_intel8x0_ali_ac97spdifout_ops = { .open = snd_intel8x0_ali_ac97spdifout_open, .close = snd_intel8x0_ali_ac97spdifout_close, .ioctl = snd_pcm_lib_ioctl, @@ -1503,8 +1503,8 @@ static struct snd_pcm_ops snd_intel8x0_ali_spdifout_ops = { struct ich_pcm_table { char *suffix; - struct snd_pcm_ops *playback_ops; - struct snd_pcm_ops *capture_ops; + const struct snd_pcm_ops *playback_ops; + const struct snd_pcm_ops *capture_ops; size_t prealloc_size; size_t prealloc_max_size; int ac97_idx; -- cgit From c06aab337e59fd7e75c14660c60a9773885ecb3b Mon Sep 17 00:00:00 2001 From: Arvind Yadav Date: Thu, 10 Aug 2017 17:17:36 +0530 Subject: ALSA: intel8x0m: constify snd_pcm_ops structures snd_pcm_ops are not supposed to change at runtime. All functions working with snd_pcm_ops provided by work with const snd_pcm_ops. So mark the non-const structs as const. Signed-off-by: Arvind Yadav Signed-off-by: Takashi Iwai --- sound/pci/intel8x0m.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c index 18ff668ce7a5..2f1b878fadbb 100644 --- a/sound/pci/intel8x0m.c +++ b/sound/pci/intel8x0m.c @@ -685,7 +685,7 @@ static int snd_intel8x0m_capture_close(struct snd_pcm_substream *substream) } -static struct snd_pcm_ops snd_intel8x0m_playback_ops = { +static const struct snd_pcm_ops snd_intel8x0m_playback_ops = { .open = snd_intel8x0m_playback_open, .close = snd_intel8x0m_playback_close, .ioctl = snd_pcm_lib_ioctl, @@ -696,7 +696,7 @@ static struct snd_pcm_ops snd_intel8x0m_playback_ops = { .pointer = snd_intel8x0m_pcm_pointer, }; -static struct snd_pcm_ops snd_intel8x0m_capture_ops = { +static const struct snd_pcm_ops snd_intel8x0m_capture_ops = { .open = snd_intel8x0m_capture_open, .close = snd_intel8x0m_capture_close, .ioctl = snd_pcm_lib_ioctl, @@ -710,8 +710,8 @@ static struct snd_pcm_ops snd_intel8x0m_capture_ops = { struct ich_pcm_table { char *suffix; - struct snd_pcm_ops *playback_ops; - struct snd_pcm_ops *capture_ops; + const struct snd_pcm_ops *playback_ops; + const struct snd_pcm_ops *capture_ops; size_t prealloc_size; size_t prealloc_max_size; int ac97_idx; -- cgit From 2aa0eae9702ede2af21191bce8c5848eea3306e4 Mon Sep 17 00:00:00 2001 From: Arvind Yadav Date: Thu, 10 Aug 2017 17:17:37 +0530 Subject: ALSA: sis7019: constify snd_pcm_ops structures snd_pcm_ops are not supposed to change at runtime. All functions working with snd_pcm_ops provided by work with const snd_pcm_ops. So mark the non-const structs as const. Signed-off-by: Arvind Yadav Signed-off-by: Takashi Iwai --- sound/pci/sis7019.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c index f3860b850210..35188872d313 100644 --- a/sound/pci/sis7019.c +++ b/sound/pci/sis7019.c @@ -872,7 +872,7 @@ static int sis_pcm_capture_prepare(struct snd_pcm_substream *substream) return 0; } -static struct snd_pcm_ops sis_playback_ops = { +static const struct snd_pcm_ops sis_playback_ops = { .open = sis_playback_open, .close = sis_substream_close, .ioctl = snd_pcm_lib_ioctl, @@ -883,7 +883,7 @@ static struct snd_pcm_ops sis_playback_ops = { .pointer = sis_pcm_pointer, }; -static struct snd_pcm_ops sis_capture_ops = { +static const struct snd_pcm_ops sis_capture_ops = { .open = sis_capture_open, .close = sis_substream_close, .ioctl = snd_pcm_lib_ioctl, -- cgit From 841c1ea0d8f813029c821044d3e899d5eb93400a Mon Sep 17 00:00:00 2001 From: Arvind Yadav Date: Thu, 10 Aug 2017 17:17:38 +0530 Subject: ALSA: trident: constify snd_pcm_ops structures snd_pcm_ops are not supposed to change at runtime. All functions working with snd_pcm_ops provided by work with const snd_pcm_ops. So mark the non-const structs as const. Signed-off-by: Arvind Yadav Signed-off-by: Takashi Iwai --- sound/pci/trident/trident_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c index 64d3b8eba4bb..4561040520c2 100644 --- a/sound/pci/trident/trident_main.c +++ b/sound/pci/trident/trident_main.c @@ -2093,7 +2093,7 @@ static const struct snd_pcm_ops snd_trident_nx_playback_ops = { .page = snd_pcm_sgbuf_ops_page, }; -static struct snd_pcm_ops snd_trident_capture_ops = { +static const struct snd_pcm_ops snd_trident_capture_ops = { .open = snd_trident_capture_open, .close = snd_trident_capture_close, .ioctl = snd_trident_ioctl, @@ -2104,7 +2104,7 @@ static struct snd_pcm_ops snd_trident_capture_ops = { .pointer = snd_trident_capture_pointer, }; -static struct snd_pcm_ops snd_trident_si7018_capture_ops = { +static const struct snd_pcm_ops snd_trident_si7018_capture_ops = { .open = snd_trident_capture_open, .close = snd_trident_capture_close, .ioctl = snd_trident_ioctl, -- cgit From aef7758ff4ffcf9d7a03779f877228871efae4c0 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Sat, 12 Aug 2017 13:20:16 +0200 Subject: ALSA: trident: Delete an error message for a failed memory allocation in snd_trident_tlb_alloc() Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring Signed-off-by: Takashi Iwai --- sound/pci/trident/trident_main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c index 4561040520c2..d9bb6dd9f227 100644 --- a/sound/pci/trident/trident_main.c +++ b/sound/pci/trident/trident_main.c @@ -3363,11 +3363,9 @@ static int snd_trident_tlb_alloc(struct snd_trident *trident) trident->tlb.entries_dmaaddr = ALIGN(trident->tlb.buffer.addr, SNDRV_TRIDENT_MAX_PAGES * 4); /* allocate shadow TLB page table (virtual addresses) */ trident->tlb.shadow_entries = vmalloc(SNDRV_TRIDENT_MAX_PAGES*sizeof(unsigned long)); - if (trident->tlb.shadow_entries == NULL) { - dev_err(trident->card->dev, - "unable to allocate shadow TLB entries\n"); + if (!trident->tlb.shadow_entries) return -ENOMEM; - } + /* allocate and setup silent page and initialise TLB entries */ if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(trident->pci), SNDRV_TRIDENT_PAGE_SIZE, &trident->tlb.silent_page) < 0) { -- cgit From 1b2ff0c0c4803faa530cc1744cb0760f0703b416 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Sat, 12 Aug 2017 14:24:41 +0200 Subject: ALSA: rme96: Delete two error messages for a failed memory allocation in snd_rme96_probe() Omit extra messages for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring Signed-off-by: Takashi Iwai --- sound/pci/rme96.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c index 2e19ba55e754..82e8c78e48ca 100644 --- a/sound/pci/rme96.c +++ b/sound/pci/rme96.c @@ -2489,15 +2489,11 @@ snd_rme96_probe(struct pci_dev *pci, #ifdef CONFIG_PM_SLEEP rme96->playback_suspend_buffer = vmalloc(RME96_BUFFER_SIZE); if (!rme96->playback_suspend_buffer) { - dev_err(card->dev, - "Failed to allocate playback suspend buffer!\n"); snd_card_free(card); return -ENOMEM; } rme96->capture_suspend_buffer = vmalloc(RME96_BUFFER_SIZE); if (!rme96->capture_suspend_buffer) { - dev_err(card->dev, - "Failed to allocate capture suspend buffer!\n"); snd_card_free(card); return -ENOMEM; } -- cgit From d72a8010ae60551ad14f1385e637be101cf741b5 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Sat, 12 Aug 2017 14:50:33 +0200 Subject: ALSA: rme96: Use common error handling code in snd_rme96_probe() Add a jump target so that a bit of exception handling can be better reused at the end of this function. Signed-off-by: Markus Elfring Signed-off-by: Takashi Iwai --- sound/pci/rme96.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c index 82e8c78e48ca..0cdfd53b7796 100644 --- a/sound/pci/rme96.c +++ b/sound/pci/rme96.c @@ -2481,21 +2481,20 @@ snd_rme96_probe(struct pci_dev *pci, rme96 = card->private_data; rme96->card = card; rme96->pci = pci; - if ((err = snd_rme96_create(rme96)) < 0) { - snd_card_free(card); - return err; - } + err = snd_rme96_create(rme96); + if (err) + goto free_card; #ifdef CONFIG_PM_SLEEP rme96->playback_suspend_buffer = vmalloc(RME96_BUFFER_SIZE); if (!rme96->playback_suspend_buffer) { - snd_card_free(card); - return -ENOMEM; + err = -ENOMEM; + goto free_card; } rme96->capture_suspend_buffer = vmalloc(RME96_BUFFER_SIZE); if (!rme96->capture_suspend_buffer) { - snd_card_free(card); - return -ENOMEM; + err = -ENOMEM; + goto free_card; } #endif @@ -2521,14 +2520,16 @@ snd_rme96_probe(struct pci_dev *pci, } sprintf(card->longname, "%s at 0x%lx, irq %d", card->shortname, rme96->port, rme96->irq); - - if ((err = snd_card_register(card)) < 0) { - snd_card_free(card); - return err; - } + err = snd_card_register(card); + if (err) + goto free_card; + pci_set_drvdata(pci, card); dev++; return 0; +free_card: + snd_card_free(card); + return err; } static void snd_rme96_remove(struct pci_dev *pci) -- cgit From 2cb98d010fdc7a545856baf32bce096fa431d250 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Sat, 12 Aug 2017 15:18:56 +0200 Subject: ALSA: rme96: Adjust five checks for null pointers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The script “checkpatch.pl” pointed information out like the following. Comparison to NULL could be written … Thus fix the affected source code places. Signed-off-by: Markus Elfring Signed-off-by: Takashi Iwai --- sound/pci/rme96.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c index 0cdfd53b7796..b488d74c3b99 100644 --- a/sound/pci/rme96.c +++ b/sound/pci/rme96.c @@ -1199,7 +1199,7 @@ snd_rme96_playback_spdif_open(struct snd_pcm_substream *substream) snd_pcm_set_sync(substream); spin_lock_irq(&rme96->lock); - if (rme96->playback_substream != NULL) { + if (rme96->playback_substream) { spin_unlock_irq(&rme96->lock); return -EBUSY; } @@ -1248,7 +1248,7 @@ snd_rme96_capture_spdif_open(struct snd_pcm_substream *substream) } spin_lock_irq(&rme96->lock); - if (rme96->capture_substream != NULL) { + if (rme96->capture_substream) { spin_unlock_irq(&rme96->lock); return -EBUSY; } @@ -1268,7 +1268,7 @@ snd_rme96_playback_adat_open(struct snd_pcm_substream *substream) snd_pcm_set_sync(substream); spin_lock_irq(&rme96->lock); - if (rme96->playback_substream != NULL) { + if (rme96->playback_substream) { spin_unlock_irq(&rme96->lock); return -EBUSY; } @@ -1315,7 +1315,7 @@ snd_rme96_capture_adat_open(struct snd_pcm_substream *substream) } spin_lock_irq(&rme96->lock); - if (rme96->capture_substream != NULL) { + if (rme96->capture_substream) { spin_unlock_irq(&rme96->lock); return -EBUSY; } @@ -1578,9 +1578,9 @@ snd_rme96_free(void *private_data) { struct rme96 *rme96 = (struct rme96 *)private_data; - if (rme96 == NULL) { + if (!rme96) return; - } + if (rme96->irq >= 0) { snd_rme96_trigger(rme96, RME96_STOP_BOTH); rme96->areg &= ~RME96_AR_DAC_EN; -- cgit From 9dba54296b8b4ae14053bfea82b171aeb9e16710 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Sat, 12 Aug 2017 16:10:32 +0200 Subject: ALSA: rme9652: Delete an error message for a failed memory allocation in snd_hdspm_create() Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring Signed-off-by: Takashi Iwai --- sound/pci/rme9652/hdspm.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 2a3a916e5d15..d448cf474c1b 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -6638,12 +6638,8 @@ static int snd_hdspm_create(struct snd_card *card, dev_dbg(card->dev, "kmalloc Mixer memory of %zd Bytes\n", sizeof(struct hdspm_mixer)); hdspm->mixer = kzalloc(sizeof(struct hdspm_mixer), GFP_KERNEL); - if (!hdspm->mixer) { - dev_err(card->dev, - "unable to kmalloc Mixer memory of %d Bytes\n", - (int)sizeof(struct hdspm_mixer)); + if (!hdspm->mixer) return -ENOMEM; - } hdspm->port_names_in = NULL; hdspm->port_names_out = NULL; -- cgit From 7dfec5075f23cdf114f530979bdf3c8dc232ea22 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Sat, 12 Aug 2017 16:50:06 +0200 Subject: ALSA: rme9652: Improve eight size determinations Replace the specification of data structures by variable references as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring Signed-off-by: Takashi Iwai --- sound/pci/rme9652/hdspm.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index d448cf474c1b..8d339fb7c24b 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -6221,7 +6221,7 @@ static int snd_hdspm_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, } levels->status2 = hdspm_read(hdspm, HDSPM_statusRegister2); - s = copy_to_user(argp, levels, sizeof(struct hdspm_peak_rms)); + s = copy_to_user(argp, levels, sizeof(*levels)); if (0 != s) { /* dev_err(hdspm->card->dev, "copy_to_user(.., .., %lu): %lu [Levels]\n", sizeof(struct hdspm_peak_rms), s); @@ -6266,7 +6266,7 @@ static int snd_hdspm_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, ltc.input_format = no_video; } - s = copy_to_user(argp, <c, sizeof(struct hdspm_ltc)); + s = copy_to_user(argp, <c, sizeof(ltc)); if (0 != s) { /* dev_err(hdspm->card->dev, "copy_to_user(.., .., %lu): %lu [LTC]\n", sizeof(struct hdspm_ltc), s); */ @@ -6357,7 +6357,7 @@ static int snd_hdspm_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, if (copy_from_user(&mixer, argp, sizeof(mixer))) return -EFAULT; if (copy_to_user((void __user *)mixer.mixer, hdspm->mixer, - sizeof(struct hdspm_mixer))) + sizeof(*mixer.mixer))) return -EFAULT; break; @@ -6636,8 +6636,8 @@ static int snd_hdspm_create(struct snd_card *card, hdspm->irq = pci->irq; dev_dbg(card->dev, "kmalloc Mixer memory of %zd Bytes\n", - sizeof(struct hdspm_mixer)); - hdspm->mixer = kzalloc(sizeof(struct hdspm_mixer), GFP_KERNEL); + sizeof(*hdspm->mixer)); + hdspm->mixer = kzalloc(sizeof(*hdspm->mixer), GFP_KERNEL); if (!hdspm->mixer) return -ENOMEM; @@ -6774,8 +6774,7 @@ static int snd_hdspm_create(struct snd_card *card, if (hdspm_read(hdspm, HDSPM_statusRegister2) & HDSPM_s2_tco_detect) { hdspm->midiPorts++; - hdspm->tco = kzalloc(sizeof(struct hdspm_tco), - GFP_KERNEL); + hdspm->tco = kzalloc(sizeof(*hdspm->tco), GFP_KERNEL); if (NULL != hdspm->tco) { hdspm_tco_write(hdspm); } @@ -6789,8 +6788,7 @@ static int snd_hdspm_create(struct snd_card *card, case AES32: if (hdspm_read(hdspm, HDSPM_statusRegister) & HDSPM_tco_detect) { hdspm->midiPorts++; - hdspm->tco = kzalloc(sizeof(struct hdspm_tco), - GFP_KERNEL); + hdspm->tco = kzalloc(sizeof(*hdspm->tco), GFP_KERNEL); if (NULL != hdspm->tco) { hdspm_tco_write(hdspm); } @@ -6941,7 +6939,7 @@ static int snd_hdspm_probe(struct pci_dev *pci, } err = snd_card_new(&pci->dev, index[dev], id[dev], - THIS_MODULE, sizeof(struct hdspm), &card); + THIS_MODULE, sizeof(*hdspm), &card); if (err < 0) return err; -- cgit From da2ea374b28aa6e6e5621396e0ae58580fe94af8 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Sat, 12 Aug 2017 17:07:09 +0200 Subject: ALSA: rme9652: Adjust seven checks for null pointers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The script “checkpatch.pl” pointed information out like the following. Comparison to NULL could be written … Thus fix the affected source code places. Signed-off-by: Markus Elfring Signed-off-by: Takashi Iwai --- sound/pci/rme9652/hdspm.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 8d339fb7c24b..25284d8d9758 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -1521,7 +1521,7 @@ static void hdspm_silence_playback(struct hdspm *hdspm) int n = hdspm->period_bytes; void *buf = hdspm->playback_buffer; - if (buf == NULL) + if (!buf) return; for (i = 0; i < HDSPM_MAX_CHANNELS; i++) { @@ -4706,7 +4706,7 @@ static int snd_hdspm_create_controls(struct snd_card *card, break; } - if (NULL != list) { + if (list) { for (idx = 0; idx < limit; idx++) { err = snd_ctl_add(card, snd_ctl_new1(&list[idx], hdspm)); @@ -6069,13 +6069,13 @@ static int snd_hdspm_open(struct snd_pcm_substream *substream) snd_hdspm_capture_subinfo; if (playback) { - if (hdspm->capture_substream == NULL) + if (!hdspm->capture_substream) hdspm_stop_audio(hdspm); hdspm->playback_pid = current->pid; hdspm->playback_substream = substream; } else { - if (hdspm->playback_substream == NULL) + if (!hdspm->playback_substream) hdspm_stop_audio(hdspm); hdspm->capture_pid = current->pid; @@ -6775,9 +6775,9 @@ static int snd_hdspm_create(struct snd_card *card, HDSPM_s2_tco_detect) { hdspm->midiPorts++; hdspm->tco = kzalloc(sizeof(*hdspm->tco), GFP_KERNEL); - if (NULL != hdspm->tco) { + if (hdspm->tco) hdspm_tco_write(hdspm); - } + dev_info(card->dev, "AIO/RayDAT TCO module found\n"); } else { hdspm->tco = NULL; @@ -6789,9 +6789,9 @@ static int snd_hdspm_create(struct snd_card *card, if (hdspm_read(hdspm, HDSPM_statusRegister) & HDSPM_tco_detect) { hdspm->midiPorts++; hdspm->tco = kzalloc(sizeof(*hdspm->tco), GFP_KERNEL); - if (NULL != hdspm->tco) { + if (hdspm->tco) hdspm_tco_write(hdspm); - } + dev_info(card->dev, "MADI/AES TCO module found\n"); } else { hdspm->tco = NULL; @@ -6868,7 +6868,7 @@ static int snd_hdspm_create(struct snd_card *card, * this case, we don't set card->id to avoid collisions * when running with multiple cards. */ - if (NULL == id[hdspm->dev] && hdspm->serial != 0xFFFFFF) { + if (!id[hdspm->dev] && hdspm->serial != 0xFFFFFF) { snprintf(card->id, sizeof(card->id), "HDSPMx%06x", hdspm->serial); snd_card_set_id(card, card->id); -- cgit From 343fd50561e13f1efb5ba72cc16ab12dcaf07df5 Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Sat, 12 Aug 2017 21:01:13 +0530 Subject: ALSA: aw2: make snd_pcm_hardware const Make these const as they are only used during a copy operation. Done using Coccinelle. Signed-off-by: Bhumika Goyal Signed-off-by: Takashi Iwai --- sound/pci/aw2/aw2-alsa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/aw2/aw2-alsa.c b/sound/pci/aw2/aw2-alsa.c index 8356180bfe0e..9a49e4243a9c 100644 --- a/sound/pci/aw2/aw2-alsa.c +++ b/sound/pci/aw2/aw2-alsa.c @@ -52,7 +52,7 @@ MODULE_LICENSE("GPL"); * TYPEDEFS ********************************/ /* hardware definition */ -static struct snd_pcm_hardware snd_aw2_playback_hw = { +static const struct snd_pcm_hardware snd_aw2_playback_hw = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_MMAP_VALID), @@ -69,7 +69,7 @@ static struct snd_pcm_hardware snd_aw2_playback_hw = { .periods_max = 1024, }; -static struct snd_pcm_hardware snd_aw2_capture_hw = { +static const struct snd_pcm_hardware snd_aw2_capture_hw = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_MMAP_VALID), -- cgit From d1876fe679cbfdfdcc3e7f84b779c99c919ef3f6 Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Sat, 12 Aug 2017 21:01:14 +0530 Subject: ALSA: ca0106: make snd_pcm_hardware const Make these const as they are only used during a copy operation. Done using Coccinelle. Signed-off-by: Bhumika Goyal Signed-off-by: Takashi Iwai --- sound/pci/ca0106/ca0106_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c index 6165a57a94ae..2be30b8b6bc9 100644 --- a/sound/pci/ca0106/ca0106_main.c +++ b/sound/pci/ca0106/ca0106_main.c @@ -296,7 +296,7 @@ static struct snd_ca0106_details ca0106_chip_details[] = { }; /* hardware definition */ -static struct snd_pcm_hardware snd_ca0106_playback_hw = { +static const struct snd_pcm_hardware snd_ca0106_playback_hw = { .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | @@ -317,7 +317,7 @@ static struct snd_pcm_hardware snd_ca0106_playback_hw = { .fifo_size = 0, }; -static struct snd_pcm_hardware snd_ca0106_capture_hw = { +static const struct snd_pcm_hardware snd_ca0106_capture_hw = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | -- cgit From 114d35496f2ba82ca5d4c39f76fac96330f72965 Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Sat, 12 Aug 2017 21:01:15 +0530 Subject: ALSA: cs46xx: make snd_pcm_hardware const Make these const as they are only used during a copy operation. Done using Coccinelle. Signed-off-by: Bhumika Goyal Signed-off-by: Takashi Iwai --- sound/pci/cs46xx/cs46xx_lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c index 709fb1a503b7..0020fd0efc46 100644 --- a/sound/pci/cs46xx/cs46xx_lib.c +++ b/sound/pci/cs46xx/cs46xx_lib.c @@ -1438,7 +1438,7 @@ static irqreturn_t snd_cs46xx_interrupt(int irq, void *dev_id) return IRQ_HANDLED; } -static struct snd_pcm_hardware snd_cs46xx_playback = +static const struct snd_pcm_hardware snd_cs46xx_playback = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | @@ -1460,7 +1460,7 @@ static struct snd_pcm_hardware snd_cs46xx_playback = .fifo_size = 0, }; -static struct snd_pcm_hardware snd_cs46xx_capture = +static const struct snd_pcm_hardware snd_cs46xx_capture = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | -- cgit From 5875adc2a77021874249009011d01ceae31b139a Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Sat, 12 Aug 2017 21:01:16 +0530 Subject: ALSA: korg1212: make snd_pcm_hardware const Make these const as they are only used during a copy operation. Done using Coccinelle. Signed-off-by: Bhumika Goyal Signed-off-by: Takashi Iwai --- sound/pci/korg1212/korg1212.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c index b28fe4914d6b..04cd71c74e5c 100644 --- a/sound/pci/korg1212/korg1212.c +++ b/sound/pci/korg1212/korg1212.c @@ -1231,7 +1231,7 @@ static int snd_korg1212_downloadDSPCode(struct snd_korg1212 *korg1212) return 0; } -static struct snd_pcm_hardware snd_korg1212_playback_info = +static const struct snd_pcm_hardware snd_korg1212_playback_info = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | @@ -1252,7 +1252,7 @@ static struct snd_pcm_hardware snd_korg1212_playback_info = .fifo_size = 0, }; -static struct snd_pcm_hardware snd_korg1212_capture_info = +static const struct snd_pcm_hardware snd_korg1212_capture_info = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | -- cgit From d670315c4f08cf3f380d249c64b88171bd33a348 Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Sat, 12 Aug 2017 21:01:17 +0530 Subject: ALSA: cs5535audio: make snd_pcm_hardware const Make these const as they are only used during a copy operation. Done using Coccinelle. Signed-off-by: Bhumika Goyal Signed-off-by: Takashi Iwai --- sound/pci/cs5535audio/cs5535audio_pcm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/cs5535audio/cs5535audio_pcm.c b/sound/pci/cs5535audio/cs5535audio_pcm.c index c208c1d8dbb2..ee7065f6e162 100644 --- a/sound/pci/cs5535audio/cs5535audio_pcm.c +++ b/sound/pci/cs5535audio/cs5535audio_pcm.c @@ -33,7 +33,7 @@ #include #include "cs5535audio.h" -static struct snd_pcm_hardware snd_cs5535audio_playback = +static const struct snd_pcm_hardware snd_cs5535audio_playback = { .info = ( SNDRV_PCM_INFO_MMAP | @@ -62,7 +62,7 @@ static struct snd_pcm_hardware snd_cs5535audio_playback = .fifo_size = 0, }; -static struct snd_pcm_hardware snd_cs5535audio_capture = +static const struct snd_pcm_hardware snd_cs5535audio_capture = { .info = ( SNDRV_PCM_INFO_MMAP | -- cgit From 7c0ddf06d2432a4502aab100b4a306a47d7a60d3 Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Sat, 12 Aug 2017 21:01:18 +0530 Subject: ALSA: emu10k1: make snd_pcm_hardware const Make these const as they are only used during a copy operation. Done using Coccinelle. Signed-off-by: Bhumika Goyal Signed-off-by: Takashi Iwai --- sound/pci/emu10k1/emu10k1x.c | 4 ++-- sound/pci/emu10k1/emupcm.c | 10 +++++----- sound/pci/emu10k1/p16v.c | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c index 77a4413f4564..2c2b12a06177 100644 --- a/sound/pci/emu10k1/emu10k1x.c +++ b/sound/pci/emu10k1/emu10k1x.c @@ -254,7 +254,7 @@ struct emu10k1x { }; /* hardware definition */ -static struct snd_pcm_hardware snd_emu10k1x_playback_hw = { +static const struct snd_pcm_hardware snd_emu10k1x_playback_hw = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | @@ -273,7 +273,7 @@ static struct snd_pcm_hardware snd_emu10k1x_playback_hw = { .fifo_size = 0, }; -static struct snd_pcm_hardware snd_emu10k1x_capture_hw = { +static const struct snd_pcm_hardware snd_emu10k1x_capture_hw = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c index 5c9054a9f69e..2683b9717215 100644 --- a/sound/pci/emu10k1/emupcm.c +++ b/sound/pci/emu10k1/emupcm.c @@ -556,7 +556,7 @@ static int snd_emu10k1_efx_playback_prepare(struct snd_pcm_substream *substream) return 0; } -static struct snd_pcm_hardware snd_emu10k1_efx_playback = +static const struct snd_pcm_hardware snd_emu10k1_efx_playback = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_NONINTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | @@ -975,7 +975,7 @@ static snd_pcm_uframes_t snd_emu10k1_capture_pointer(struct snd_pcm_substream *s * Playback support device description */ -static struct snd_pcm_hardware snd_emu10k1_playback = +static const struct snd_pcm_hardware snd_emu10k1_playback = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | @@ -999,7 +999,7 @@ static struct snd_pcm_hardware snd_emu10k1_playback = * Capture support device description */ -static struct snd_pcm_hardware snd_emu10k1_capture = +static const struct snd_pcm_hardware snd_emu10k1_capture = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | @@ -1019,7 +1019,7 @@ static struct snd_pcm_hardware snd_emu10k1_capture = .fifo_size = 0, }; -static struct snd_pcm_hardware snd_emu10k1_capture_efx = +static const struct snd_pcm_hardware snd_emu10k1_capture_efx = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | @@ -1742,7 +1742,7 @@ static snd_pcm_uframes_t snd_emu10k1_fx8010_playback_pointer(struct snd_pcm_subs return snd_pcm_indirect_playback_pointer(substream, &pcm->pcm_rec, ptr); } -static struct snd_pcm_hardware snd_emu10k1_fx8010_playback = +static const struct snd_pcm_hardware snd_emu10k1_fx8010_playback = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_RESUME | diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c index c11f1a29f35d..a30da78a95b7 100644 --- a/sound/pci/emu10k1/p16v.c +++ b/sound/pci/emu10k1/p16v.c @@ -122,7 +122,7 @@ */ /* hardware definition */ -static struct snd_pcm_hardware snd_p16v_playback_hw = { +static const struct snd_pcm_hardware snd_p16v_playback_hw = { .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | @@ -143,7 +143,7 @@ static struct snd_pcm_hardware snd_p16v_playback_hw = { .fifo_size = 0, }; -static struct snd_pcm_hardware snd_p16v_capture_hw = { +static const struct snd_pcm_hardware snd_p16v_capture_hw = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | -- cgit From 5cf84795d3e1b6795a717e7c858a12486ccf760f Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Sat, 12 Aug 2017 21:01:19 +0530 Subject: ALSA: lola: make snd_pcm_hardware const Make this const as it is only used during a copy operation. Done using Coccinelle. Signed-off-by: Bhumika Goyal Signed-off-by: Takashi Iwai --- sound/pci/lola/lola_pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound/pci') diff --git a/sound/pci/lola/lola_pcm.c b/sound/pci/lola/lola_pcm.c index 1268ba329016..310b26a756c9 100644 --- a/sound/pci/lola/lola_pcm.c +++ b/sound/pci/lola/lola_pcm.c @@ -197,7 +197,7 @@ static void lola_stream_reset(struct lola *chip, struct lola_stream *str) } } -static struct snd_pcm_hardware lola_pcm_hw = { +static const struct snd_pcm_hardware lola_pcm_hw = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | -- cgit From 033bb5676d5961371b8ec130ee9f9f9202ebd263 Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Sat, 12 Aug 2017 21:01:20 +0530 Subject: ALSA: lx6464es: make snd_pcm_hardware const Make this const as it is only used during a copy operation. Done using Coccinelle. Signed-off-by: Bhumika Goyal Signed-off-by: Takashi Iwai --- sound/pci/lx6464es/lx6464es.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound/pci') diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c index f9c3e86d55d5..9655b08a1c52 100644 --- a/sound/pci/lx6464es/lx6464es.c +++ b/sound/pci/lx6464es/lx6464es.c @@ -77,7 +77,7 @@ MODULE_DEVICE_TABLE(pci, snd_lx6464es_ids); /* alsa callbacks */ -static struct snd_pcm_hardware lx_caps = { +static const struct snd_pcm_hardware lx_caps = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP_VALID | -- cgit From 7d4edd425477a9b85c03d6623107465e8cecd938 Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Sat, 12 Aug 2017 21:01:21 +0530 Subject: ALSA: mixart: make snd_pcm_hardware const Make these const as they are only used during a copy operation. Done using Coccinelle. Signed-off-by: Bhumika Goyal Signed-off-by: Takashi Iwai --- sound/pci/mixart/mixart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c index 6d7fbf30618b..aca3b34b1bfe 100644 --- a/sound/pci/mixart/mixart.c +++ b/sound/pci/mixart/mixart.c @@ -675,7 +675,7 @@ static int snd_mixart_hw_free(struct snd_pcm_substream *subs) /* * TODO CONFIGURATION SPACE for all pcms, mono pcm must update channels_max */ -static struct snd_pcm_hardware snd_mixart_analog_caps = +static const struct snd_pcm_hardware snd_mixart_analog_caps = { .info = ( SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP_VALID | @@ -696,7 +696,7 @@ static struct snd_pcm_hardware snd_mixart_analog_caps = .periods_max = (32*1024/256), }; -static struct snd_pcm_hardware snd_mixart_digital_caps = +static const struct snd_pcm_hardware snd_mixart_digital_caps = { .info = ( SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP_VALID | -- cgit From 4f8f04e8bd53d77f32052b069e88c53267f09165 Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Sat, 12 Aug 2017 21:01:22 +0530 Subject: ALSA: ctxfi: make snd_pcm_hardware const Make these const as they are only used during a copy operation. Done using Coccinelle. Signed-off-by: Bhumika Goyal Signed-off-by: Takashi Iwai --- sound/pci/ctxfi/ctpcm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/ctxfi/ctpcm.c b/sound/pci/ctxfi/ctpcm.c index 974978041558..358f5206130a 100644 --- a/sound/pci/ctxfi/ctpcm.c +++ b/sound/pci/ctxfi/ctpcm.c @@ -21,7 +21,7 @@ #include /* Hardware descriptions for playback */ -static struct snd_pcm_hardware ct_pcm_playback_hw = { +static const struct snd_pcm_hardware ct_pcm_playback_hw = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | @@ -46,7 +46,7 @@ static struct snd_pcm_hardware ct_pcm_playback_hw = { .fifo_size = 0, }; -static struct snd_pcm_hardware ct_spdif_passthru_playback_hw = { +static const struct snd_pcm_hardware ct_spdif_passthru_playback_hw = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | @@ -69,7 +69,7 @@ static struct snd_pcm_hardware ct_spdif_passthru_playback_hw = { }; /* Hardware descriptions for capture */ -static struct snd_pcm_hardware ct_pcm_capture_hw = { +static const struct snd_pcm_hardware ct_pcm_capture_hw = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | -- cgit From ecc6a044eb62cad892de28d1ea80a5c6f11ff402 Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Sat, 12 Aug 2017 21:01:23 +0530 Subject: ALSA: pcxhr: make snd_pcm_hardware const Make this const as it is only used during a copy operation. Done using Coccinelle Signed-off-by: Bhumika Goyal Signed-off-by: Takashi Iwai --- sound/pci/pcxhr/pcxhr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound/pci') diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c index fa919f52e225..e6f9aa67cc6f 100644 --- a/sound/pci/pcxhr/pcxhr.c +++ b/sound/pci/pcxhr/pcxhr.c @@ -986,7 +986,7 @@ static int pcxhr_hw_free(struct snd_pcm_substream *subs) /* * CONFIGURATION SPACE for all pcms, mono pcm must update channels_max */ -static struct snd_pcm_hardware pcxhr_caps = +static const struct snd_pcm_hardware pcxhr_caps = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | -- cgit From 14ff46fd99077c3c15cbf38ab1795cbd0f16669e Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Sat, 12 Aug 2017 21:01:24 +0530 Subject: ALSA: riptide: make snd_pcm_hardware const Make these const as they are only used during a copy operation. Done using Coccinelle. Signed-off-by: Bhumika Goyal Signed-off-by: Takashi Iwai --- sound/pci/riptide/riptide.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c index f067c76d77f8..44f3b48d47b1 100644 --- a/sound/pci/riptide/riptide.c +++ b/sound/pci/riptide/riptide.c @@ -1315,7 +1315,7 @@ static int riptide_reset(struct cmdif *cif, struct snd_riptide *chip) return 0; } -static struct snd_pcm_hardware snd_riptide_playback = { +static const struct snd_pcm_hardware snd_riptide_playback = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_MMAP_VALID), @@ -1334,7 +1334,7 @@ static struct snd_pcm_hardware snd_riptide_playback = { .periods_max = 64, .fifo_size = 0, }; -static struct snd_pcm_hardware snd_riptide_capture = { +static const struct snd_pcm_hardware snd_riptide_capture = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_MMAP_VALID), -- cgit From 18ed1cf00b9ad47021fda5d7392b32dadc788097 Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Sat, 12 Aug 2017 21:01:25 +0530 Subject: ALSA: rme9652: make snd_pcm_hardware const Make these const as they are only used during a copy operation. Done using Coccinelle. Signed-off-by: Bhumika Goyal Signed-off-by: Takashi Iwai --- sound/pci/rme9652/hdsp.c | 4 ++-- sound/pci/rme9652/rme9652.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index fe36d44d16c6..9535e6a933eb 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c @@ -4211,7 +4211,7 @@ static int snd_hdsp_prepare(struct snd_pcm_substream *substream) return result; } -static struct snd_pcm_hardware snd_hdsp_playback_subinfo = +static const struct snd_pcm_hardware snd_hdsp_playback_subinfo = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | @@ -4241,7 +4241,7 @@ static struct snd_pcm_hardware snd_hdsp_playback_subinfo = .fifo_size = 0 }; -static struct snd_pcm_hardware snd_hdsp_capture_subinfo = +static const struct snd_pcm_hardware snd_hdsp_capture_subinfo = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c index 150d08898db8..eff499355b52 100644 --- a/sound/pci/rme9652/rme9652.c +++ b/sound/pci/rme9652/rme9652.c @@ -2181,7 +2181,7 @@ static int snd_rme9652_prepare(struct snd_pcm_substream *substream) return result; } -static struct snd_pcm_hardware snd_rme9652_playback_subinfo = +static const struct snd_pcm_hardware snd_rme9652_playback_subinfo = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | @@ -2205,7 +2205,7 @@ static struct snd_pcm_hardware snd_rme9652_playback_subinfo = .fifo_size = 0, }; -static struct snd_pcm_hardware snd_rme9652_capture_subinfo = +static const struct snd_pcm_hardware snd_rme9652_capture_subinfo = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | -- cgit From b57cac281589654cef6120f694cb09c267e85d24 Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Sat, 12 Aug 2017 21:01:26 +0530 Subject: ALSA: trident: make snd_pcm_hardware const Make these const as they are only used during a copy operation. Done using Coccinelle. Signed-off-by: Bhumika Goyal Signed-off-by: Takashi Iwai --- sound/pci/trident/trident_main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c index d9bb6dd9f227..eabd84d9ffee 100644 --- a/sound/pci/trident/trident_main.c +++ b/sound/pci/trident/trident_main.c @@ -1727,7 +1727,7 @@ static snd_pcm_uframes_t snd_trident_spdif_pointer(struct snd_pcm_substream *sub * Playback support device description */ -static struct snd_pcm_hardware snd_trident_playback = +static const struct snd_pcm_hardware snd_trident_playback = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | @@ -1752,7 +1752,7 @@ static struct snd_pcm_hardware snd_trident_playback = * Capture support device description */ -static struct snd_pcm_hardware snd_trident_capture = +static const struct snd_pcm_hardware snd_trident_capture = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | @@ -1777,7 +1777,7 @@ static struct snd_pcm_hardware snd_trident_capture = * Foldback capture support device description */ -static struct snd_pcm_hardware snd_trident_foldback = +static const struct snd_pcm_hardware snd_trident_foldback = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | @@ -1801,7 +1801,7 @@ static struct snd_pcm_hardware snd_trident_foldback = * SPDIF playback support device description */ -static struct snd_pcm_hardware snd_trident_spdif = +static const struct snd_pcm_hardware snd_trident_spdif = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | @@ -1822,7 +1822,7 @@ static struct snd_pcm_hardware snd_trident_spdif = .fifo_size = 0, }; -static struct snd_pcm_hardware snd_trident_spdif_7018 = +static const struct snd_pcm_hardware snd_trident_spdif_7018 = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | -- cgit From 420b0c1b78aed04b951418ca453673fd6c06c737 Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Sat, 12 Aug 2017 21:01:27 +0530 Subject: ALSA: ymfpci: make snd_pcm_hardware const Make these const as they are only used during a copy operation. Done using Coccinelle. Signed-off-by: Bhumika Goyal Signed-off-by: Takashi Iwai --- sound/pci/ymfpci/ymfpci_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index 1114166c685c..edfd58248082 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c @@ -845,7 +845,7 @@ static irqreturn_t snd_ymfpci_interrupt(int irq, void *dev_id) return IRQ_HANDLED; } -static struct snd_pcm_hardware snd_ymfpci_playback = +static const struct snd_pcm_hardware snd_ymfpci_playback = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | @@ -867,7 +867,7 @@ static struct snd_pcm_hardware snd_ymfpci_playback = .fifo_size = 0, }; -static struct snd_pcm_hardware snd_ymfpci_capture = +static const struct snd_pcm_hardware snd_ymfpci_capture = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | -- cgit From dee49895b197936c02d27d651e58c90bac18f452 Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Sat, 12 Aug 2017 21:01:28 +0530 Subject: ALSA: pci: make snd_pcm_hardware const Make these const as they are only used during a copy operation. Done using Coccinelle. Signed-off-by: Bhumika Goyal Signed-off-by: Takashi Iwai --- sound/pci/ad1889.c | 4 ++-- sound/pci/als300.c | 4 ++-- sound/pci/als4000.c | 4 ++-- sound/pci/atiixp.c | 2 +- sound/pci/atiixp_modem.c | 2 +- sound/pci/bt87x.c | 4 ++-- sound/pci/cmipci.c | 12 ++++++------ sound/pci/cs4281.c | 4 ++-- sound/pci/ens1370.c | 6 +++--- sound/pci/es1938.c | 4 ++-- sound/pci/es1968.c | 4 ++-- sound/pci/fm801.c | 4 ++-- sound/pci/intel8x0.c | 2 +- sound/pci/intel8x0m.c | 2 +- sound/pci/maestro3.c | 4 ++-- sound/pci/rme32.c | 8 ++++---- sound/pci/rme96.c | 8 ++++---- sound/pci/sis7019.c | 4 ++-- sound/pci/sonicvibes.c | 4 ++-- sound/pci/via82xx.c | 2 +- sound/pci/via82xx_modem.c | 2 +- 21 files changed, 45 insertions(+), 45 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c index 8c36990e26f6..0bf2c04eeada 100644 --- a/sound/pci/ad1889.c +++ b/sound/pci/ad1889.c @@ -283,7 +283,7 @@ snd_ad1889_hw_free(struct snd_pcm_substream *substream) return snd_pcm_lib_free_pages(substream); } -static struct snd_pcm_hardware snd_ad1889_playback_hw = { +static const struct snd_pcm_hardware snd_ad1889_playback_hw = { .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_BLOCK_TRANSFER, .formats = SNDRV_PCM_FMTBIT_S16_LE, @@ -300,7 +300,7 @@ static struct snd_pcm_hardware snd_ad1889_playback_hw = { /*.fifo_size = 0,*/ }; -static struct snd_pcm_hardware snd_ad1889_capture_hw = { +static const struct snd_pcm_hardware snd_ad1889_capture_hw = { .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_BLOCK_TRANSFER, .formats = SNDRV_PCM_FMTBIT_S16_LE, diff --git a/sound/pci/als300.c b/sound/pci/als300.c index ab75601d7c2c..eaa2d853d922 100644 --- a/sound/pci/als300.c +++ b/sound/pci/als300.c @@ -328,7 +328,7 @@ static int snd_als300_ac97(struct snd_als300 *chip) * the card when it is running outside of legacy * mode. */ -static struct snd_pcm_hardware snd_als300_playback_hw = +static const struct snd_pcm_hardware snd_als300_playback_hw = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | @@ -347,7 +347,7 @@ static struct snd_pcm_hardware snd_als300_playback_hw = .periods_max = 2, }; -static struct snd_pcm_hardware snd_als300_capture_hw = +static const struct snd_pcm_hardware snd_als300_capture_hw = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c index 7844a75d8ed9..26b097edec8c 100644 --- a/sound/pci/als4000.c +++ b/sound/pci/als4000.c @@ -592,7 +592,7 @@ static irqreturn_t snd_als4000_interrupt(int irq, void *dev_id) /*****************************************************************/ -static struct snd_pcm_hardware snd_als4000_playback = +static const struct snd_pcm_hardware snd_als4000_playback = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP_VALID), @@ -611,7 +611,7 @@ static struct snd_pcm_hardware snd_als4000_playback = .fifo_size = 0 }; -static struct snd_pcm_hardware snd_als4000_capture = +static const struct snd_pcm_hardware snd_als4000_capture = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP_VALID), diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c index a40c918c8dff..de53c2aa5b20 100644 --- a/sound/pci/atiixp.c +++ b/sound/pci/atiixp.c @@ -1009,7 +1009,7 @@ static int snd_atiixp_pcm_hw_free(struct snd_pcm_substream *substream) /* * pcm hardware definition, identical for all DMA types */ -static struct snd_pcm_hardware snd_atiixp_pcm_hw = +static const struct snd_pcm_hardware snd_atiixp_pcm_hw = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c index 52e0ea7b9b80..a586635664e0 100644 --- a/sound/pci/atiixp_modem.c +++ b/sound/pci/atiixp_modem.c @@ -834,7 +834,7 @@ static int snd_atiixp_pcm_hw_free(struct snd_pcm_substream *substream) /* * pcm hardware definition, identical for all DMA types */ -static struct snd_pcm_hardware snd_atiixp_pcm_hw = +static const struct snd_pcm_hardware snd_atiixp_pcm_hw = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c index de0234294c25..d8ade8771a32 100644 --- a/sound/pci/bt87x.c +++ b/sound/pci/bt87x.c @@ -353,7 +353,7 @@ static irqreturn_t snd_bt87x_interrupt(int irq, void *dev_id) return IRQ_HANDLED; } -static struct snd_pcm_hardware snd_bt87x_digital_hw = { +static const struct snd_pcm_hardware snd_bt87x_digital_hw = { .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | @@ -370,7 +370,7 @@ static struct snd_pcm_hardware snd_bt87x_digital_hw = { .periods_max = 255, }; -static struct snd_pcm_hardware snd_bt87x_analog_hw = { +static const struct snd_pcm_hardware snd_bt87x_analog_hw = { .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index a460cb63e971..a45245f16059 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c @@ -1477,7 +1477,7 @@ static irqreturn_t snd_cmipci_interrupt(int irq, void *dev_id) */ /* playback on channel A */ -static struct snd_pcm_hardware snd_cmipci_playback = +static const struct snd_pcm_hardware snd_cmipci_playback = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_PAUSE | @@ -1497,7 +1497,7 @@ static struct snd_pcm_hardware snd_cmipci_playback = }; /* capture on channel B */ -static struct snd_pcm_hardware snd_cmipci_capture = +static const struct snd_pcm_hardware snd_cmipci_capture = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_PAUSE | @@ -1517,7 +1517,7 @@ static struct snd_pcm_hardware snd_cmipci_capture = }; /* playback on channel B - stereo 16bit only? */ -static struct snd_pcm_hardware snd_cmipci_playback2 = +static const struct snd_pcm_hardware snd_cmipci_playback2 = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_PAUSE | @@ -1537,7 +1537,7 @@ static struct snd_pcm_hardware snd_cmipci_playback2 = }; /* spdif playback on channel A */ -static struct snd_pcm_hardware snd_cmipci_playback_spdif = +static const struct snd_pcm_hardware snd_cmipci_playback_spdif = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_PAUSE | @@ -1557,7 +1557,7 @@ static struct snd_pcm_hardware snd_cmipci_playback_spdif = }; /* spdif playback on channel A (32bit, IEC958 subframes) */ -static struct snd_pcm_hardware snd_cmipci_playback_iec958_subframe = +static const struct snd_pcm_hardware snd_cmipci_playback_iec958_subframe = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_PAUSE | @@ -1577,7 +1577,7 @@ static struct snd_pcm_hardware snd_cmipci_playback_iec958_subframe = }; /* spdif capture on channel B */ -static struct snd_pcm_hardware snd_cmipci_capture_spdif = +static const struct snd_pcm_hardware snd_cmipci_capture_spdif = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_PAUSE | diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c index ee7ba4b0b47b..ec4247638fa1 100644 --- a/sound/pci/cs4281.c +++ b/sound/pci/cs4281.c @@ -847,7 +847,7 @@ static snd_pcm_uframes_t snd_cs4281_pointer(struct snd_pcm_substream *substream) snd_cs4281_peekBA0(chip, dma->regDCC) - 1; } -static struct snd_pcm_hardware snd_cs4281_playback = +static const struct snd_pcm_hardware snd_cs4281_playback = { .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | @@ -872,7 +872,7 @@ static struct snd_pcm_hardware snd_cs4281_playback = .fifo_size = CS4281_FIFO_SIZE, }; -static struct snd_pcm_hardware snd_cs4281_capture = +static const struct snd_pcm_hardware snd_cs4281_capture = { .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c index f0d978e3b274..d4cd6451fdca 100644 --- a/sound/pci/ens1370.c +++ b/sound/pci/ens1370.c @@ -1059,7 +1059,7 @@ static snd_pcm_uframes_t snd_ensoniq_capture_pointer(struct snd_pcm_substream *s return ptr; } -static struct snd_pcm_hardware snd_ensoniq_playback1 = +static const struct snd_pcm_hardware snd_ensoniq_playback1 = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | @@ -1086,7 +1086,7 @@ static struct snd_pcm_hardware snd_ensoniq_playback1 = .fifo_size = 0, }; -static struct snd_pcm_hardware snd_ensoniq_playback2 = +static const struct snd_pcm_hardware snd_ensoniq_playback2 = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | @@ -1106,7 +1106,7 @@ static struct snd_pcm_hardware snd_ensoniq_playback2 = .fifo_size = 0, }; -static struct snd_pcm_hardware snd_ensoniq_capture = +static const struct snd_pcm_hardware snd_ensoniq_capture = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c index 069902a06f00..9d248eb2e26c 100644 --- a/sound/pci/es1938.c +++ b/sound/pci/es1938.c @@ -900,7 +900,7 @@ static int snd_es1938_pcm_hw_free(struct snd_pcm_substream *substream) /* ---------------------------------------------------------------------- * Audio1 Capture (ADC) * ----------------------------------------------------------------------*/ -static struct snd_pcm_hardware snd_es1938_capture = +static const struct snd_pcm_hardware snd_es1938_capture = { .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER), @@ -922,7 +922,7 @@ static struct snd_pcm_hardware snd_es1938_capture = /* ----------------------------------------------------------------------- * Audio2 Playback (DAC) * -----------------------------------------------------------------------*/ -static struct snd_pcm_hardware snd_es1938_playback = +static const struct snd_pcm_hardware snd_es1938_playback = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index 2ec2b1ce0af6..0b1845ca6005 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c @@ -1290,7 +1290,7 @@ static snd_pcm_uframes_t snd_es1968_pcm_pointer(struct snd_pcm_substream *substr return bytes_to_frames(substream->runtime, ptr % es->dma_size); } -static struct snd_pcm_hardware snd_es1968_playback = { +static const struct snd_pcm_hardware snd_es1968_playback = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_INTERLEAVED | @@ -1311,7 +1311,7 @@ static struct snd_pcm_hardware snd_es1968_playback = { .fifo_size = 0, }; -static struct snd_pcm_hardware snd_es1968_capture = { +static const struct snd_pcm_hardware snd_es1968_capture = { .info = (SNDRV_PCM_INFO_NONINTERLEAVED | SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c index 8e6b04b39dcc..73a67bc3586b 100644 --- a/sound/pci/fm801.c +++ b/sound/pci/fm801.c @@ -599,7 +599,7 @@ static irqreturn_t snd_fm801_interrupt(int irq, void *dev_id) return IRQ_HANDLED; } -static struct snd_pcm_hardware snd_fm801_playback = +static const struct snd_pcm_hardware snd_fm801_playback = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | @@ -619,7 +619,7 @@ static struct snd_pcm_hardware snd_fm801_playback = .fifo_size = 0, }; -static struct snd_pcm_hardware snd_fm801_capture = +static const struct snd_pcm_hardware snd_fm801_capture = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index fcd032e3882d..851ccff549a4 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -1115,7 +1115,7 @@ static snd_pcm_uframes_t snd_intel8x0_pcm_pointer(struct snd_pcm_substream *subs return bytes_to_frames(substream->runtime, ptr); } -static struct snd_pcm_hardware snd_intel8x0_stream = +static const struct snd_pcm_hardware snd_intel8x0_stream = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c index 2f1b878fadbb..3a4769a97d29 100644 --- a/sound/pci/intel8x0m.c +++ b/sound/pci/intel8x0m.c @@ -611,7 +611,7 @@ static int snd_intel8x0m_pcm_prepare(struct snd_pcm_substream *substream) return 0; } -static struct snd_pcm_hardware snd_intel8x0m_stream = +static const struct snd_pcm_hardware snd_intel8x0m_stream = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c index cafea6dc5c01..97ac80af4447 100644 --- a/sound/pci/maestro3.c +++ b/sound/pci/maestro3.c @@ -1681,7 +1681,7 @@ static irqreturn_t snd_m3_interrupt(int irq, void *dev_id) /* */ -static struct snd_pcm_hardware snd_m3_playback = +static const struct snd_pcm_hardware snd_m3_playback = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | @@ -1702,7 +1702,7 @@ static struct snd_pcm_hardware snd_m3_playback = .periods_max = 1024, }; -static struct snd_pcm_hardware snd_m3_capture = +static const struct snd_pcm_hardware snd_m3_capture = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c index e4cdef94e4a2..f0906ba416d4 100644 --- a/sound/pci/rme32.c +++ b/sound/pci/rme32.c @@ -314,7 +314,7 @@ static int snd_rme32_capture_copy_kernel(struct snd_pcm_substream *substream, /* * SPDIF I/O capabilities (half-duplex mode) */ -static struct snd_pcm_hardware snd_rme32_spdif_info = { +static const struct snd_pcm_hardware snd_rme32_spdif_info = { .info = (SNDRV_PCM_INFO_MMAP_IOMEM | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_INTERLEAVED | @@ -340,7 +340,7 @@ static struct snd_pcm_hardware snd_rme32_spdif_info = { /* * ADAT I/O capabilities (half-duplex mode) */ -static struct snd_pcm_hardware snd_rme32_adat_info = +static const struct snd_pcm_hardware snd_rme32_adat_info = { .info = (SNDRV_PCM_INFO_MMAP_IOMEM | SNDRV_PCM_INFO_MMAP_VALID | @@ -365,7 +365,7 @@ static struct snd_pcm_hardware snd_rme32_adat_info = /* * SPDIF I/O capabilities (full-duplex mode) */ -static struct snd_pcm_hardware snd_rme32_spdif_fd_info = { +static const struct snd_pcm_hardware snd_rme32_spdif_fd_info = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_INTERLEAVED | @@ -391,7 +391,7 @@ static struct snd_pcm_hardware snd_rme32_spdif_fd_info = { /* * ADAT I/O capabilities (full-duplex mode) */ -static struct snd_pcm_hardware snd_rme32_adat_fd_info = +static const struct snd_pcm_hardware snd_rme32_adat_fd_info = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c index b488d74c3b99..dcfa4d7a73e2 100644 --- a/sound/pci/rme96.c +++ b/sound/pci/rme96.c @@ -384,7 +384,7 @@ snd_rme96_capture_copy_kernel(struct snd_pcm_substream *substream, /* * Digital output capabilities (S/PDIF) */ -static struct snd_pcm_hardware snd_rme96_playback_spdif_info = +static const struct snd_pcm_hardware snd_rme96_playback_spdif_info = { .info = (SNDRV_PCM_INFO_MMAP_IOMEM | SNDRV_PCM_INFO_MMAP_VALID | @@ -415,7 +415,7 @@ static struct snd_pcm_hardware snd_rme96_playback_spdif_info = /* * Digital input capabilities (S/PDIF) */ -static struct snd_pcm_hardware snd_rme96_capture_spdif_info = +static const struct snd_pcm_hardware snd_rme96_capture_spdif_info = { .info = (SNDRV_PCM_INFO_MMAP_IOMEM | SNDRV_PCM_INFO_MMAP_VALID | @@ -446,7 +446,7 @@ static struct snd_pcm_hardware snd_rme96_capture_spdif_info = /* * Digital output capabilities (ADAT) */ -static struct snd_pcm_hardware snd_rme96_playback_adat_info = +static const struct snd_pcm_hardware snd_rme96_playback_adat_info = { .info = (SNDRV_PCM_INFO_MMAP_IOMEM | SNDRV_PCM_INFO_MMAP_VALID | @@ -473,7 +473,7 @@ static struct snd_pcm_hardware snd_rme96_playback_adat_info = /* * Digital input capabilities (ADAT) */ -static struct snd_pcm_hardware snd_rme96_capture_adat_info = +static const struct snd_pcm_hardware snd_rme96_capture_adat_info = { .info = (SNDRV_PCM_INFO_MMAP_IOMEM | SNDRV_PCM_INFO_MMAP_VALID | diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c index 35188872d313..964acf302479 100644 --- a/sound/pci/sis7019.c +++ b/sound/pci/sis7019.c @@ -159,7 +159,7 @@ struct sis7019 { * We'll add a constraint upon open that limits the period and buffer sample * size to values that are legal for the hardware. */ -static struct snd_pcm_hardware sis_playback_hw_info = { +static const struct snd_pcm_hardware sis_playback_hw_info = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_INTERLEAVED | @@ -180,7 +180,7 @@ static struct snd_pcm_hardware sis_playback_hw_info = { .periods_max = (0xfff9 / 9), }; -static struct snd_pcm_hardware sis_capture_hw_info = { +static const struct snd_pcm_hardware sis_capture_hw_info = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_INTERLEAVED | diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c index 784d762f18a7..a8abb15e3c3a 100644 --- a/sound/pci/sonicvibes.c +++ b/sound/pci/sonicvibes.c @@ -776,7 +776,7 @@ static snd_pcm_uframes_t snd_sonicvibes_capture_pointer(struct snd_pcm_substream return bytes_to_frames(substream->runtime, ptr); } -static struct snd_pcm_hardware snd_sonicvibes_playback = +static const struct snd_pcm_hardware snd_sonicvibes_playback = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | @@ -795,7 +795,7 @@ static struct snd_pcm_hardware snd_sonicvibes_playback = .fifo_size = 0, }; -static struct snd_pcm_hardware snd_sonicvibes_capture = +static const struct snd_pcm_hardware snd_sonicvibes_capture = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index c767b8664359..3a1c0b8b4ea2 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c @@ -1150,7 +1150,7 @@ static int snd_via8233_capture_prepare(struct snd_pcm_substream *substream) /* * pcm hardware definition, identical for both playback and capture */ -static struct snd_pcm_hardware snd_via82xx_hw = +static const struct snd_pcm_hardware snd_via82xx_hw = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c index 55f79b2599e7..8a69221c1b86 100644 --- a/sound/pci/via82xx_modem.c +++ b/sound/pci/via82xx_modem.c @@ -714,7 +714,7 @@ static int snd_via82xx_pcm_prepare(struct snd_pcm_substream *substream) /* * pcm hardware definition, identical for both playback and capture */ -static struct snd_pcm_hardware snd_via82xx_hw = +static const struct snd_pcm_hardware snd_via82xx_hw = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | -- cgit From c38774d830aef6710676e7e5797d979c2bbb45ba Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Sat, 12 Aug 2017 18:14:54 +0200 Subject: ALSA: pcxhr: Delete an error message for a failed memory allocation in pcxhr_create() Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring Signed-off-by: Takashi Iwai --- sound/pci/pcxhr/pcxhr.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c index e6f9aa67cc6f..f9ae72f28ddc 100644 --- a/sound/pci/pcxhr/pcxhr.c +++ b/sound/pci/pcxhr/pcxhr.c @@ -1215,10 +1215,8 @@ static int pcxhr_create(struct pcxhr_mgr *mgr, }; chip = kzalloc(sizeof(*chip), GFP_KERNEL); - if (! chip) { - dev_err(card->dev, "cannot allocate chip\n"); + if (!chip) return -ENOMEM; - } chip->card = card; chip->chip_idx = idx; -- cgit From a357f3d1ee95953c9f04617f3045838260f3401f Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Sat, 12 Aug 2017 18:45:42 +0200 Subject: ALSA: mixart: Delete an error message for a failed memory allocation in snd_mixart_create() Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring Signed-off-by: Takashi Iwai --- sound/pci/mixart/mixart.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c index aca3b34b1bfe..a74f1ad7e7b8 100644 --- a/sound/pci/mixart/mixart.c +++ b/sound/pci/mixart/mixart.c @@ -1052,10 +1052,8 @@ static int snd_mixart_create(struct mixart_mgr *mgr, struct snd_card *card, int }; chip = kzalloc(sizeof(*chip), GFP_KERNEL); - if (! chip) { - dev_err(card->dev, "cannot allocate chip\n"); + if (!chip) return -ENOMEM; - } chip->card = card; chip->chip_idx = idx; -- cgit From f197acd27e9782a317f070e4ec465f5da460afd1 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Sat, 12 Aug 2017 19:09:23 +0200 Subject: ALSA: ca0106: Delete an error message for a failed memory allocation in snd_ca0106_pcm_open_capture_channel() Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring Signed-off-by: Takashi Iwai --- sound/pci/ca0106/ca0106_main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c index 2be30b8b6bc9..cd27b5536654 100644 --- a/sound/pci/ca0106/ca0106_main.c +++ b/sound/pci/ca0106/ca0106_main.c @@ -660,11 +660,9 @@ static int snd_ca0106_pcm_open_capture_channel(struct snd_pcm_substream *substre int err; epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); - if (epcm == NULL) { - dev_err(chip->card->dev, - "open_capture_channel: failed epcm alloc\n"); + if (!epcm) return -ENOMEM; - } + epcm->emu = chip; epcm->substream = substream; epcm->channel_id=channel_id; -- cgit From 2675be5a004ee0d8155d2ad48cad95920f727921 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Mon, 14 Aug 2017 22:00:40 +0200 Subject: ALSA: rme9652: Use common error handling code in two functions Add a jump target so that a bit of exception handling can be better reused in these functions. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring Signed-off-by: Takashi Iwai --- sound/pci/rme9652/hdsp.c | 13 ++++++------- sound/pci/rme9652/rme9652.c | 14 ++++++-------- 2 files changed, 12 insertions(+), 15 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index 9535e6a933eb..0ff41f9ab434 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c @@ -5381,17 +5381,16 @@ static int snd_hdsp_probe(struct pci_dev *pci, card->private_free = snd_hdsp_card_free; hdsp->dev = dev; hdsp->pci = pci; - - if ((err = snd_hdsp_create(card, hdsp)) < 0) { - snd_card_free(card); - return err; - } + err = snd_hdsp_create(card, hdsp); + if (err) + goto free_card; strcpy(card->shortname, "Hammerfall DSP"); sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name, hdsp->port, hdsp->irq); - - if ((err = snd_card_register(card)) < 0) { + err = snd_card_register(card); + if (err) { +free_card: snd_card_free(card); return err; } diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c index eff499355b52..df648b1d9217 100644 --- a/sound/pci/rme9652/rme9652.c +++ b/sound/pci/rme9652/rme9652.c @@ -2618,19 +2618,17 @@ static int snd_rme9652_probe(struct pci_dev *pci, card->private_free = snd_rme9652_card_free; rme9652->dev = dev; rme9652->pci = pci; - - if ((err = snd_rme9652_create(card, rme9652, precise_ptr[dev])) < 0) { - snd_card_free(card); - return err; - } + err = snd_rme9652_create(card, rme9652, precise_ptr[dev]); + if (err) + goto free_card; strcpy(card->shortname, rme9652->card_name); sprintf(card->longname, "%s at 0x%lx, irq %d", card->shortname, rme9652->port, rme9652->irq); - - - if ((err = snd_card_register(card)) < 0) { + err = snd_card_register(card); + if (err) { +free_card: snd_card_free(card); return err; } -- cgit From 7df3859bf71b9c36683846fa07d68ed89f769d72 Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Wed, 16 Aug 2017 14:14:10 +0530 Subject: ALSA: pcxhr: make snd_kcontrol_new const Make these const as they are only used during a copy operation. Done using Coccinelle. Signed-off-by: Bhumika Goyal Signed-off-by: Takashi Iwai --- sound/pci/pcxhr/pcxhr_mixer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/pcxhr/pcxhr_mixer.c b/sound/pci/pcxhr/pcxhr_mixer.c index 36875df30dbf..d9a1c6c50a87 100644 --- a/sound/pci/pcxhr/pcxhr_mixer.c +++ b/sound/pci/pcxhr/pcxhr_mixer.c @@ -185,7 +185,7 @@ static int pcxhr_analog_vol_put(struct snd_kcontrol *kcontrol, return changed; } -static struct snd_kcontrol_new pcxhr_control_analog_level = { +static const struct snd_kcontrol_new pcxhr_control_analog_level = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ), @@ -409,7 +409,7 @@ static int pcxhr_pcm_vol_put(struct snd_kcontrol *kcontrol, return changed; } -static struct snd_kcontrol_new snd_pcxhr_pcm_vol = +static const struct snd_kcontrol_new snd_pcxhr_pcm_vol = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | -- cgit From fdbf0488040622b225e8019d96693236dceaf832 Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Wed, 16 Aug 2017 14:14:11 +0530 Subject: ALSA: hda: make snd_kcontrol_new const Make these const as they are only passed as the 3rd argument to the function snd_hda_gen_add_kctl, which is of type const. Done using Coccinelle. Signed-off-by: Bhumika Goyal Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_analog.c | 4 ++-- sound/pci/hda/patch_sigmatel.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index e0fb8c6d1bc2..757857313426 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c @@ -505,7 +505,7 @@ static int ad1983_auto_smux_enum_put(struct snd_kcontrol *kcontrol, return 1; } -static struct snd_kcontrol_new ad1983_auto_smux_mixer = { +static const struct snd_kcontrol_new ad1983_auto_smux_mixer = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "IEC958 Playback Source", .info = ad1983_auto_smux_enum_info, @@ -788,7 +788,7 @@ static int ad1988_auto_smux_enum_put(struct snd_kcontrol *kcontrol, return 1; } -static struct snd_kcontrol_new ad1988_auto_smux_mixer = { +static const struct snd_kcontrol_new ad1988_auto_smux_mixer = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "IEC958 Playback Source", .info = ad1988_auto_smux_enum_info, diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 6cefdf6c0b75..63d15b545b33 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -961,7 +961,7 @@ static int stac_smux_enum_put(struct snd_kcontrol *kcontrol, &spec->cur_smux[smux_idx]); } -static struct snd_kcontrol_new stac_smux_mixer = { +static const struct snd_kcontrol_new stac_smux_mixer = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "IEC958 Playback Source", /* count set later */ -- cgit From aa38e71d050c4a0006b55cd1b5199f7b8c6f5deb Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Thu, 17 Aug 2017 14:45:54 +0530 Subject: ALSA: pci: make snd_pcm_hardware const Make these const as they are only used in a copy operation. Done using Coccinelle. Signed-off-by: Bhumika Goyal Signed-off-by: Takashi Iwai --- sound/pci/au88x0/au88x0_pcm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/au88x0/au88x0_pcm.c b/sound/pci/au88x0/au88x0_pcm.c index 848eb3cb18a8..53714e0bf598 100644 --- a/sound/pci/au88x0/au88x0_pcm.c +++ b/sound/pci/au88x0/au88x0_pcm.c @@ -30,7 +30,7 @@ #define VORTEX_PCM_TYPE(x) (x->name[40]) /* hardware definition */ -static struct snd_pcm_hardware snd_vortex_playback_hw_adb = { +static const struct snd_pcm_hardware snd_vortex_playback_hw_adb = { .info = (SNDRV_PCM_INFO_MMAP | /* SNDRV_PCM_INFO_RESUME | */ SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_INTERLEAVED | @@ -51,7 +51,7 @@ static struct snd_pcm_hardware snd_vortex_playback_hw_adb = { }; #ifndef CHIP_AU8820 -static struct snd_pcm_hardware snd_vortex_playback_hw_a3d = { +static const struct snd_pcm_hardware snd_vortex_playback_hw_a3d = { .info = (SNDRV_PCM_INFO_MMAP | /* SNDRV_PCM_INFO_RESUME | */ SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_INTERLEAVED | @@ -71,7 +71,7 @@ static struct snd_pcm_hardware snd_vortex_playback_hw_a3d = { .periods_max = 64, }; #endif -static struct snd_pcm_hardware snd_vortex_playback_hw_spdif = { +static const struct snd_pcm_hardware snd_vortex_playback_hw_spdif = { .info = (SNDRV_PCM_INFO_MMAP | /* SNDRV_PCM_INFO_RESUME | */ SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_INTERLEAVED | @@ -94,7 +94,7 @@ static struct snd_pcm_hardware snd_vortex_playback_hw_spdif = { }; #ifndef CHIP_AU8810 -static struct snd_pcm_hardware snd_vortex_playback_hw_wt = { +static const struct snd_pcm_hardware snd_vortex_playback_hw_wt = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_MMAP_VALID), -- cgit From e8a91ae18bdc0bcedd2a07e42e66ca09dc2105d2 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 21 Aug 2017 16:13:27 +0200 Subject: ALSA: ice1712: Add support for STAudio ADCIII STAudio ADCIII has the same SSID as Hoontech STDSP24, but requires a slightly different configuration. This patch allows user to choose this model via model=staudio option to set the proper configuration for the board. Bugzilla: http://bugzilla.suse.com/show_bug.cgi?id=1048934 Signed-off-by: Takashi Iwai --- sound/pci/ice1712/hoontech.c | 39 ++++++++++++++++++++++++++++++++++----- sound/pci/ice1712/hoontech.h | 1 + 2 files changed, 35 insertions(+), 5 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/ice1712/hoontech.c b/sound/pci/ice1712/hoontech.c index f37ed0bc203d..fa301d31745b 100644 --- a/sound/pci/ice1712/hoontech.c +++ b/sound/pci/ice1712/hoontech.c @@ -166,7 +166,7 @@ static void snd_ice1712_stdsp24_midi2(struct snd_ice1712 *ice, int activate) mutex_unlock(&ice->gpio_mutex); } -static int snd_ice1712_hoontech_init(struct snd_ice1712 *ice) +static int hoontech_init(struct snd_ice1712 *ice, bool staudio) { struct hoontech_spec *spec; int box, chn; @@ -203,7 +203,10 @@ static int snd_ice1712_hoontech_init(struct snd_ice1712 *ice) ICE1712_STDSP24_3_INSEL(spec->boxbits, 0); /* let's go - activate only functions in first box */ - spec->config = 0; + if (staudio) + spec->config = ICE1712_STDSP24_MUTE; + else + spec->config = 0; /* ICE1712_STDSP24_MUTE | ICE1712_STDSP24_INSEL | ICE1712_STDSP24_DAREAR; */ @@ -226,9 +229,16 @@ static int snd_ice1712_hoontech_init(struct snd_ice1712 *ice) ICE1712_STDSP24_BOX_CHN4 | ICE1712_STDSP24_BOX_MIDI1 | ICE1712_STDSP24_BOX_MIDI2; - spec->boxconfig[1] = - spec->boxconfig[2] = - spec->boxconfig[3] = 0; + if (staudio) { + spec->boxconfig[1] = + spec->boxconfig[2] = + spec->boxconfig[3] = spec->boxconfig[0]; + } else { + spec->boxconfig[1] = + spec->boxconfig[2] = + spec->boxconfig[3] = 0; + } + snd_ice1712_stdsp24_darear(ice, (spec->config & ICE1712_STDSP24_DAREAR) ? 1 : 0); snd_ice1712_stdsp24_mute(ice, @@ -248,6 +258,16 @@ static int snd_ice1712_hoontech_init(struct snd_ice1712 *ice) return 0; } +static int snd_ice1712_hoontech_init(struct snd_ice1712 *ice) +{ + return hoontech_init(ice, false); +} + +static int snd_ice1712_staudio_init(struct snd_ice1712 *ice) +{ + return hoontech_init(ice, true); +} + /* * AK4524 access */ @@ -351,5 +371,14 @@ struct snd_ice1712_card_info snd_ice1712_hoontech_cards[] = { .model = "ez8", .chip_init = snd_ice1712_ez8_init, }, + { + /* STAudio ADCIII has the same SSID as Hoontech StA DSP24, + * thus identified only via the explicit model option + */ + .subvendor = ICE1712_SUBDEVICE_STAUDIO_ADCIII, /* a dummy id */ + .name = "STAudio ADCIII", + .model = "staudio", + .chip_init = snd_ice1712_staudio_init, + }, { } /* terminator */ }; diff --git a/sound/pci/ice1712/hoontech.h b/sound/pci/ice1712/hoontech.h index cc1da1e69ad1..7f94943392ce 100644 --- a/sound/pci/ice1712/hoontech.h +++ b/sound/pci/ice1712/hoontech.h @@ -34,6 +34,7 @@ #define ICE1712_SUBDEVICE_STDSP24_VALUE 0x00010010 /* A dummy id for Hoontech SoundTrack Audio DSP 24 Value */ #define ICE1712_SUBDEVICE_STDSP24_MEDIA7_1 0x16141217 /* Hoontech ST Audio DSP24 Media 7.1 */ #define ICE1712_SUBDEVICE_EVENT_EZ8 0x00010001 /* A dummy id for EZ8 */ +#define ICE1712_SUBDEVICE_STAUDIO_ADCIII 0x00010002 /* A dummy id for STAudio ADCIII */ extern struct snd_ice1712_card_info snd_ice1712_hoontech_cards[]; -- cgit From cbb7eb20bb7c73b27e8ece8f871458ab0eab8253 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Tue, 22 Aug 2017 18:43:42 +0200 Subject: ALSA: ctxfi: Use common error handling code in two functions Add jump targets so that a bit of exception handling can be better reused at the end of these functions. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring Signed-off-by: Takashi Iwai --- sound/pci/ctxfi/ctpcm.c | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/ctxfi/ctpcm.c b/sound/pci/ctxfi/ctpcm.c index 358f5206130a..b36e37ae2b51 100644 --- a/sound/pci/ctxfi/ctpcm.c +++ b/sound/pci/ctxfi/ctpcm.c @@ -140,27 +140,28 @@ static int ct_pcm_playback_open(struct snd_pcm_substream *substream) err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); - if (err < 0) { - kfree(apcm); - return err; - } + if (err < 0) + goto free_pcm; + err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 1024, UINT_MAX); - if (err < 0) { - kfree(apcm); - return err; - } + if (err < 0) + goto free_pcm; apcm->timer = ct_timer_instance_new(atc->timer, apcm); if (!apcm->timer) { - kfree(apcm); - return -ENOMEM; + err = -ENOMEM; + goto free_pcm; } runtime->private_data = apcm; runtime->private_free = ct_atc_pcm_free_substream; return 0; + +free_pcm: + kfree(apcm); + return err; } static int ct_pcm_playback_close(struct snd_pcm_substream *substream) @@ -286,27 +287,28 @@ static int ct_pcm_capture_open(struct snd_pcm_substream *substream) err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); - if (err < 0) { - kfree(apcm); - return err; - } + if (err < 0) + goto free_pcm; + err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 1024, UINT_MAX); - if (err < 0) { - kfree(apcm); - return err; - } + if (err < 0) + goto free_pcm; apcm->timer = ct_timer_instance_new(atc->timer, apcm); if (!apcm->timer) { - kfree(apcm); - return -ENOMEM; + err = -ENOMEM; + goto free_pcm; } runtime->private_data = apcm; runtime->private_free = ct_atc_pcm_free_substream; return 0; + +free_pcm: + kfree(apcm); + return err; } static int ct_pcm_capture_close(struct snd_pcm_substream *substream) -- cgit From 62a939477173fabfe9f52114fab878a00b87f9a3 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 22 Aug 2017 16:52:10 +0200 Subject: ALSA: hda - Implement mic-mute LED mode enum Dell laptops have another LED for mic-mute in addition to the master mute. The former is tied with the capture switch (in a reverse way) while the latter is tied with the master playback switch. We already have an enum control to change the behavior for the master mute LED in different ways, e.g. keeping always off or turning off at mute. But, the mic-mute LED has no such management but its behavior is hard-coded. This patch implements an enum control to change the mic-mute LED behavior like what we have for the master mute LED. The ctl provides four modes: keep-on, keep-off, follow-capture and follow-mute. The default mode is the last one, follow-mute, which follows the capture mute, i.e. LED turning on when the capture is off, and turning off when the capture is active. Signed-off-by: Takashi Iwai --- sound/pci/hda/dell_wmi_helper.c | 87 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 81 insertions(+), 6 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/hda/dell_wmi_helper.c b/sound/pci/hda/dell_wmi_helper.c index 7efa7bd7acb2..44b1e15682b9 100644 --- a/sound/pci/hda/dell_wmi_helper.c +++ b/sound/pci/hda/dell_wmi_helper.c @@ -5,12 +5,47 @@ #if IS_ENABLED(CONFIG_DELL_LAPTOP) #include +enum { + MICMUTE_LED_ON, + MICMUTE_LED_OFF, + MICMUTE_LED_FOLLOW_CAPTURE, + MICMUTE_LED_FOLLOW_MUTE, +}; + +static int dell_led_mode = MICMUTE_LED_FOLLOW_MUTE; +static int dell_capture; static int dell_led_value; static int (*dell_micmute_led_set_func)(int); static void (*dell_old_cap_hook)(struct hda_codec *, struct snd_kcontrol *, struct snd_ctl_elem_value *); +static void call_micmute_led_update(void) +{ + int val; + + switch (dell_led_mode) { + case MICMUTE_LED_ON: + val = 1; + break; + case MICMUTE_LED_OFF: + val = 0; + break; + case MICMUTE_LED_FOLLOW_CAPTURE: + val = dell_capture; + break; + case MICMUTE_LED_FOLLOW_MUTE: + default: + val = !dell_capture; + break; + } + + if (val == dell_led_value) + return; + dell_led_value = val; + dell_micmute_led_set_func(dell_led_value); +} + static void update_dell_wmi_micmute_led(struct hda_codec *codec, struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) @@ -22,15 +57,54 @@ static void update_dell_wmi_micmute_led(struct hda_codec *codec, return; if (strcmp("Capture Switch", ucontrol->id.name) == 0 && ucontrol->id.index == 0) { /* TODO: How do I verify if it's a mono or stereo here? */ - int val = (ucontrol->value.integer.value[0] || ucontrol->value.integer.value[1]) ? 0 : 1; - if (val == dell_led_value) - return; - dell_led_value = val; - if (dell_micmute_led_set_func) - dell_micmute_led_set_func(dell_led_value); + dell_capture = (ucontrol->value.integer.value[0] || + ucontrol->value.integer.value[1]); + call_micmute_led_update(); } } +static int dell_mic_mute_led_mode_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) +{ + static const char * const texts[] = { + "On", "Off", "Follow Capture", "Follow Mute", + }; + + return snd_ctl_enum_info(uinfo, 1, ARRAY_SIZE(texts), texts); +} + +static int dell_mic_mute_led_mode_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + ucontrol->value.enumerated.item[0] = dell_led_mode; + return 0; +} + +static int dell_mic_mute_led_mode_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + unsigned int mode; + + mode = ucontrol->value.enumerated.item[0]; + if (mode > MICMUTE_LED_FOLLOW_MUTE) + mode = MICMUTE_LED_FOLLOW_MUTE; + if (mode == dell_led_mode) + return 0; + dell_led_mode = mode; + call_micmute_led_update(); + return 1; +} + +static const struct snd_kcontrol_new dell_mic_mute_mode_ctls[] = { + { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .name = "Mic Mute-LED Mode", + .info = dell_mic_mute_led_mode_info, + .get = dell_mic_mute_led_mode_get, + .put = dell_mic_mute_led_mode_put, + }, + {} +}; static void alc_fixup_dell_wmi(struct hda_codec *codec, const struct hda_fixup *fix, int action) @@ -55,6 +129,7 @@ static void alc_fixup_dell_wmi(struct hda_codec *codec, dell_old_cap_hook = spec->gen.cap_sync_hook; spec->gen.cap_sync_hook = update_dell_wmi_micmute_led; removefunc = false; + add_mixer(spec, dell_mic_mute_mode_ctls); } } -- cgit From e17a85eccfa0b7d0089af218b0c468d4b8a3c3c2 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Tue, 22 Aug 2017 19:58:30 +0200 Subject: ALSA: cmipci: Use common error handling code in snd_cmipci_probe() Add a jump target so that a bit of exception handling can be better reused at the end of this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring Signed-off-by: Takashi Iwai --- sound/pci/cmipci.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index a45245f16059..26a657870664 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c @@ -3295,20 +3295,23 @@ static int snd_cmipci_probe(struct pci_dev *pci, break; } - if ((err = snd_cmipci_create(card, pci, dev, &cm)) < 0) { - snd_card_free(card); - return err; - } + err = snd_cmipci_create(card, pci, dev, &cm); + if (err < 0) + goto free_card; + card->private_data = cm; - if ((err = snd_card_register(card)) < 0) { - snd_card_free(card); - return err; - } + err = snd_card_register(card); + if (err < 0) + goto free_card; + pci_set_drvdata(pci, card); dev++; return 0; +free_card: + snd_card_free(card); + return err; } static void snd_cmipci_remove(struct pci_dev *pci) -- cgit From 9715f0bdb61e98652a1c84408f2bc059d01ce85b Mon Sep 17 00:00:00 2001 From: Arvind Yadav Date: Wed, 23 Aug 2017 17:39:27 +0530 Subject: ALSA: atiixp: constify ac97_pcm structures ac97_pcm are not supposed to change at runtime. All functions working with ac97_pcm provided by work with const ac97_pcm. So mark the non-const structs as const. Signed-off-by: Arvind Yadav Signed-off-by: Takashi Iwai --- sound/pci/atiixp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound/pci') diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c index de53c2aa5b20..7ae63d452bba 100644 --- a/sound/pci/atiixp.c +++ b/sound/pci/atiixp.c @@ -1183,7 +1183,7 @@ static const struct snd_pcm_ops snd_atiixp_spdif_ops = { .pointer = snd_atiixp_pcm_pointer, }; -static struct ac97_pcm atiixp_pcm_defs[] = { +static const struct ac97_pcm atiixp_pcm_defs[] = { /* front PCM */ { .exclusive = 1, -- cgit From 668d06165c4a7d5bbb29fadd3e1b2d610b73c456 Mon Sep 17 00:00:00 2001 From: Arvind Yadav Date: Wed, 23 Aug 2017 17:39:28 +0530 Subject: ALSA: intel8x0: constify ac97_pcm structures ac97_pcm are not supposed to change at runtime. All functions working with ac97_pcm provided by work with const ac97_pcm. So mark the non-const structs as const. Signed-off-by: Arvind Yadav Signed-off-by: Takashi Iwai --- sound/pci/intel8x0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound/pci') diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 851ccff549a4..4c24346340f4 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -1721,7 +1721,7 @@ static void snd_intel8x0_mixer_free_ac97(struct snd_ac97 *ac97) chip->ac97[ac97->num] = NULL; } -static struct ac97_pcm ac97_pcm_defs[] = { +static const struct ac97_pcm ac97_pcm_defs[] = { /* front PCM */ { .exclusive = 1, -- cgit From faa119099e4942152fd2ff823ae9961ad00db475 Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Wed, 23 Aug 2017 17:58:42 +0530 Subject: ALSA: ctxfi: make hw structures const Make these const as they are only used in a copy operation. Done using Coccinelle: @match disable optional_qualifier@ identifier s; @@ static struct hw s = {...}; @ref@ position p; identifier match.s; @@ s@p @good1@ position ref.p; identifier match.s,f,c; expression e; @@ ( e = s@p | e = s@p.f | c(...,s@p.f,...) | c(...,s@p,...) ) @bad depends on !good1@ position ref.p; identifier match.s; @@ s@p @depends on forall !bad disable optional_qualifier@ identifier match.s; @@ static + const struct hw s; Signed-off-by: Bhumika Goyal Signed-off-by: Takashi Iwai --- sound/pci/ctxfi/cthw20k1.c | 2 +- sound/pci/ctxfi/cthw20k2.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/ctxfi/cthw20k1.c b/sound/pci/ctxfi/cthw20k1.c index 79edd88d5cd0..8e6eb9d7984b 100644 --- a/sound/pci/ctxfi/cthw20k1.c +++ b/sound/pci/ctxfi/cthw20k1.c @@ -2154,7 +2154,7 @@ static void hw_write_pci(struct hw *hw, u32 reg, u32 data) &container_of(hw, struct hw20k1, hw)->reg_pci_lock, flags); } -static struct hw ct20k1_preset = { +static const struct hw ct20k1_preset = { .irq = -1, .card_init = hw_card_init, diff --git a/sound/pci/ctxfi/cthw20k2.c b/sound/pci/ctxfi/cthw20k2.c index 18ee7768b7c4..b866d6b2c923 100644 --- a/sound/pci/ctxfi/cthw20k2.c +++ b/sound/pci/ctxfi/cthw20k2.c @@ -2220,7 +2220,7 @@ static void hw_write_20kx(struct hw *hw, u32 reg, u32 data) writel(data, hw->mem_base + reg); } -static struct hw ct20k2_preset = { +static const struct hw ct20k2_preset = { .irq = -1, .card_init = hw_card_init, -- cgit From 5d3806eea2dd19b083c729a32aded6d012ead5ae Mon Sep 17 00:00:00 2001 From: Arvind Yadav Date: Thu, 24 Aug 2017 11:55:28 +0530 Subject: ALSA: nm256: constify snd_ac97_res_table snd_ac97_res_table are not supposed to change at runtime. All functions working with snd_ac97_res_table provided by work with const snd_ac97_res_table. So mark the non-const structs as const. Signed-off-by: Arvind Yadav Signed-off-by: Takashi Iwai --- sound/pci/nm256/nm256.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound/pci') diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c index 0ef8054c3936..b97f4ea6b56c 100644 --- a/sound/pci/nm256/nm256.c +++ b/sound/pci/nm256/nm256.c @@ -1271,7 +1271,7 @@ snd_nm256_ac97_write(struct snd_ac97 *ac97, } /* static resolution table */ -static struct snd_ac97_res_table nm256_res_table[] = { +static const struct snd_ac97_res_table nm256_res_table[] = { { AC97_MASTER, 0x1f1f }, { AC97_HEADPHONE, 0x1f1f }, { AC97_MASTER_MONO, 0x001f }, -- cgit From 874b83d396bb41886e70876afe783a0d81d79583 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 31 Aug 2017 10:56:50 +0200 Subject: ALSA: asihpi: Put missing KERN_CONT prefix The asihpi driver has a debug printk code without proper KERN_ prefix. On recent kernels, KERN_CONT prefix is mandatory for continued output lines. Put it properly. Signed-off-by: Takashi Iwai --- sound/pci/asihpi/hpidebug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/asihpi/hpidebug.c b/sound/pci/asihpi/hpidebug.c index ac86a1f1d3bf..9e122327dc05 100644 --- a/sound/pci/asihpi/hpidebug.c +++ b/sound/pci/asihpi/hpidebug.c @@ -71,8 +71,8 @@ void hpi_debug_data(u16 *pdata, u32 len) printk(KERN_DEBUG "%p:", (pdata + i)); for (k = 0; k < cols && i < len; i++, k++) - printk("%s%04x", k == 0 ? "" : " ", pdata[i]); + printk(KERN_CONT "%s%04x", k == 0 ? "" : " ", pdata[i]); - printk("\n"); + printk(KERN_CONT "\n"); } } -- cgit From 39cdc62b1b4efa39831d4de22f990043b0304fff Mon Sep 17 00:00:00 2001 From: Himanshu Jha Date: Thu, 31 Aug 2017 20:36:42 +0530 Subject: ALSA: ctxfi: Remove null check before kfree kfree on NULL pointer is a no-op and therefore checking is redundant. Signed-off-by: Himanshu Jha Signed-off-by: Takashi Iwai --- sound/pci/ctxfi/ctresource.c | 6 ++---- sound/pci/ctxfi/ctsrc.c | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'sound/pci') diff --git a/sound/pci/ctxfi/ctresource.c b/sound/pci/ctxfi/ctresource.c index c5124c3c0fd1..80c4d84f9667 100644 --- a/sound/pci/ctxfi/ctresource.c +++ b/sound/pci/ctxfi/ctresource.c @@ -258,10 +258,8 @@ error: int rsc_mgr_uninit(struct rsc_mgr *mgr) { - if (NULL != mgr->rscs) { - kfree(mgr->rscs); - mgr->rscs = NULL; - } + kfree(mgr->rscs); + mgr->rscs = NULL; if ((NULL != mgr->hw) && (NULL != mgr->ctrl_blk)) { switch (mgr->type) { diff --git a/sound/pci/ctxfi/ctsrc.c b/sound/pci/ctxfi/ctsrc.c index a5a72df29801..bb4c9c3c89ae 100644 --- a/sound/pci/ctxfi/ctsrc.c +++ b/sound/pci/ctxfi/ctsrc.c @@ -702,10 +702,8 @@ error1: static int srcimp_rsc_uninit(struct srcimp *srcimp) { - if (NULL != srcimp->imappers) { - kfree(srcimp->imappers); - srcimp->imappers = NULL; - } + kfree(srcimp->imappers); + srcimp->imappers = NULL; srcimp->ops = NULL; srcimp->mgr = NULL; rsc_uninit(&srcimp->rsc); -- cgit