Commit b0cd60f3 authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Takashi Iwai

ALSA/ASoC: hda: clarify bus_get_link() and bus_link_get() helpers

We have two helpers with confusing names and different purposes.

Rename bus_get_link() and bus_get_link_at() as bus_get_hlink_by_name()
and bus_get_hlink_by_addr() respectively.

No functionality change
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: default avatarRander Wang <rander.wang@intel.com>
Reviewed-by: default avatarPéter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20221019162115.185917-5-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 7f1e16ae
...@@ -27,9 +27,9 @@ void snd_hdac_ext_stream_spbcap_enable(struct hdac_bus *chip, ...@@ -27,9 +27,9 @@ void snd_hdac_ext_stream_spbcap_enable(struct hdac_bus *chip,
bool enable, int index); bool enable, int index);
int snd_hdac_ext_bus_get_ml_capabilities(struct hdac_bus *bus); int snd_hdac_ext_bus_get_ml_capabilities(struct hdac_bus *bus);
struct hdac_ext_link *snd_hdac_ext_bus_link_at(struct hdac_bus *bus, int addr); struct hdac_ext_link *snd_hdac_ext_bus_get_hlink_by_addr(struct hdac_bus *bus, int addr);
struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_bus *bus, struct hdac_ext_link *snd_hdac_ext_bus_get_hlink_by_name(struct hdac_bus *bus,
const char *codec_name); const char *codec_name);
enum hdac_ext_stream_type { enum hdac_ext_stream_type {
HDAC_EXT_STREAM_TYPE_COUPLED = 0, HDAC_EXT_STREAM_TYPE_COUPLED = 0,
......
...@@ -126,13 +126,13 @@ void snd_hdac_link_free_all(struct hdac_bus *bus) ...@@ -126,13 +126,13 @@ void snd_hdac_link_free_all(struct hdac_bus *bus)
EXPORT_SYMBOL_GPL(snd_hdac_link_free_all); EXPORT_SYMBOL_GPL(snd_hdac_link_free_all);
/** /**
* snd_hdac_ext_bus_link_at - get link at specified address * snd_hdac_ext_bus_get_hlink_by_addr - get hlink at specified address
* @bus: link's parent bus device * @bus: hlink's parent bus device
* @addr: codec device address * @addr: codec device address
* *
* Returns link object or NULL if matching link is not found. * Returns hlink object or NULL if matching hlink is not found.
*/ */
struct hdac_ext_link *snd_hdac_ext_bus_link_at(struct hdac_bus *bus, int addr) struct hdac_ext_link *snd_hdac_ext_bus_get_hlink_by_addr(struct hdac_bus *bus, int addr)
{ {
struct hdac_ext_link *hlink; struct hdac_ext_link *hlink;
int i; int i;
...@@ -143,15 +143,15 @@ struct hdac_ext_link *snd_hdac_ext_bus_link_at(struct hdac_bus *bus, int addr) ...@@ -143,15 +143,15 @@ struct hdac_ext_link *snd_hdac_ext_bus_link_at(struct hdac_bus *bus, int addr)
return hlink; return hlink;
return NULL; return NULL;
} }
EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_at); EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_get_hlink_by_addr);
/** /**
* snd_hdac_ext_bus_get_link - get link based on codec name * snd_hdac_ext_bus_get_hlink_by_name - get hlink based on codec name
* @bus: the pointer to HDAC bus object * @bus: the pointer to HDAC bus object
* @codec_name: codec name * @codec_name: codec name
*/ */
struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_bus *bus, struct hdac_ext_link *snd_hdac_ext_bus_get_hlink_by_name(struct hdac_bus *bus,
const char *codec_name) const char *codec_name)
{ {
int bus_idx, addr; int bus_idx, addr;
...@@ -162,9 +162,9 @@ struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_bus *bus, ...@@ -162,9 +162,9 @@ struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_bus *bus,
if (addr < 0 || addr > 31) if (addr < 0 || addr > 31)
return NULL; return NULL;
return snd_hdac_ext_bus_link_at(bus, addr); return snd_hdac_ext_bus_get_hlink_by_addr(bus, addr);
} }
EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_get_link); EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_get_hlink_by_name);
static int check_hdac_link_power_active(struct hdac_ext_link *hlink, bool enable) static int check_hdac_link_power_active(struct hdac_ext_link *hlink, bool enable)
{ {
...@@ -337,7 +337,7 @@ static void hdac_ext_codec_link_up(struct hdac_device *codec) ...@@ -337,7 +337,7 @@ static void hdac_ext_codec_link_up(struct hdac_device *codec)
{ {
const char *devname = dev_name(&codec->dev); const char *devname = dev_name(&codec->dev);
struct hdac_ext_link *hlink = struct hdac_ext_link *hlink =
snd_hdac_ext_bus_get_link(codec->bus, devname); snd_hdac_ext_bus_get_hlink_by_name(codec->bus, devname);
if (hlink) if (hlink)
snd_hdac_ext_bus_link_get(codec->bus, hlink); snd_hdac_ext_bus_link_get(codec->bus, hlink);
...@@ -347,7 +347,7 @@ static void hdac_ext_codec_link_down(struct hdac_device *codec) ...@@ -347,7 +347,7 @@ static void hdac_ext_codec_link_down(struct hdac_device *codec)
{ {
const char *devname = dev_name(&codec->dev); const char *devname = dev_name(&codec->dev);
struct hdac_ext_link *hlink = struct hdac_ext_link *hlink =
snd_hdac_ext_bus_get_link(codec->bus, devname); snd_hdac_ext_bus_get_hlink_by_name(codec->bus, devname);
if (hlink) if (hlink)
snd_hdac_ext_bus_link_put(codec->bus, hlink); snd_hdac_ext_bus_link_put(codec->bus, hlink);
......
...@@ -181,7 +181,7 @@ static int hda_codec_probe(struct snd_soc_component *component) ...@@ -181,7 +181,7 @@ static int hda_codec_probe(struct snd_soc_component *component)
!pm_runtime_status_suspended(&hdev->dev)); !pm_runtime_status_suspended(&hdev->dev));
#endif #endif
hlink = snd_hdac_ext_bus_link_at(bus, hdev->addr); hlink = snd_hdac_ext_bus_get_hlink_by_addr(bus, hdev->addr);
if (!hlink) { if (!hlink) {
dev_err(&hdev->dev, "hdac link not found\n"); dev_err(&hdev->dev, "hdac link not found\n");
return -EIO; return -EIO;
...@@ -289,7 +289,7 @@ static void hda_codec_remove(struct snd_soc_component *component) ...@@ -289,7 +289,7 @@ static void hda_codec_remove(struct snd_soc_component *component)
if (hda_codec_is_display(codec)) if (hda_codec_is_display(codec))
snd_hdac_display_power(bus, hdev->addr, false); snd_hdac_display_power(bus, hdev->addr, false);
hlink = snd_hdac_ext_bus_link_at(bus, hdev->addr); hlink = snd_hdac_ext_bus_get_hlink_by_addr(bus, hdev->addr);
if (hlink) if (hlink)
snd_hdac_ext_bus_link_put(bus, hlink); snd_hdac_ext_bus_link_put(bus, hlink);
/* /*
......
...@@ -400,7 +400,7 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component) ...@@ -400,7 +400,7 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component)
hda_codec_patch_t patch; hda_codec_patch_t patch;
int ret; int ret;
hlink = snd_hdac_ext_bus_get_link(hdev->bus, dev_name(&hdev->dev)); hlink = snd_hdac_ext_bus_get_hlink_by_name(hdev->bus, dev_name(&hdev->dev));
if (!hlink) { if (!hlink) {
dev_err(&hdev->dev, "hdac link not found\n"); dev_err(&hdev->dev, "hdac link not found\n");
return -EIO; return -EIO;
...@@ -516,7 +516,7 @@ static void hdac_hda_codec_remove(struct snd_soc_component *component) ...@@ -516,7 +516,7 @@ static void hdac_hda_codec_remove(struct snd_soc_component *component)
struct hda_codec *codec = hda_pvt->codec; struct hda_codec *codec = hda_pvt->codec;
struct hdac_ext_link *hlink = NULL; struct hdac_ext_link *hlink = NULL;
hlink = snd_hdac_ext_bus_get_link(hdev->bus, dev_name(&hdev->dev)); hlink = snd_hdac_ext_bus_get_hlink_by_name(hdev->bus, dev_name(&hdev->dev));
if (!hlink) { if (!hlink) {
dev_err(&hdev->dev, "hdac link not found\n"); dev_err(&hdev->dev, "hdac link not found\n");
return; return;
...@@ -584,7 +584,7 @@ static int hdac_hda_dev_probe(struct hdac_device *hdev) ...@@ -584,7 +584,7 @@ static int hdac_hda_dev_probe(struct hdac_device *hdev)
int ret; int ret;
/* hold the ref while we probe */ /* hold the ref while we probe */
hlink = snd_hdac_ext_bus_get_link(hdev->bus, dev_name(&hdev->dev)); hlink = snd_hdac_ext_bus_get_hlink_by_name(hdev->bus, dev_name(&hdev->dev));
if (!hlink) { if (!hlink) {
dev_err(&hdev->dev, "hdac link not found\n"); dev_err(&hdev->dev, "hdac link not found\n");
return -EIO; return -EIO;
......
...@@ -1967,7 +1967,7 @@ static int hdmi_codec_probe(struct snd_soc_component *component) ...@@ -1967,7 +1967,7 @@ static int hdmi_codec_probe(struct snd_soc_component *component)
* hold the ref while we probe, also no need to drop the ref on * hold the ref while we probe, also no need to drop the ref on
* exit, we call pm_runtime_suspend() so that will do for us * exit, we call pm_runtime_suspend() so that will do for us
*/ */
hlink = snd_hdac_ext_bus_get_link(hdev->bus, dev_name(&hdev->dev)); hlink = snd_hdac_ext_bus_get_hlink_by_name(hdev->bus, dev_name(&hdev->dev));
if (!hlink) { if (!hlink) {
dev_err(&hdev->dev, "hdac link not found\n"); dev_err(&hdev->dev, "hdac link not found\n");
return -EIO; return -EIO;
...@@ -2144,7 +2144,7 @@ static int hdac_hdmi_dev_probe(struct hdac_device *hdev) ...@@ -2144,7 +2144,7 @@ static int hdac_hdmi_dev_probe(struct hdac_device *hdev)
const struct hda_device_id *hdac_id = hdac_get_device_id(hdev, hdrv); const struct hda_device_id *hdac_id = hdac_get_device_id(hdev, hdrv);
/* hold the ref while we probe */ /* hold the ref while we probe */
hlink = snd_hdac_ext_bus_get_link(hdev->bus, dev_name(&hdev->dev)); hlink = snd_hdac_ext_bus_get_hlink_by_name(hdev->bus, dev_name(&hdev->dev));
if (!hlink) { if (!hlink) {
dev_err(&hdev->dev, "hdac link not found\n"); dev_err(&hdev->dev, "hdac link not found\n");
return -EIO; return -EIO;
...@@ -2244,7 +2244,7 @@ static int hdac_hdmi_runtime_suspend(struct device *dev) ...@@ -2244,7 +2244,7 @@ static int hdac_hdmi_runtime_suspend(struct device *dev)
snd_hdac_codec_read(hdev, hdev->afg, 0, AC_VERB_SET_POWER_STATE, snd_hdac_codec_read(hdev, hdev->afg, 0, AC_VERB_SET_POWER_STATE,
AC_PWRST_D3); AC_PWRST_D3);
hlink = snd_hdac_ext_bus_get_link(bus, dev_name(dev)); hlink = snd_hdac_ext_bus_get_hlink_by_name(bus, dev_name(dev));
if (!hlink) { if (!hlink) {
dev_err(dev, "hdac link not found\n"); dev_err(dev, "hdac link not found\n");
return -EIO; return -EIO;
...@@ -2270,7 +2270,7 @@ static int hdac_hdmi_runtime_resume(struct device *dev) ...@@ -2270,7 +2270,7 @@ static int hdac_hdmi_runtime_resume(struct device *dev)
if (!bus) if (!bus)
return 0; return 0;
hlink = snd_hdac_ext_bus_get_link(bus, dev_name(dev)); hlink = snd_hdac_ext_bus_get_hlink_by_name(bus, dev_name(dev));
if (!hlink) { if (!hlink) {
dev_err(dev, "hdac link not found\n"); dev_err(dev, "hdac link not found\n");
return -EIO; return -EIO;
......
...@@ -292,7 +292,7 @@ static int avs_dai_hda_be_hw_free(struct snd_pcm_substream *substream, struct sn ...@@ -292,7 +292,7 @@ static int avs_dai_hda_be_hw_free(struct snd_pcm_substream *substream, struct sn
/* clear link <-> stream mapping */ /* clear link <-> stream mapping */
codec = dev_to_hda_codec(asoc_rtd_to_codec(rtd, 0)->dev); codec = dev_to_hda_codec(asoc_rtd_to_codec(rtd, 0)->dev);
link = snd_hdac_ext_bus_link_at(&codec->bus->core, codec->core.addr); link = snd_hdac_ext_bus_get_hlink_by_addr(&codec->bus->core, codec->core.addr);
if (!link) if (!link)
return -EINVAL; return -EINVAL;
...@@ -325,7 +325,7 @@ static int avs_dai_hda_be_prepare(struct snd_pcm_substream *substream, struct sn ...@@ -325,7 +325,7 @@ static int avs_dai_hda_be_prepare(struct snd_pcm_substream *substream, struct sn
snd_hdac_ext_link_stream_reset(link_stream); snd_hdac_ext_link_stream_reset(link_stream);
snd_hdac_ext_link_stream_setup(link_stream, format_val); snd_hdac_ext_link_stream_setup(link_stream, format_val);
link = snd_hdac_ext_bus_link_at(bus, codec->core.addr); link = snd_hdac_ext_bus_get_hlink_by_addr(bus, codec->core.addr);
if (!link) if (!link)
return -EINVAL; return -EINVAL;
......
...@@ -558,7 +558,7 @@ static int skl_link_hw_params(struct snd_pcm_substream *substream, ...@@ -558,7 +558,7 @@ static int skl_link_hw_params(struct snd_pcm_substream *substream,
snd_soc_dai_set_dma_data(dai, substream, (void *)link_dev); snd_soc_dai_set_dma_data(dai, substream, (void *)link_dev);
link = snd_hdac_ext_bus_get_link(bus, codec_dai->component->name); link = snd_hdac_ext_bus_get_hlink_by_name(bus, codec_dai->component->name);
if (!link) if (!link)
return -EINVAL; return -EINVAL;
...@@ -643,7 +643,7 @@ static int skl_link_hw_free(struct snd_pcm_substream *substream, ...@@ -643,7 +643,7 @@ static int skl_link_hw_free(struct snd_pcm_substream *substream,
link_dev->link_prepared = 0; link_dev->link_prepared = 0;
link = snd_hdac_ext_bus_get_link(bus, asoc_rtd_to_codec(rtd, 0)->component->name); link = snd_hdac_ext_bus_get_hlink_by_name(bus, asoc_rtd_to_codec(rtd, 0)->component->name);
if (!link) if (!link)
return -EINVAL; return -EINVAL;
......
...@@ -149,7 +149,7 @@ static int hda_link_dma_cleanup(struct snd_pcm_substream *substream, ...@@ -149,7 +149,7 @@ static int hda_link_dma_cleanup(struct snd_pcm_substream *substream,
struct hdac_ext_link *hlink; struct hdac_ext_link *hlink;
int stream_tag; int stream_tag;
hlink = snd_hdac_ext_bus_get_link(bus, codec_dai->component->name); hlink = snd_hdac_ext_bus_get_hlink_by_name(bus, codec_dai->component->name);
if (!hlink) if (!hlink)
return -EINVAL; return -EINVAL;
...@@ -225,7 +225,7 @@ static int hda_link_dma_hw_params(struct snd_pcm_substream *substream, ...@@ -225,7 +225,7 @@ static int hda_link_dma_hw_params(struct snd_pcm_substream *substream,
snd_soc_dai_set_dma_data(cpu_dai, substream, (void *)hext_stream); snd_soc_dai_set_dma_data(cpu_dai, substream, (void *)hext_stream);
} }
hlink = snd_hdac_ext_bus_get_link(bus, codec_dai->component->name); hlink = snd_hdac_ext_bus_get_hlink_by_name(bus, codec_dai->component->name);
if (!hlink) if (!hlink)
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment