ALSA: hda - Don't export symbols when built-in kernel

The global functions in hda_codec.c and other core parts are only
for HD-audio codec and controller drivers.  When the HD-audio driver
is built in kernel, all stuff have to be statically linked, thus
we don't need any exports.

This patch introduces a conditional macro to do export only
when needed.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c
index e6cc946..e00421c 100644
--- a/sound/pci/hda/hda_beep.c
+++ b/sound/pci/hda/hda_beep.c
@@ -128,7 +128,7 @@
 	INIT_WORK(&beep->beep_work, &snd_hda_generate_beep);
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_attach_beep_device);
+EXPORT_SYMBOL_HDA(snd_hda_attach_beep_device);
 
 void snd_hda_detach_beep_device(struct hda_codec *codec)
 {
@@ -141,4 +141,4 @@
 		kfree(beep);
 	}
 }
-EXPORT_SYMBOL_GPL(snd_hda_detach_beep_device);
+EXPORT_SYMBOL_HDA(snd_hda_detach_beep_device);
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 2fff0fb..0043448 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -71,7 +71,7 @@
 	mutex_unlock(&preset_mutex);
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_add_codec_preset);
+EXPORT_SYMBOL_HDA(snd_hda_add_codec_preset);
 
 int snd_hda_delete_codec_preset(struct hda_codec_preset_list *preset)
 {
@@ -80,7 +80,7 @@
 	mutex_unlock(&preset_mutex);
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_delete_codec_preset);
+EXPORT_SYMBOL_HDA(snd_hda_delete_codec_preset);
 
 #ifdef CONFIG_SND_HDA_POWER_SAVE
 static void hda_power_work(struct work_struct *work);
@@ -114,7 +114,7 @@
 	}
 	return "UNKNOWN";
 }
-EXPORT_SYMBOL_GPL(snd_hda_get_jack_location);
+EXPORT_SYMBOL_HDA(snd_hda_get_jack_location);
 
 const char *snd_hda_get_jack_connectivity(u32 cfg)
 {
@@ -122,7 +122,7 @@
 
 	return jack_locations[(cfg >> (AC_DEFCFG_LOCATION_SHIFT + 4)) & 3];
 }
-EXPORT_SYMBOL_GPL(snd_hda_get_jack_connectivity);
+EXPORT_SYMBOL_HDA(snd_hda_get_jack_connectivity);
 
 const char *snd_hda_get_jack_type(u32 cfg)
 {
@@ -136,7 +136,7 @@
 	return jack_types[(cfg & AC_DEFCFG_DEVICE)
 				>> AC_DEFCFG_DEVICE_SHIFT];
 }
-EXPORT_SYMBOL_GPL(snd_hda_get_jack_type);
+EXPORT_SYMBOL_HDA(snd_hda_get_jack_type);
 
 /*
  * Compose a 32bit command word to be sent to the HD-audio controller
@@ -185,7 +185,7 @@
 	snd_hda_power_down(codec);
 	return res;
 }
-EXPORT_SYMBOL_GPL(snd_hda_codec_read);
+EXPORT_SYMBOL_HDA(snd_hda_codec_read);
 
 /**
  * snd_hda_codec_write - send a single command without waiting for response
@@ -214,7 +214,7 @@
 	snd_hda_power_down(codec);
 	return err;
 }
-EXPORT_SYMBOL_GPL(snd_hda_codec_write);
+EXPORT_SYMBOL_HDA(snd_hda_codec_write);
 
 /**
  * snd_hda_sequence_write - sequence writes
@@ -229,7 +229,7 @@
 	for (; seq->nid; seq++)
 		snd_hda_codec_write(codec, seq->nid, 0, seq->verb, seq->param);
 }
-EXPORT_SYMBOL_GPL(snd_hda_sequence_write);
+EXPORT_SYMBOL_HDA(snd_hda_sequence_write);
 
 /**
  * snd_hda_get_sub_nodes - get the range of sub nodes
@@ -251,7 +251,7 @@
 	*start_id = (parm >> 16) & 0x7fff;
 	return (int)(parm & 0x7fff);
 }
-EXPORT_SYMBOL_GPL(snd_hda_get_sub_nodes);
+EXPORT_SYMBOL_HDA(snd_hda_get_sub_nodes);
 
 /**
  * snd_hda_get_connections - get connection list
@@ -340,7 +340,7 @@
 	}
 	return conns;
 }
-EXPORT_SYMBOL_GPL(snd_hda_get_connections);
+EXPORT_SYMBOL_HDA(snd_hda_get_connections);
 
 
 /**
@@ -375,7 +375,7 @@
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_queue_unsol_event);
+EXPORT_SYMBOL_HDA(snd_hda_queue_unsol_event);
 
 /*
  * process queued unsolicited events
@@ -521,7 +521,7 @@
 		*busp = bus;
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_bus_new);
+EXPORT_SYMBOL_HDA(snd_hda_bus_new);
 
 #ifdef CONFIG_SND_HDA_GENERIC
 #define is_generic_config(codec) \
@@ -808,7 +808,7 @@
 		*codecp = codec;
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_codec_new);
+EXPORT_SYMBOL_HDA(snd_hda_codec_new);
 
 int snd_hda_codec_configure(struct hda_codec *codec)
 {
@@ -868,7 +868,7 @@
 	msleep(1);
 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, format);
 }
-EXPORT_SYMBOL_GPL(snd_hda_codec_setup_stream);
+EXPORT_SYMBOL_HDA(snd_hda_codec_setup_stream);
 
 void snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid)
 {
@@ -882,7 +882,7 @@
 	snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, 0);
 #endif
 }
-EXPORT_SYMBOL_GPL(snd_hda_codec_cleanup_stream);
+EXPORT_SYMBOL_HDA(snd_hda_codec_cleanup_stream);
 
 /*
  * amp access functions
@@ -964,7 +964,7 @@
 	}
 	return info->amp_caps;
 }
-EXPORT_SYMBOL_GPL(query_amp_caps);
+EXPORT_SYMBOL_HDA(query_amp_caps);
 
 int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir,
 			      unsigned int caps)
@@ -978,7 +978,7 @@
 	info->head.val |= INFO_AMP_CAPS;
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_override_amp_caps);
+EXPORT_SYMBOL_HDA(snd_hda_override_amp_caps);
 
 /*
  * read the current volume to info
@@ -1032,7 +1032,7 @@
 		return 0;
 	return get_vol_mute(codec, info, nid, ch, direction, index);
 }
-EXPORT_SYMBOL_GPL(snd_hda_codec_amp_read);
+EXPORT_SYMBOL_HDA(snd_hda_codec_amp_read);
 
 /*
  * update the AMP value, mask = bit mask to set, val = the value
@@ -1052,7 +1052,7 @@
 	put_vol_mute(codec, info, nid, ch, direction, idx, val);
 	return 1;
 }
-EXPORT_SYMBOL_GPL(snd_hda_codec_amp_update);
+EXPORT_SYMBOL_HDA(snd_hda_codec_amp_update);
 
 /*
  * update the AMP stereo with the same mask and value
@@ -1066,7 +1066,7 @@
 						idx, mask, val);
 	return ret;
 }
-EXPORT_SYMBOL_GPL(snd_hda_codec_amp_stereo);
+EXPORT_SYMBOL_HDA(snd_hda_codec_amp_stereo);
 
 #ifdef SND_HDA_NEEDS_RESUME
 /* resume the all amp commands from the cache */
@@ -1092,7 +1092,7 @@
 		}
 	}
 }
-EXPORT_SYMBOL_GPL(snd_hda_codec_resume_amp);
+EXPORT_SYMBOL_HDA(snd_hda_codec_resume_amp);
 #endif /* SND_HDA_NEEDS_RESUME */
 
 /* volume */
@@ -1120,7 +1120,7 @@
 	uinfo->value.integer.max = caps;
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_volume_info);
+EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_volume_info);
 
 int snd_hda_mixer_amp_volume_get(struct snd_kcontrol *kcontrol,
 				 struct snd_ctl_elem_value *ucontrol)
@@ -1140,7 +1140,7 @@
 			& HDA_AMP_VOLMASK;
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_volume_get);
+EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_volume_get);
 
 int snd_hda_mixer_amp_volume_put(struct snd_kcontrol *kcontrol,
 				 struct snd_ctl_elem_value *ucontrol)
