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

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.com


Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 7f1e16ae
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -27,8 +27,8 @@ void snd_hdac_ext_stream_spbcap_enable(struct hdac_bus *chip,
				 bool enable, int index);

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_link(struct hdac_bus *bus,
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_hlink_by_name(struct hdac_bus *bus,
							 const char *codec_name);

enum hdac_ext_stream_type {
+12 −12
Original line number Diff line number Diff line
@@ -126,13 +126,13 @@ void snd_hdac_link_free_all(struct hdac_bus *bus)
EXPORT_SYMBOL_GPL(snd_hdac_link_free_all);

/**
 * snd_hdac_ext_bus_link_at - get link at specified address
 * @bus: link's parent bus device
 * snd_hdac_ext_bus_get_hlink_by_addr - get hlink at specified address
 * @bus: hlink's parent bus device
 * @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;
	int i;
@@ -143,14 +143,14 @@ struct hdac_ext_link *snd_hdac_ext_bus_link_at(struct hdac_bus *bus, int addr)
				return hlink;
	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
 * @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)
{
	int bus_idx, addr;
@@ -162,9 +162,9 @@ struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_bus *bus,
	if (addr < 0 || addr > 31)
		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)
{
@@ -337,7 +337,7 @@ static void hdac_ext_codec_link_up(struct hdac_device *codec)
{
	const char *devname = dev_name(&codec->dev);
	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)
		snd_hdac_ext_bus_link_get(codec->bus, hlink);
@@ -347,7 +347,7 @@ static void hdac_ext_codec_link_down(struct hdac_device *codec)
{
	const char *devname = dev_name(&codec->dev);
	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)
		snd_hdac_ext_bus_link_put(codec->bus, hlink);
+2 −2
Original line number Diff line number Diff line
@@ -181,7 +181,7 @@ static int hda_codec_probe(struct snd_soc_component *component)
		!pm_runtime_status_suspended(&hdev->dev));
#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) {
		dev_err(&hdev->dev, "hdac link not found\n");
		return -EIO;
@@ -289,7 +289,7 @@ static void hda_codec_remove(struct snd_soc_component *component)
	if (hda_codec_is_display(codec))
		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)
		snd_hdac_ext_bus_link_put(bus, hlink);
	/*
+3 −3
Original line number Diff line number Diff line
@@ -400,7 +400,7 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component)
	hda_codec_patch_t patch;
	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) {
		dev_err(&hdev->dev, "hdac link not found\n");
		return -EIO;
@@ -516,7 +516,7 @@ static void hdac_hda_codec_remove(struct snd_soc_component *component)
	struct hda_codec *codec = hda_pvt->codec;
	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) {
		dev_err(&hdev->dev, "hdac link not found\n");
		return;
@@ -584,7 +584,7 @@ static int hdac_hda_dev_probe(struct hdac_device *hdev)
	int ret;

	/* 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) {
		dev_err(&hdev->dev, "hdac link not found\n");
		return -EIO;
+4 −4
Original line number Diff line number Diff line
@@ -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
	 * 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) {
		dev_err(&hdev->dev, "hdac link not found\n");
		return -EIO;
@@ -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);

	/* 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) {
		dev_err(&hdev->dev, "hdac link not found\n");
		return -EIO;
@@ -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,
							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) {
		dev_err(dev, "hdac link not found\n");
		return -EIO;
@@ -2270,7 +2270,7 @@ static int hdac_hdmi_runtime_resume(struct device *dev)
	if (!bus)
		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) {
		dev_err(dev, "hdac link not found\n");
		return -EIO;
Loading