alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] ALSA: core: use dev_to_snd_card
@ 2015-12-28 14:47 Geliang Tang
  2015-12-28 14:47 ` [PATCH 2/4] ALSA: hdac: drop unused dev_to_hdac macro Geliang Tang
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Geliang Tang @ 2015-12-28 14:47 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai, Mark Brown
  Cc: Geliang Tang, alsa-devel, linux-kernel

Use dev_to_snd_card() instead of open-coding it.

Signed-off-by: Geliang Tang <geliangtang@163.com>
---
 sound/core/init.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/core/init.c b/sound/core/init.c
index 20f37fb..fcb84e1 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -639,7 +639,7 @@ static ssize_t
 card_id_show_attr(struct device *dev,
 		  struct device_attribute *attr, char *buf)
 {
-	struct snd_card *card = container_of(dev, struct snd_card, card_dev);
+	struct snd_card *card = dev_to_snd_card(dev);
 	return snprintf(buf, PAGE_SIZE, "%s\n", card->id);
 }
 
@@ -647,7 +647,7 @@ static ssize_t
 card_id_store_attr(struct device *dev, struct device_attribute *attr,
 		   const char *buf, size_t count)
 {
-	struct snd_card *card = container_of(dev, struct snd_card, card_dev);
+	struct snd_card *card = dev_to_snd_card(dev);
 	char buf1[sizeof(card->id)];
 	size_t copy = count > sizeof(card->id) - 1 ?
 					sizeof(card->id) - 1 : count;
@@ -679,7 +679,7 @@ static ssize_t
 card_number_show_attr(struct device *dev,
 		     struct device_attribute *attr, char *buf)
 {
-	struct snd_card *card = container_of(dev, struct snd_card, card_dev);
+	struct snd_card *card = dev_to_snd_card(dev);
 	return snprintf(buf, PAGE_SIZE, "%i\n", card->number);
 }
 
-- 
2.5.0

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

* [PATCH 2/4] ALSA: hdac: drop unused dev_to_hdac macro
  2015-12-28 14:47 [PATCH 1/4] ALSA: core: use dev_to_snd_card Geliang Tang
@ 2015-12-28 14:47 ` Geliang Tang
  2016-01-04  8:23   ` Vinod Koul
  2015-12-28 14:47 ` [PATCH 3/4] ALSA: hdac: use dev_to_hdac_dev Geliang Tang
  2015-12-28 14:47 ` [PATCH 4/4] ASoC: hdac_hdmi: use dev_to_hdac_dev and to_ehdac_device Geliang Tang
  2 siblings, 1 reply; 9+ messages in thread
From: Geliang Tang @ 2015-12-28 14:47 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai, Vinod Koul
  Cc: Geliang Tang, alsa-devel, linux-kernel

dev_to_hdac is not used anymore so drop it.

Signed-off-by: Geliang Tang <geliangtang@163.com>
---
 sound/hda/ext/hdac_ext_bus.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/hda/ext/hdac_ext_bus.c b/sound/hda/ext/hdac_ext_bus.c
index 2433f7c..58f6b98 100644
--- a/sound/hda/ext/hdac_ext_bus.c
+++ b/sound/hda/ext/hdac_ext_bus.c
@@ -197,8 +197,6 @@ void snd_hdac_ext_bus_device_remove(struct hdac_ext_bus *ebus)
 	}
 }
 EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_remove);
-#define dev_to_hdac(dev) (container_of((dev), \
-			struct hdac_device, dev))
 
 static inline struct hdac_ext_driver *get_edrv(struct device *dev)
 {
-- 
2.5.0

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

* [PATCH 3/4] ALSA: hdac: use dev_to_hdac_dev
  2015-12-28 14:47 [PATCH 1/4] ALSA: core: use dev_to_snd_card Geliang Tang
  2015-12-28 14:47 ` [PATCH 2/4] ALSA: hdac: drop unused dev_to_hdac macro Geliang Tang