@@ -1165,7 +1165,7 @@
 	snd_hda_power_down(codec);
 	return change;
 }
-EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_volume_put);
+EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_volume_put);
 
 int snd_hda_mixer_amp_tlv(struct snd_kcontrol *kcontrol, int op_flag,
 			  unsigned int size, unsigned int __user *_tlv)
@@ -1192,7 +1192,7 @@
 		return -EFAULT;
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_tlv);
+EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_tlv);
 
 /*
  * set (static) TLV for virtual master volume; recalculated as max 0dB
@@ -1212,7 +1212,7 @@
 	tlv[2] = -nums * step;
 	tlv[3] = step;
 }
-EXPORT_SYMBOL_GPL(snd_hda_set_vmaster_tlv);
+EXPORT_SYMBOL_HDA(snd_hda_set_vmaster_tlv);
 
 /* find a mixer control element with the given name */
 static struct snd_kcontrol *
@@ -1232,7 +1232,7 @@
 {
 	return _snd_hda_find_mixer_ctl(codec, name, 0);
 }
-EXPORT_SYMBOL_GPL(snd_hda_find_mixer_ctl);
+EXPORT_SYMBOL_HDA(snd_hda_find_mixer_ctl);
 
 /* Add a control element and assign to the codec */
 int snd_hda_ctl_add(struct hda_codec *codec, struct snd_kcontrol *kctl)
@@ -1249,7 +1249,7 @@
 	*knewp = kctl;
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_ctl_add);
+EXPORT_SYMBOL_HDA(snd_hda_ctl_add);
 
 #ifdef CONFIG_SND_HDA_RECONFIG
 /* Clear all controls assigned to the given codec */
@@ -1328,7 +1328,7 @@
 	}
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_add_vmaster);
+EXPORT_SYMBOL_HDA(snd_hda_add_vmaster);
 
 /* switch */
 int snd_hda_mixer_amp_switch_info(struct snd_kcontrol *kcontrol,
@@ -1342,7 +1342,7 @@
 	uinfo->value.integer.max = 1;
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_switch_info);
+EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_switch_info);
 
 int snd_hda_mixer_amp_switch_get(struct snd_kcontrol *kcontrol,
 				 struct snd_ctl_elem_value *ucontrol)
@@ -1362,7 +1362,7 @@
 			 HDA_AMP_MUTE) ? 0 : 1;
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_switch_get);
+EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_switch_get);
 
 int snd_hda_mixer_amp_switch_put(struct snd_kcontrol *kcontrol,
 				 struct snd_ctl_elem_value *ucontrol)
@@ -1393,7 +1393,7 @@
 	snd_hda_power_down(codec);
 	return change;
 }
-EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_switch_put);
+EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_switch_put);
 
 /*
  * bound volume controls
@@ -1419,7 +1419,7 @@
 	mutex_unlock(&codec->spdif_mutex);
 	return err;
 }
-EXPORT_SYMBOL_GPL(snd_hda_mixer_bind_switch_get);
+EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_switch_get);
 
 int snd_hda_mixer_bind_switch_put(struct snd_kcontrol *kcontrol,
 				  struct snd_ctl_elem_value *ucontrol)
@@ -1443,7 +1443,7 @@
 	mutex_unlock(&codec->spdif_mutex);
 	return err < 0 ? err : change;
 }
-EXPORT_SYMBOL_GPL(snd_hda_mixer_bind_switch_put);
+EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_switch_put);
 
 /*
  * generic bound volume/swtich controls
@@ -1463,7 +1463,7 @@
 	mutex_unlock(&codec->spdif_mutex);
 	return err;
 }
-EXPORT_SYMBOL_GPL(snd_hda_mixer_bind_ctls_info);
+EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_ctls_info);
 
 int snd_hda_mixer_bind_ctls_get(struct snd_kcontrol *kcontrol,
 				struct snd_ctl_elem_value *ucontrol)
@@ -1480,7 +1480,7 @@
 	mutex_unlock(&codec->spdif_mutex);
 	return err;
 }
-EXPORT_SYMBOL_GPL(snd_hda_mixer_bind_ctls_get);
+EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_ctls_get);
 
 int snd_hda_mixer_bind_ctls_put(struct snd_kcontrol *kcontrol,
 				struct snd_ctl_elem_value *ucontrol)
@@ -1503,7 +1503,7 @@
 	mutex_unlock(&codec->spdif_mutex);
 	return err < 0 ? err : change;
 }
-EXPORT_SYMBOL_GPL(snd_hda_mixer_bind_ctls_put);
+EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_ctls_put);
 
 int snd_hda_mixer_bind_tlv(struct snd_kcontrol *kcontrol, int op_flag,
 			   unsigned int size, unsigned int __user *tlv)
@@ -1520,7 +1520,7 @@
 	mutex_unlock(&codec->spdif_mutex);
 	return err;
 }
-EXPORT_SYMBOL_GPL(snd_hda_mixer_bind_tlv);
+EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_tlv);
 
 struct hda_ctl_ops snd_hda_bind_vol = {
 	.info = snd_hda_mixer_amp_volume_info,
@@ -1528,7 +1528,7 @@
 	.put = snd_hda_mixer_amp_volume_put,
 	.tlv = snd_hda_mixer_amp_tlv
 };
-EXPORT_SYMBOL_GPL(snd_hda_bind_vol);
+EXPORT_SYMBOL_HDA(snd_hda_bind_vol);
 
 struct hda_ctl_ops snd_hda_bind_sw = {
 	.info = snd_hda_mixer_amp_switch_info,
@@ -1536,7 +1536,7 @@
 	.put = snd_hda_mixer_amp_switch_put,
 	.tlv = snd_hda_mixer_amp_tlv
 };
-EXPORT_SYMBOL_GPL(snd_hda_bind_sw);
+EXPORT_SYMBOL_HDA(snd_hda_bind_sw);
 
 /*
  * SPDIF out controls
@@ -1798,7 +1798,7 @@
 	codec->spdif_status = convert_to_spdif_status(codec->spdif_ctls);
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_create_spdif_out_ctls);
+EXPORT_SYMBOL_HDA(snd_hda_create_spdif_out_ctls);
 
 /*
  * SPDIF sharing with analog output
@@ -1836,7 +1836,7 @@
 	return snd_hda_ctl_add(codec,
 			   snd_ctl_new1(&spdif_share_sw, mout));
 }
-EXPORT_SYMBOL_GPL(snd_hda_create_spdif_share_sw);
+EXPORT_SYMBOL_HDA(snd_hda_create_spdif_share_sw);
 
 /*
  * SPDIF input
@@ -1946,7 +1946,7 @@
 		AC_DIG1_ENABLE;
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_create_spdif_in_ctls);
+EXPORT_SYMBOL_HDA(snd_hda_create_spdif_in_ctls);
 
 #ifdef SND_HDA_NEEDS_RESUME
 /*
@@ -1992,7 +1992,7 @@
 	snd_hda_power_down(codec);
 	return err;
 }
-EXPORT_SYMBOL_GPL(snd_hda_codec_write_cache);
+EXPORT_SYMBOL_HDA(snd_hda_codec_write_cache);
 
 /* resume the all commands from the cache */
 void snd_hda_codec_resume_cache(struct hda_codec *codec)
@@ -2008,7 +2008,7 @@
 				    get_cmd_cache_cmd(key), buffer->val);
 	}
 }
-EXPORT_SYMBOL_GPL(snd_hda_codec_resume_cache);
+EXPORT_SYMBOL_HDA(snd_hda_codec_resume_cache);
 
 /**
  * snd_hda_sequence_write_cache - sequence writes with caching
@@ -2026,7 +2026,7 @@
 		snd_hda_codec_write_cache(codec, seq->nid, 0, seq->verb,
 					  seq->param);
 }
-EXPORT_SYMBOL_GPL(snd_hda_sequence_write_cache);
+EXPORT_SYMBOL_HDA(snd_hda_sequence_write_cache);
 #endif /* SND_HDA_NEEDS_RESUME */
 
 /*
@@ -2156,7 +2156,7 @@
 	}
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_build_controls);
+EXPORT_SYMBOL_HDA(snd_hda_build_controls);
 
 int snd_hda_codec_build_controls(struct hda_codec *codec)
 {
@@ -2268,7 +2268,7 @@
 
 	return val;
 }
-EXPORT_SYMBOL_GPL(snd_hda_calc_stream_format);
+EXPORT_SYMBOL_HDA(snd_hda_calc_stream_format);
 
 /**
  * snd_hda_query_supported_pcm - query the supported PCM rates and formats
@@ -2448,7 +2448,7 @@
 
 	return 1;
 }
-EXPORT_SYMBOL_GPL(snd_hda_is_supported_format);
+EXPORT_SYMBOL_HDA(snd_hda_is_supported_format);
 
 /*
  * PCM stuff
@@ -2646,7 +2646,7 @@
 	}
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_build_pcms);
+EXPORT_SYMBOL_HDA(snd_hda_build_pcms);
 
 /**
  * snd_hda_check_board_config - compare the current codec with the config table
@@ -2702,7 +2702,7 @@
 	}
 	return -1;
 }
-EXPORT_SYMBOL_GPL(snd_hda_check_board_config);
+EXPORT_SYMBOL_HDA(snd_hda_check_board_config);
 
 /**
  * snd_hda_add_new_ctls - create controls from the array
@@ -2738,7 +2738,7 @@
 	}
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_add_new_ctls);
+EXPORT_SYMBOL_HDA(snd_hda_add_new_ctls);
 
 #ifdef CONFIG_SND_HDA_POWER_SAVE
 static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg,
@@ -2781,7 +2781,7 @@
 	cancel_delayed_work(&codec->power_work);
 	codec->power_transition = 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_power_up);
+EXPORT_SYMBOL_HDA(snd_hda_power_up);
 
 #define power_save(codec)	\
 	((codec)->bus->power_save ? *(codec)->bus->power_save : 0)
@@ -2800,7 +2800,7 @@
 				msecs_to_jiffies(power_save(codec) * 1000));
 	}
 }
-EXPORT_SYMBOL_GPL(snd_hda_power_down);
+EXPORT_SYMBOL_HDA(snd_hda_power_down);
 
 int snd_hda_check_amp_list_power(struct hda_codec *codec,
 				 struct hda_loopback_check *check,
@@ -2837,7 +2837,7 @@
 	}
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_check_amp_list_power);
+EXPORT_SYMBOL_HDA(snd_hda_check_amp_list_power);
 #endif
 
 /*
@@ -2857,7 +2857,7 @@
 		chmode[uinfo->value.enumerated.item].channels);
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_ch_mode_info);
+EXPORT_SYMBOL_HDA(snd_hda_ch_mode_info);
 
 int snd_hda_ch_mode_get(struct hda_codec *codec,
 			struct snd_ctl_elem_value *ucontrol,
@@ -2875,7 +2875,7 @@
 	}
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_ch_mode_get);
+EXPORT_SYMBOL_HDA(snd_hda_ch_mode_get);
 
 int snd_hda_ch_mode_put(struct hda_codec *codec,
 			struct snd_ctl_elem_value *ucontrol,
@@ -2896,7 +2896,7 @@
 		snd_hda_sequence_write_cache(codec, chmode[mode].sequence);
 	return 1;
 }
-EXPORT_SYMBOL_GPL(snd_hda_ch_mode_put);
+EXPORT_SYMBOL_HDA(snd_hda_ch_mode_put);
 
 /*
  * input MUX helper
@@ -2917,7 +2917,7 @@
 	strcpy(uinfo->value.enumerated.name, imux->items[index].label);
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_input_mux_info);
+EXPORT_SYMBOL_HDA(snd_hda_input_mux_info);
 
 int snd_hda_input_mux_put(struct hda_codec *codec,
 			  const struct hda_input_mux *imux,
@@ -2939,7 +2939,7 @@
 	*cur_val = idx;
 	return 1;
 }
-EXPORT_SYMBOL_GPL(snd_hda_input_mux_put);
+EXPORT_SYMBOL_HDA(snd_hda_input_mux_put);
 
 
 /*
@@ -2992,7 +2992,7 @@
 	mutex_unlock(&codec->spdif_mutex);
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_multi_out_dig_open);
+EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_open);
 
 int snd_hda_multi_out_dig_prepare(struct hda_codec *codec,
 				  struct hda_multi_out *mout,
@@ -3005,7 +3005,7 @@
 	mutex_unlock(&codec->spdif_mutex);
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_multi_out_dig_prepare);
+EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_prepare);
 
 /*
  * release the digital out
@@ -3018,7 +3018,7 @@
 	mutex_unlock(&codec->spdif_mutex);
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_multi_out_dig_close);
+EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_close);
 
 /*
  * set up more restrictions for analog out
@@ -3058,7 +3058,7 @@
 	return snd_pcm_hw_constraint_step(substream->runtime, 0,
 					  SNDRV_PCM_HW_PARAM_CHANNELS, 2);
 }
-EXPORT_SYMBOL_GPL(snd_hda_multi_out_analog_open);
+EXPORT_SYMBOL_HDA(snd_hda_multi_out_analog_open);
 
 /*
  * set up the i/o for analog out
@@ -3117,7 +3117,7 @@
 	}
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_multi_out_analog_prepare);
+EXPORT_SYMBOL_HDA(snd_hda_multi_out_analog_prepare);
 
 /*
  * clean up the setting for analog out
@@ -3144,7 +3144,7 @@
 	mutex_unlock(&codec->spdif_mutex);
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_multi_out_analog_cleanup);
+EXPORT_SYMBOL_HDA(snd_hda_multi_out_analog_cleanup);
 
 /*
  * Helper for automatic pin configuration
@@ -3430,13 +3430,13 @@
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_parse_pin_def_config);
+EXPORT_SYMBOL_HDA(snd_hda_parse_pin_def_config);
 
 /* labels for input pins */
 const char *auto_pin_cfg_labels[AUTO_PIN_LAST] = {
 	"Mic", "Front Mic", "Line", "Front Line", "CD", "Aux"
 };
