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

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