public inbox for linux-kernel@vger.kernel.org
 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; 8+ 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] 8+ 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; 8+ 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] 8+ 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; 8+ 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] 8+ 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
  2 siblings, 1 reply; 8+ 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] 8+ 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; 8+ 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] 8+ 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
  0 siblings, 0 replies; 8+ 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] 8+ 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; 8+ 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] 8+ 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; 8+ messages in thread
From: Geliang Tang @ 2016-01-04 14:54 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Jaroslav Kysela, Takashi Iwai, alsa-devel, linux-kernel,
	Geliang Tang

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] 8+ messages in thread

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

Thread overview: 8+ 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox