Skip to content

Commit

Permalink
ALSA: hda - Constify some API function arguments
Browse files Browse the repository at this point in the history
Also fixed the assignment of multiout.dac_nids to satisfy const.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Takashi Iwai committed May 2, 2011
1 parent a911132 commit dda1441
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 59 deletions.
14 changes: 7 additions & 7 deletions sound/pci/hda/hda_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -2621,7 +2621,7 @@ static unsigned int convert_to_spdif_status(unsigned short val)
static void set_dig_out(struct hda_codec *codec, hda_nid_t nid,
int verb, int val)
{
hda_nid_t *d;
const hda_nid_t *d;

snd_hda_codec_write_cache(codec, nid, 0, verb, val);
d = codec->slave_dig_outs;
Expand Down Expand Up @@ -4184,7 +4184,7 @@ static void setup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid,
-1);
snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format);
if (codec->slave_dig_outs) {
hda_nid_t *d;
const hda_nid_t *d;
for (d = codec->slave_dig_outs; *d; d++)
snd_hda_codec_setup_stream(codec, *d, stream_tag, 0,
format);
Expand All @@ -4199,7 +4199,7 @@ static void cleanup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid)
{
snd_hda_codec_cleanup_stream(codec, nid);
if (codec->slave_dig_outs) {
hda_nid_t *d;
const hda_nid_t *d;
for (d = codec->slave_dig_outs; *d; d++)
snd_hda_codec_cleanup_stream(codec, *d);
}
Expand Down Expand Up @@ -4346,7 +4346,7 @@ int snd_hda_multi_out_analog_prepare(struct hda_codec *codec,
unsigned int format,
struct snd_pcm_substream *substream)
{
hda_nid_t *nids = mout->dac_nids;
const hda_nid_t *nids = mout->dac_nids;
int chs = substream->runtime->channels;
int i;

Expand Down Expand Up @@ -4401,7 +4401,7 @@ EXPORT_SYMBOL_HDA(snd_hda_multi_out_analog_prepare);
int snd_hda_multi_out_analog_cleanup(struct hda_codec *codec,
struct hda_multi_out *mout)
{
hda_nid_t *nids = mout->dac_nids;
const hda_nid_t *nids = mout->dac_nids;
int i;

for (i = 0; i < mout->num_dacs; i++)
Expand All @@ -4426,7 +4426,7 @@ EXPORT_SYMBOL_HDA(snd_hda_multi_out_analog_cleanup);
* Helper for automatic pin configuration
*/

static int is_in_nid_list(hda_nid_t nid, hda_nid_t *list)
static int is_in_nid_list(hda_nid_t nid, const hda_nid_t *list)
{
for (; *list; list++)
if (*list == nid)
Expand Down Expand Up @@ -4507,7 +4507,7 @@ static void sort_autocfg_input_pins(struct auto_pin_cfg *cfg)
*/
int snd_hda_parse_pin_def_config(struct hda_codec *codec,
struct auto_pin_cfg *cfg,
hda_nid_t *ignore_nids)
const hda_nid_t *ignore_nids)
{
hda_nid_t nid, end_nid;
short seq, assoc_line_out, assoc_speaker;
Expand Down
2 changes: 1 addition & 1 deletion sound/pci/hda/hda_codec.h
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ struct hda_codec {
unsigned int spdif_status; /* IEC958 status bits */
unsigned short spdif_ctls; /* SPDIF control bits */
unsigned int spdif_in_enable; /* SPDIF input enable? */
hda_nid_t *slave_dig_outs; /* optional digital out slave widgets */
const hda_nid_t *slave_dig_outs; /* optional digital out slave widgets */
struct snd_array init_pins; /* initial (BIOS) pin configurations */
struct snd_array driver_pins; /* pin configs set by codec parser */
struct snd_array cvt_setups; /* audio convert setups */
Expand Down
6 changes: 3 additions & 3 deletions sound/pci/hda/hda_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,11 @@ enum { HDA_DIG_NONE, HDA_DIG_EXCLUSIVE, HDA_DIG_ANALOG_DUP }; /* dig_out_used */

struct hda_multi_out {
int num_dacs; /* # of DACs, must be more than 1 */
hda_nid_t *dac_nids; /* DAC list */
const hda_nid_t *dac_nids; /* DAC list */
hda_nid_t hp_nid; /* optional DAC for HP, 0 when not exists */
hda_nid_t extra_out_nid[3]; /* optional DACs, 0 when not exists */
hda_nid_t dig_out_nid; /* digital out audio widget */
hda_nid_t *slave_dig_outs;
const hda_nid_t *slave_dig_outs;
int max_channels; /* currently supported analog channels */
int dig_out_used; /* current usage of digital out (HDA_DIG_XXX) */
int no_share_stream; /* don't share a stream with multiple pins */
Expand Down Expand Up @@ -443,7 +443,7 @@ struct auto_pin_cfg {

int snd_hda_parse_pin_def_config(struct hda_codec *codec,
struct auto_pin_cfg *cfg,
hda_nid_t *ignore_nids);
const hda_nid_t *ignore_nids);

/* amp values */
#define AMP_IN_MUTE(idx) (0x7080 | ((idx)<<8))
Expand Down
2 changes: 1 addition & 1 deletion sound/pci/hda/patch_analog.c
Original file line number Diff line number Diff line change
Expand Up @@ -2845,7 +2845,7 @@ static int ad1988_auto_fill_dac_nids(struct hda_codec *codec,
/* check the pins hardwired to audio widget */
for (i = 0; i < cfg->line_outs; i++) {
idx = ad1988_pin_idx(cfg->line_out_pins[i]);
spec->multiout.dac_nids[i] = ad1988_idx_to_dac(codec, idx);
spec->private_dac_nids[i] = ad1988_idx_to_dac(codec, idx);
}
spec->multiout.num_dacs = cfg->line_outs;
return 0;
Expand Down
18 changes: 9 additions & 9 deletions sound/pci/hda/patch_realtek.c
Original file line number Diff line number Diff line change
Expand Up @@ -5294,7 +5294,7 @@ static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
nid = cfg->line_out_pins[i];
if (alc880_is_fixed_pin(nid)) {
int idx = alc880_fixed_pin_idx(nid);
spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
spec->private_dac_nids[i] = alc880_idx_to_dac(idx);
assigned[idx] = 1;
}
}
Expand All @@ -5306,7 +5306,7 @@ static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
/* search for an empty channel */
for (j = 0; j < cfg->line_outs; j++) {
if (!assigned[j]) {
spec->multiout.dac_nids[i] =
spec->private_dac_nids[i] =
alc880_idx_to_dac(j);
assigned[j] = 1;
break;
Expand Down Expand Up @@ -7131,7 +7131,7 @@ static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,

spec->multiout.num_dacs = 1;
spec->multiout.dac_nids = spec->private_dac_nids;
spec->multiout.dac_nids[0] = 0x02;
spec->private_dac_nids[0] = 0x02;

nid = cfg->line_out_pins[0];
if (nid) {
Expand Down Expand Up @@ -12214,7 +12214,7 @@ static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,

spec->multiout.num_dacs = 1; /* only use one dac */
spec->multiout.dac_nids = spec->private_dac_nids;
spec->multiout.dac_nids[0] = 2;
spec->private_dac_nids[0] = 2;

pfx = alc_get_line_out_pfx(spec, true);
if (!pfx)
Expand Down Expand Up @@ -13553,7 +13553,7 @@ static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
HDA_OUTPUT));
if (err < 0)
return err;
spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
}

if (nid != 0x16)
Expand Down Expand Up @@ -15951,7 +15951,7 @@ static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
dac = alc861_look_for_dac(codec, nid);
if (!dac)
continue;
spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
}
return 0;
}
Expand Down Expand Up @@ -18932,7 +18932,7 @@ static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
dac = alc_auto_look_for_dac(codec, cfg->line_out_pins[i]);
if (!dac)
continue;
spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
}
return 0;
}
Expand Down Expand Up @@ -19166,7 +19166,7 @@ static int alc_auto_fill_multi_ios(struct hda_codec *codec,
spec->multi_io[num_pins].pin = nid;
spec->multi_io[num_pins].dac = dac;
num_pins++;
spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
}
}
spec->multiout.num_dacs = 1;
Expand Down Expand Up @@ -19786,7 +19786,7 @@ static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid,

if (err < 0)
return err;
spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
}

return 0;
Expand Down
3 changes: 2 additions & 1 deletion sound/pci/hda/patch_sigmatel.c
Original file line number Diff line number Diff line change
Expand Up @@ -3072,7 +3072,8 @@ static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid)
printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid);
return 1;
} else {
spec->multiout.dac_nids[spec->multiout.num_dacs] = nid;
snd_BUG_ON(spec->multiout.dac_nids != spec->dac_nids);
spec->dac_nids[spec->multiout.num_dacs] = nid;
spec->multiout.num_dacs++;
}
return 0;
Expand Down
Loading

0 comments on commit dda1441

Please sign in to comment.