@ 2015-12-28 14:47 ` Geliang Tang
  2016-01-04  8:21   ` Vinod Koul
  2015-12-28 14:47 ` [PATCH 4/4] ASoC: hdac_hdmi: use dev_to_hdac_dev and to_ehdac_device Geliang Tang
  2 siblings, 1 reply; 9+ messages in thread
From: Geliang Tang @ 2015-12-28 14:47 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai, Vinod Koul
  Cc: Geliang Tang, alsa-devel, linux-kernel

Use dev_to_hdac_dev() instead of open-coding it.

Signed-off-by: Geliang Tang <geliangtang@163.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 58f6b98..2522943 100644
--- a/sound/hda/ext/hdac_ext_bus.c
+++ b/sound/hda/ext/hdac_ext_bus.c
@@ -122,7 +122,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 e361024..959f7d9 100644
--- a/sound/hda/hdac_device.c
+++ b/sound/hda/hdac_device.c
@@ -18,7 +18,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.5.0

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

* [PATCH 4/4] ASoC: hdac_hdmi: use dev_to_hdac_dev and to_ehdac_device
  2015-12-28 14:47 [PATCH 1/4] ALSA: core: use dev_to_snd_card Geliang Tang
  2015-12-28 14:47 ` [PATCH 2/4] ALSA: hdac: drop unused dev_to_hdac macro Geliang Tang
  2015-12-28 14:47 ` [PATCH 3/4] ALSA: hdac: use dev_to_hdac_dev Geliang Tang
@ 2015-12-28 14:47 ` Geliang Tang
  2016-01-04  8:22   ` Vinod Koul
  2016-01-04 22:18   ` Applied "ASoC: hdac_hdmi: use dev_to_hdac_dev and to_ehdac_device" to the asoc tree Mark Brown
  2 siblings, 2 replies; 9+ messages in thread
From: Geliang Tang @ 2015-12-28 14:47 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai, Vinod Koul
  Cc: Geliang Tang, alsa-devel, linux-kernel

Use dev_to_hdac_dev() and to_ehdac_device() instead of open-coding.

Signed-off-by: Geliang Tang <geliangtang@163.com>
---
 sound/soc/codecs/hdac_hdmi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c
index 1a2f33b..b999fb2 100644
--- a/sound/soc/codecs/hdac_hdmi.c
+++ b/sound/soc/codecs/hdac_hdmi.c
@@ -67,9 +67,9 @@ struct hdac_hdmi_priv {
 
 static inline struct hdac_ext_device *to_hda_ext_device(struct device *dev)
 {
-	struct hdac_device *hdac = container_of(dev, struct hdac_device, dev);
+	struct hdac_device *hdac = dev_to_hdac_dev(dev);
 
-	return container_of(hdac, struct hdac_ext_device, hdac);
+	return to_ehdac_device(hdac);
 }
 
 static int hdac_hdmi_setup_stream(struct hdac_ext_device *hdac,
-- 
2.5.0

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

* Re: [PATCH 3/4] ALSA: hdac: use dev_to_hdac_dev
  2015-12-28 14:47 ` [PATCH 3/4] ALSA: hdac: use dev_to_hdac_dev Geliang Tang
@ 2016-01-04  8:21   ` Vinod Koul
  0 siblings, 0 replies; 9+ messages in thread
From: Vinod Koul @ 2016-01-04  8:21 UTC (permalink / raw)
  To: Geliang Tang; +Cc: Jaroslav Kysela, Takashi Iwai, alsa-devel, linux-kernel

On Mon, Dec 28, 2015 at 10:47:12PM +0800, Geliang Tang wrote:
> Use dev_to_hdac_dev() instead of open-coding it.
> 
> Signed-off-by: Geliang Tang <geliangtang@163.com>

Reviewed-by: Vinod Koul <vinod.koul@intel.com>

Thanks
-- 
~Vinod

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

* Re: [PATCH 4/4] ASoC: hdac_hdmi: use dev_to_hdac_dev and to_ehdac_device
  2015-12-28 14:47 ` [PATCH 4/4] ASoC: hdac_hdmi: use dev_to_hdac_dev and to_ehdac_device Geliang Tang
@ 2016-01-04  8:22   ` Vinod Koul
  2016-01-04 22:18   ` Applied "ASoC: hdac_hdmi: use dev_to_hdac_dev and to_ehdac_device" to the asoc tree Mark Brown
  1 sibling, 0 replies; 9+ messages in thread
From: Vinod Koul @ 2016-01-04  8:22 UTC (permalink / raw)
  To: Geliang Tang
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	alsa-devel, linux-kernel

On Mon, Dec 28, 2015 at 10:47:13PM +0800, Geliang Tang wrote:
> Use dev_to_hdac_dev() and to_ehdac_device() instead of open-coding.
> 

Reviewed-by: Vinod Koul <vinod.koul@intel.com>

Thanks
-- 
~Vinod

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

* Re: [PATCH 2/4] ALSA: hdac: drop unused dev_to_hdac macro
  2015-12-28 14:47 ` [PATCH 2/4] ALSA: hdac: drop unused dev_to_hdac macro Geliang Tang
@ 2016-01-04  8:23   ` Vinod Koul
  2016-01-04 14:54     ` Geliang Tang
  0 siblings, 1 reply; 9+ messages in thread
From: Vinod Koul @ 2016-01-04  8:23 UTC (permalink / raw)
  To: Geliang Tang; +Cc: Jaroslav Kysela, Takashi Iwai, alsa-devel, linux-kernel

On Mon, Dec 28, 2015 at 10:47:11PM +0800, Geliang Tang wrote:
> dev_to_hdac is not used anymore so drop it.

No harm in keeping this for now as the systems using these will be coming
up and more users will be upstreamed...

> 
> Signed-off-by: Geliang Tang <geliangtang@163.com>
> ---
>  sound/hda/ext/hdac_ext_bus.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/sound/hda/ext/hdac_ext_bus.c b/sound/hda/ext/hdac_ext_bus.c
> index 2433f7c..58f6b98 100644
> --- a/sound/hda/ext/hdac_ext_bus.c
> +++ b/sound/hda/ext/hdac_ext_bus.c
> @@ -197,8 +197,6 @@ void snd_hdac_ext_bus_device_remove(struct hdac_ext_bus *ebus)
>  	}
>  }
>  EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_remove);
> -#define dev_to_hdac(dev) (container_of((dev), \
> -			struct hdac_device, dev))
>  
>  static inline struct hdac_ext_driver *get_edrv(struct device *dev)
>  {
> -- 
> 2.5.0
> 
> 

-- 
~Vinod

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

* Re: [PATCH 2/4] ALSA: hdac: drop unused dev_to_hdac macro
  2016-01-04  8:23   ` Vinod Koul
@ 2016-01-04 14:54     ` Geliang Tang
  0 siblings, 0 replies; 9+ messages in thread
From: Geliang Tang @ 2016-01-04 14:54 UTC (permalink / raw)
  To: Vinod Koul; +Cc: Geliang Tang, linux-kernel, alsa-devel, Takashi Iwai

On Mon, Jan 04, 2016 at 01:53:47PM +0530, Vinod Koul wrote:
> On Mon, Dec 28, 2015 at 10:47:11PM +0800, Geliang Tang wrote:
> > dev_to_hdac is not used anymore so drop it.
> 
> No harm in keeping this for now as the systems using these will be coming
> up and more users will be upstreamed...
> 

Thanks for your review. Sorry that I didn't make myself clear in the commit
log. What I droped is a repetitive macro. dev_to_hdac() in hdac_ext_bus.c 
and dev_to_hdac_dev() in hdaudio.h are the same:

 include/sound/hdaudio.h:
 #define dev_to_hdac_dev(_dev)   container_of(_dev, struct hdac_device, dev)

 sound/hda/ext/hdac_ext_bus.c:
 #define dev_to_hdac(dev) (container_of((dev), \
                         struct hdac_device, dev))