-EXPORT_SYMBOL_GPL(auto_pin_cfg_labels);
+EXPORT_SYMBOL_HDA(auto_pin_cfg_labels);
 
 
 #ifdef CONFIG_PM
@@ -3464,7 +3464,7 @@
 	}
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_suspend);
+EXPORT_SYMBOL_HDA(snd_hda_suspend);
 
 /**
  * snd_hda_resume - resume the codecs
@@ -3485,7 +3485,7 @@
 	}
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_hda_resume);
+EXPORT_SYMBOL_HDA(snd_hda_resume);
 #endif /* CONFIG_PM */
 
 /*
@@ -3515,7 +3515,7 @@
 	}
 	return snd_array_elem(array, array->used++);
 }
-EXPORT_SYMBOL_GPL(snd_array_new);
+EXPORT_SYMBOL_HDA(snd_array_new);
 
 /* free the given array elements */
 void snd_array_free(struct snd_array *array)
@@ -3525,7 +3525,7 @@
 	array->alloced = 0;
 	array->list = NULL;
 }
-EXPORT_SYMBOL_GPL(snd_array_free);
+EXPORT_SYMBOL_HDA(snd_array_free);
 
 /*
  * used by hda_proc.c and hda_eld.c
@@ -3544,7 +3544,7 @@
 
 	buf[j] = '\0'; /* necessary when j == 0 */
 }
-EXPORT_SYMBOL_GPL(snd_print_pcm_rates);
+EXPORT_SYMBOL_HDA(snd_print_pcm_rates);
 
 void snd_print_pcm_bits(int pcm, char *buf, int buflen)
 {
@@ -3557,7 +3557,7 @@
 
 	buf[j] = '\0'; /* necessary when j == 0 */
 }
-EXPORT_SYMBOL_GPL(snd_print_pcm_bits);
+EXPORT_SYMBOL_HDA(snd_print_pcm_bits);
 
 MODULE_DESCRIPTION("HDA codec core");
 MODULE_LICENSE("GPL");
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 586ea08..6612d0f 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -905,4 +905,19 @@
 #define snd_hda_codec_needs_resume(codec) 1
 #endif
 
+/*
+ * Codec modularization
+ */
+
+/* Export symbols only for communication with codec drivers;
+ * When built in kernel, all HD-audio drivers are supposed to be statically
+ * linked to the kernel.  Thus, the symbols don't have to (or shouldn't) be
+ * exported unless it's built as a module.
+ */
+#ifdef MODULE
+#define EXPORT_SYMBOL_HDA(sym) EXPORT_SYMBOL_GPL(sym)
+#else
+#define EXPORT_SYMBOL_HDA(sym)
+#endif
+
 #endif /* __SOUND_HDA_CODEC_H */