ALSA: Replace the magic number 44 with const
authorTakashi Iwai <tiwai@suse.de>
Fri, 28 Jun 2013 09:56:49 +0000 (11:56 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 28 Jun 2013 10:14:44 +0000 (12:14 +0200)
The char arrays with size 44 are for the name string of
snd_ctl_elem_id.  Define the constant and replace the raw numbers with
it for clarifying better.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
include/uapi/sound/asound.h
sound/pci/ac97/ac97_codec.c
sound/pci/asihpi/asihpi.c
sound/pci/hda/hda_generic.c
sound/pci/hda/hda_jack.c
sound/pci/hda/patch_ca0132.c

index e3983d508272cf1fd1b566eec395800bd14a2a96..041203f20f6d1cb3cac42df78723356550729054 100644 (file)
@@ -817,6 +817,8 @@ typedef int __bitwise snd_ctl_elem_iface_t;
 #define SNDRV_CTL_POWER_D3hot          (SNDRV_CTL_POWER_D3|0x0000)     /* Off, with power */
 #define SNDRV_CTL_POWER_D3cold         (SNDRV_CTL_POWER_D3|0x0001)     /* Off, without power */
 
+#define SNDRV_CTL_ELEM_ID_NAME_MAXLEN  44
+
 struct snd_ctl_elem_id {
        unsigned int numid;             /* numeric identifier, zero = invalid */
        snd_ctl_elem_iface_t iface;     /* interface identifier */
index d37c683cfd7a62125857ce9c5ca848a101afcefb..445ca481d8d30116bc075e3ac2cee881f1149863 100644 (file)
@@ -1296,7 +1296,7 @@ static int snd_ac97_cmix_new_stereo(struct snd_card *card, const char *pfx,
                                    struct snd_ac97 *ac97)
 {
        int err;
-       char name[44];
+       char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
        unsigned char lo_max, hi_max;
 
        if (! snd_ac97_valid_reg(ac97, reg))
index fbc17203613c05f874e765ae30df13f12add9324..185d54a5cb1af5765f2c2ae8f09af36f28f55de2 100644 (file)
@@ -1278,7 +1278,7 @@ struct hpi_control {
        u16 dst_node_type;
        u16 dst_node_index;
        u16 band;
-       char name[44]; /* copied to snd_ctl_elem_id.name[44]; */
+       char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* copied to snd_ctl_elem_id.name[44]; */
 };
 
 static const char * const asihpi_tuner_band_names[] = {
index 6460fc519d360b5b62bf50cf94ae28dc8c78a6b9..8e77cbbad871dd4ff10263824d016487b1479813 100644 (file)
@@ -854,7 +854,7 @@ static int add_control_with_pfx(struct hda_gen_spec *spec, int type,
                                const char *pfx, const char *dir,
                                const char *sfx, int cidx, unsigned long val)
 {
-       char name[44];
+       char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
        snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
        if (!add_control(spec, type, name, cidx, val))
                return -ENOMEM;
@@ -1931,7 +1931,7 @@ static int create_extra_outs(struct hda_codec *codec, int num_pins,
 
        for (i = 0; i < num_pins; i++) {
                const char *name;
-               char tmp[44];
+               char tmp[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
                int err, idx = 0;
 
                if (num_pins == 2 && i == 1 && !strcmp(pfx, "Speaker"))
@@ -2484,7 +2484,7 @@ static int create_out_jack_modes(struct hda_codec *codec, int num_pins,
                }
                if (get_out_jack_num_items(codec, pin) > 1) {
                        struct snd_kcontrol_new *knew;
-                       char name[44];
+                       char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
                        get_jack_mode_name(codec, pin, name, sizeof(name));
                        knew = snd_hda_gen_add_kctl(spec, name,
                                                    &out_jack_mode_enum);
@@ -2616,7 +2616,7 @@ static int create_in_jack_mode(struct hda_codec *codec, hda_nid_t pin)
 {
        struct hda_gen_spec *spec = codec->spec;
        struct snd_kcontrol_new *knew;
-       char name[44];
+       char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
        unsigned int defcfg;
 
        if (pin == spec->hp_mic_pin)
@@ -3316,7 +3316,7 @@ static int add_single_cap_ctl(struct hda_codec *codec, const char *label,
                              bool inv_dmic)
 {
        struct hda_gen_spec *spec = codec->spec;
-       char tmpname[44];
+       char tmpname[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
        int type = is_switch ? HDA_CTL_WIDGET_MUTE : HDA_CTL_WIDGET_VOL;
        const char *sfx = is_switch ? "Switch" : "Volume";
        unsigned int chs = inv_dmic ? 1 : 3;
@@ -3578,7 +3578,7 @@ static int parse_mic_boost(struct hda_codec *codec)
                struct nid_path *path;
                unsigned int val;
                int idx;
-               char boost_label[44];
+               char boost_label[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
 
                idx = imux->items[i].index;
                if (idx >= imux->num_items)
index 9e0a95288f46fcca24fa0944fc99cd134e0d7c2e..3fd2973183e2dda266a78c00a96bc5517b5bb29f 100644 (file)
@@ -398,7 +398,7 @@ static int add_jack_kctl(struct hda_codec *codec, hda_nid_t nid,
                         const char *base_name)
 {
        unsigned int def_conf, conn;
-       char name[44];
+       char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
        int idx, err;
        bool phantom_jack;
 
index 90ff7a3f72dff8de71a4b1fa0a338d00e8579006..6e9876f27d959a64e14443ceab5efaed9f11d44b 100644 (file)
@@ -139,7 +139,7 @@ enum {
 #define DSP_SPEAKER_OUT_LATENCY         7
 
 struct ct_effect {
-       char name[44];
+       char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
        hda_nid_t nid;
        int mid; /*effect module ID*/
        int reqs[EFFECT_VALS_MAX_COUNT]; /*effect module request*/
@@ -270,7 +270,7 @@ enum {
 };
 
 struct ct_tuning_ctl {
-       char name[44];
+       char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
        hda_nid_t parent_nid;
        hda_nid_t nid;
        int mid; /*effect module ID*/
@@ -3103,7 +3103,7 @@ static int add_tuning_control(struct hda_codec *codec,
                                hda_nid_t pnid, hda_nid_t nid,
                                const char *name, int dir)
 {
-       char namestr[44];
+       char namestr[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
        int type = dir ? HDA_INPUT : HDA_OUTPUT;
        struct snd_kcontrol_new knew =
                HDA_CODEC_VOLUME_MONO(namestr, nid, 1, 0, type);
@@ -3935,7 +3935,7 @@ static int ca0132_volume_tlv(struct snd_kcontrol *kcontrol, int op_flag,
 static int add_fx_switch(struct hda_codec *codec, hda_nid_t nid,
                         const char *pfx, int dir)
 {
-       char namestr[44];
+       char namestr[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
        int type = dir ? HDA_INPUT : HDA_OUTPUT;
        struct snd_kcontrol_new knew =
                CA0132_CODEC_MUTE_MONO(namestr, nid, 1, type);