Users should use dev_to_hdac_dev() in hdaudio.h, not dev_to_hdac().

 -Geliang

> > 
> > Signed-off-by: Geliang Tang <geliangtang@163.com>
> > ---
> >  sound/hda/ext/hdac_ext_bus.c | 2 --
> >  1 file changed, 2 deletions(-)
> > 
> > diff --git a/sound/hda/ext/hdac_ext_bus.c b/sound/hda/ext/hdac_ext_bus.c
> > index 2433f7c..58f6b98 100644
> > --- a/sound/hda/ext/hdac_ext_bus.c
> > +++ b/sound/hda/ext/hdac_ext_bus.c
> > @@ -197,8 +197,6 @@ void snd_hdac_ext_bus_device_remove(struct hdac_ext_bus *ebus)
> >  	}
> >  }
> >  EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_remove);
> > -#define dev_to_hdac(dev) (container_of((dev), \
> > -			struct hdac_device, dev))
> >  
> >  static inline struct hdac_ext_driver *get_edrv(struct device *dev)
> >  {
> > -- 
> > 2.5.0

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

* Applied "ASoC: hdac_hdmi: use dev_to_hdac_dev and to_ehdac_device" to the asoc tree
  2015-12-28 14:47 ` [PATCH 4/4] ASoC: hdac_hdmi: use dev_to_hdac_dev and to_ehdac_device Geliang Tang
  2016-01-04  8:22   ` Vinod Koul
@ 2016-01-04 22:18   ` Mark Brown
  1 sibling, 0 replies; 9+ messages in thread
From: Mark Brown @ 2016-01-04 22:18 UTC (permalink / raw)
  To: Geliang Tang, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: hdac_hdmi: use dev_to_hdac_dev and to_ehdac_device

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 51b2c4258f29d83120819a829a78345a3dac17c4 Mon Sep 17 00:00:00 2001
From: Geliang Tang <geliangtang@163.com>
Date: Mon, 28 Dec 2015 22:47:13 +0800
Subject: [PATCH] ASoC: hdac_hdmi: use dev_to_hdac_dev and to_ehdac_device

Use dev_to_hdac_dev() and to_ehdac_device() instead of open-coding.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Reviewed-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/codecs/hdac_hdmi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c
index 1a2f33b4abfc..b999fb2a463b 100644
--- a/sound/soc/codecs/hdac_hdmi.c
+++ b/sound/soc/codecs/hdac_hdmi.c
@@ -67,9 +67,9 @@ struct hdac_hdmi_priv {
 
 static inline struct hdac_ext_device *to_hda_ext_device(struct device *dev)
 {
-	struct hdac_device *hdac = container_of(dev, struct hdac_device, dev);
+	struct hdac_device *hdac = dev_to_hdac_dev(dev);
 
-	return container_of(hdac, struct hdac_ext_device, hdac);
+	return to_ehdac_device(hdac);
 }
 
 static int hdac_hdmi_setup_stream(struct hdac_ext_device *hdac,
-- 
2.6.2

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

end of thread, other threads:[~2016-01-04 22:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-28 14:47 [PATCH 1/4] ALSA: core: use dev_to_snd_card Geliang Tang
2015-12-28 14:47 ` [PATCH 2/4] ALSA: hdac: drop unused dev_to_hdac macro Geliang Tang
2016-01-04  8:23   ` Vinod Koul
2016-01-04 14:54     ` Geliang Tang
2015-12-28 14:47 ` [PATCH 3/4] ALSA: hdac: use dev_to_hdac_dev Geliang Tang
2016-01-04  8:21   ` Vinod Koul
2015-12-28 14:47 ` [PATCH 4/4] ASoC: hdac_hdmi: use dev_to_hdac_dev and to_ehdac_device Geliang Tang
2016-01-04  8:22   ` Vinod Koul
2016-01-04 22:18   ` Applied "ASoC: hdac_hdmi: use dev_to_hdac_dev and to_ehdac_device" to the asoc tree Mark Brown

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