linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ALSA: hda: Use dev_to_hdac_dev macro
@ 2020-05-05  3:03 Kai-Heng Feng
  2020-05-05  3:03 ` [PATCH 2/2] ALSA: hda: Use hdac_to_hda_codec macro Kai-Heng Feng
  2020-05-05  7:08 ` [PATCH 1/2] ALSA: hda: Use dev_to_hdac_dev macro Takashi Iwai
  0 siblings, 2 replies; 4+ messages in thread
From: Kai-Heng Feng @ 2020-05-05  3:03 UTC (permalink / raw)
  To: tiwai
  Cc: Kai-Heng Feng, Jaroslav Kysela, Pierre-Louis Bossart, Mark Brown,
	Amadeusz Sławiński, Greg Kroah-Hartman,
	Thomas Gleixner, Keyon Jie, Evan Green, moderated list:SOUND,
	open list

Use dev_to_hdac_dev() instead of container_of().

No functional change intended.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 sound/hda/ext/hdac_ext_bus.c | 2 +-
 sound/hda/hdac_device.c      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/hda/ext/hdac_ext_bus.c b/sound/hda/ext/hdac_ext_bus.c
index 73bfa71845f6..d0a604c939df 100644
--- a/sound/hda/ext/hdac_ext_bus.c
+++ b/sound/hda/ext/hdac_ext_bus.c
@@ -62,7 +62,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_exit);
 
 static void default_release(struct device *dev)
 {
-	snd_hdac_ext_bus_device_exit(container_of(dev, struct hdac_device, dev));
+	snd_hdac_ext_bus_device_exit(dev_to_hdac_dev(dev));
 }
 
 /**
diff --git a/sound/hda/hdac_device.c b/sound/hda/hdac_device.c
index e3119f5cb0d5..333220f0f8af 100644
--- a/sound/hda/hdac_device.c
+++ b/sound/hda/hdac_device.c
@@ -20,7 +20,7 @@ static int get_codec_vendor_name(struct hdac_device *codec);
 
 static void default_release(struct device *dev)
 {
-	snd_hdac_device_exit(container_of(dev, struct hdac_device, dev));
+	snd_hdac_device_exit(dev_to_hdac_dev(dev));
 }
 
 /**
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] ALSA: hda: Use hdac_to_hda_codec macro
  2020-05-05  3:03 [PATCH 1/2] ALSA: hda: Use dev_to_hdac_dev macro Kai-Heng Feng
@ 2020-05-05  3:03 ` Kai-Heng Feng
  2020-05-05  7:08   ` Takashi Iwai
  2020-05-05  7:08 ` [PATCH 1/2] ALSA: hda: Use dev_to_hdac_dev macro Takashi Iwai
  1 sibling, 1 reply; 4+ messages in thread
From: Kai-Heng Feng @ 2020-05-05  3:03 UTC (permalink / raw)
  To: tiwai
  Cc: Kai-Heng Feng, Jaroslav Kysela, Liam Girdwood, Mark Brown,
	Kai Vehmanen, Nikhil Mahale, Aaron Plattner,
	Pierre-Louis Bossart, Jairaj Arava, Sathyanarayana Nujella,
	moderated list:SOUND, open list

Use hdac_to_hda_codec() instead of container_of().

No functional change intended.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 include/sound/hda_codec.h   |  4 ++++
 sound/pci/hda/patch_hdmi.c  | 12 ++++++------
 sound/soc/codecs/hdac_hda.h |  4 ----
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/include/sound/hda_codec.h b/include/sound/hda_codec.h
index 225154a4f2ed..8a32060e3d8d 100644
--- a/include/sound/hda_codec.h
+++ b/include/sound/hda_codec.h
@@ -288,6 +288,10 @@ struct hda_codec {
 #define dev_to_hda_codec(_dev)	container_of(_dev, struct hda_codec, core.dev)
 #define hda_codec_dev(_dev)	(&(_dev)->core.dev)
 
+#define hdac_to_hda_priv(_hdac) \
+			container_of(_hdac, struct hdac_hda_priv, codec.core)
+#define hdac_to_hda_codec(_hdac) container_of(_hdac, struct hda_codec, core)
+
 #define list_for_each_codec(c, bus) \
 	list_for_each_entry(c, &(bus)->core.codec_list, core.list)
 #define list_for_each_codec_safe(c, n, bus)				\
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 4eff16053bd5..f21b66abb271 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -2022,7 +2022,7 @@ static const struct hda_pcm_ops generic_ops = {
 
 static int hdmi_get_spk_alloc(struct hdac_device *hdac, int pcm_idx)
 {
-	struct hda_codec *codec = container_of(hdac, struct hda_codec, core);
+	struct hda_codec *codec = hdac_to_hda_codec(hdac);
 	struct hdmi_spec *spec = codec->spec;
 	struct hdmi_spec_per_pin *per_pin = pcm_idx_to_pin(spec, pcm_idx);
 
@@ -2035,7 +2035,7 @@ static int hdmi_get_spk_alloc(struct hdac_device *hdac, int pcm_idx)
 static void hdmi_get_chmap(struct hdac_device *hdac, int pcm_idx,
 					unsigned char *chmap)
 {
-	struct hda_codec *codec = container_of(hdac, struct hda_codec, core);
+	struct hda_codec *codec = hdac_to_hda_codec(hdac);
 	struct hdmi_spec *spec = codec->spec;
 	struct hdmi_spec_per_pin *per_pin = pcm_idx_to_pin(spec, pcm_idx);
 
@@ -2049,7 +2049,7 @@ static void hdmi_get_chmap(struct hdac_device *hdac, int pcm_idx,
 static void hdmi_set_chmap(struct hdac_device *hdac, int pcm_idx,
 				unsigned char *chmap, int prepared)
 {
-	struct hda_codec *codec = container_of(hdac, struct hda_codec, core);
+	struct hda_codec *codec = hdac_to_hda_codec(hdac);
 	struct hdmi_spec *spec = codec->spec;
 	struct hdmi_spec_per_pin *per_pin = pcm_idx_to_pin(spec, pcm_idx);
 
@@ -2065,7 +2065,7 @@ static void hdmi_set_chmap(struct hdac_device *hdac, int pcm_idx,
 
 static bool is_hdmi_pcm_attached(struct hdac_device *hdac, int pcm_idx)
 {
-	struct hda_codec *codec = container_of(hdac, struct hda_codec, core);
+	struct hda_codec *codec = hdac_to_hda_codec(hdac);
 	struct hdmi_spec *spec = codec->spec;
 	struct hdmi_spec_per_pin *per_pin = pcm_idx_to_pin(spec, pcm_idx);
 
@@ -3783,7 +3783,7 @@ static int atihdmi_paired_chmap_validate(struct hdac_chmap *chmap,
 static int atihdmi_pin_set_slot_channel(struct hdac_device *hdac,
 		hda_nid_t pin_nid, int hdmi_slot, int stream_channel)
 {
-	struct hda_codec *codec = container_of(hdac, struct hda_codec, core);
+	struct hda_codec *codec = hdac_to_hda_codec(hdac);
 	int verb;
 	int ati_channel_setup = 0;
 
@@ -3819,7 +3819,7 @@ static int atihdmi_pin_set_slot_channel(struct hdac_device *hdac,
 static int atihdmi_pin_get_slot_channel(struct hdac_device *hdac,
 				hda_nid_t pin_nid, int asp_slot)
 {
-	struct hda_codec *codec = container_of(hdac, struct hda_codec, core);
+	struct hda_codec *codec = hdac_to_hda_codec(hdac);
 	bool was_odd = false;
 	int ati_asp_slot = asp_slot;
 	int verb;
diff --git a/sound/soc/codecs/hdac_hda.h b/sound/soc/codecs/hdac_hda.h
index 598b07d9b6fe..d0efc5e254ae 100644
--- a/sound/soc/codecs/hdac_hda.h
+++ b/sound/soc/codecs/hdac_hda.h
@@ -28,10 +28,6 @@ struct hdac_hda_priv {
 	bool need_display_power;
 };
 
-#define hdac_to_hda_priv(_hdac) \
-			container_of(_hdac, struct hdac_hda_priv, codec.core)
-#define hdac_to_hda_codec(_hdac) container_of(_hdac, struct hda_codec, core)
-
 struct hdac_ext_bus_ops *snd_soc_hdac_hda_get_ops(void);
 
 #endif /* __HDAC_HDA_H__ */
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] ALSA: hda: Use dev_to_hdac_dev macro
  2020-05-05  3:03 [PATCH 1/2] ALSA: hda: Use dev_to_hdac_dev macro Kai-Heng Feng
  2020-05-05  3:03 ` [PATCH 2/2] ALSA: hda: Use hdac_to_hda_codec macro Kai-Heng Feng
@ 2020-05-05  7:08 ` Takashi Iwai
  1 sibling, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2020-05-05  7:08 UTC (permalink / raw)
  To: Kai-Heng Feng
  Cc: tiwai, Jaroslav Kysela, Pierre-Louis Bossart, Mark Brown,
	Amadeusz Sławiński, Greg Kroah-Hartman,
	Thomas Gleixner, Keyon Jie, Evan Green, moderated list:SOUND,
	open list

On Tue, 05 May 2020 05:03:52 +0200,
Kai-Heng Feng wrote:
> 
> Use dev_to_hdac_dev() instead of container_of().
> 
> No functional change intended.
> 
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>

Applied now.  Thanks.


Takashi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] ALSA: hda: Use hdac_to_hda_codec macro
  2020-05-05  3:03 ` [PATCH 2/2] ALSA: hda: Use hdac_to_hda_codec macro Kai-Heng Feng
@ 2020-05-05  7:08   ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2020-05-05  7:08 UTC (permalink / raw)
  To: Kai-Heng Feng
  Cc: tiwai, Jaroslav Kysela, Liam Girdwood, Mark Brown, Kai Vehmanen,
	Nikhil Mahale, Aaron Plattner, Pierre-Louis Bossart,
	Jairaj Arava, Sathyanarayana Nujella, moderated list:SOUND,
	open list

On Tue, 05 May 2020 05:03:53 +0200,
Kai-Heng Feng wrote:
> 
> Use hdac_to_hda_codec() instead of container_of().
> 
> No functional change intended.
> 
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>

Applied now.  Thanks.


Takashi

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-05  7:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-05  3:03 [PATCH 1/2] ALSA: hda: Use dev_to_hdac_dev macro Kai-Heng Feng
2020-05-05  3:03 ` [PATCH 2/2] ALSA: hda: Use hdac_to_hda_codec macro Kai-Heng Feng
2020-05-05  7:08   ` Takashi Iwai
2020-05-05  7:08 ` [PATCH 1/2] ALSA: hda: Use dev_to_hdac_dev macro Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).