All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@alsa-project.org
Subject: [alsa-devel] [PATCH 22/24] ALSA: rme: Avoid non-standard macro usage
Date: Tue,  5 Nov 2019 16:18:54 +0100	[thread overview]
Message-ID: <20191105151856.10785-23-tiwai@suse.de> (raw)
In-Reply-To: <20191105151856.10785-1-tiwai@suse.de>

Pass the device pointer from the PCI pointer directly, instead of a
non-standard macro.  The macro didn't give any better readability.

Along with it, drop the unnecessary assignment before the
snd_dma_alloc_pages() call and simplify by returning the error code
directly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/rme9652/hdsp.c    | 7 +------
 sound/pci/rme9652/hdspm.c   | 2 +-
 sound/pci/rme9652/rme9652.c | 7 +------
 3 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
index 5cbdc9be9c7e..cd20af465d8e 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -569,12 +569,7 @@ static char channel_map_H9632_qs[HDSP_MAX_CHANNELS] = {
 
 static int snd_hammerfall_get_buffer(struct pci_dev *pci, struct snd_dma_buffer *dmab, size_t size)
 {
-	dmab->dev.type = SNDRV_DMA_TYPE_DEV;
-	dmab->dev.dev = snd_dma_pci_data(pci);
-	if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
-				size, dmab) < 0)
-		return -ENOMEM;
-	return 0;
+	return snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &pci->dev, size, dmab);
 }
 
 static void snd_hammerfall_free_buffer(struct snd_dma_buffer *dmab, struct pci_dev *pci)
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index b571d9d017bb..75c06a7cc779 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -6406,7 +6406,7 @@ static int snd_hdspm_preallocate_memory(struct hdspm *hdspm)
 	wanted = HDSPM_DMA_AREA_BYTES;
 
 	snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
-					      snd_dma_pci_data(hdspm->pci),
+					      &hdspm->pci->dev,
 					      wanted, wanted);
 	dev_dbg(hdspm->card->dev, " Preallocated %zd Bytes\n", wanted);
 	return 0;
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c
index 4c851f8dcaf8..ef5c2f8e17c7 100644
--- a/sound/pci/rme9652/rme9652.c
+++ b/sound/pci/rme9652/rme9652.c
@@ -279,12 +279,7 @@ static char channel_map_9636_ds[26] = {
 
 static int snd_hammerfall_get_buffer(struct pci_dev *pci, struct snd_dma_buffer *dmab, size_t size)
 {
-	dmab->dev.type = SNDRV_DMA_TYPE_DEV;
-	dmab->dev.dev = snd_dma_pci_data(pci);
-	if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
-				size, dmab) < 0)
-		return -ENOMEM;
-	return 0;
+	return snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &pci->dev, size, dmab);
 }
 
 static void snd_hammerfall_free_buffer(struct snd_dma_buffer *dmab, struct pci_dev *pci)
-- 
2.16.4

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  parent reply	other threads:[~2019-11-05 15:35 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-05 15:18 [alsa-devel] [PATCH 00/24] Clean up memalloc callers Takashi Iwai
2019-11-05 15:18 ` [alsa-devel] [PATCH 01/24] ALSA: drivers: Remove superfluous snd_dma_continuous_data() Takashi Iwai
2019-11-05 15:18 ` [alsa-devel] [PATCH 02/24] ALSA: mips: " Takashi Iwai
2019-11-05 15:18 ` [alsa-devel] [PATCH 03/24] ALSA: rme32: " Takashi Iwai
2019-11-05 15:18 ` [alsa-devel] [PATCH 04/24] ALSA: sh: " Takashi Iwai
2019-11-05 15:18 ` [alsa-devel] [PATCH 05/24] ALSA: sparc: " Takashi Iwai
2019-11-05 15:18 ` [alsa-devel] [PATCH 06/24] ALSA: usb: " Takashi Iwai
2019-11-05 15:18 ` [alsa-devel] [PATCH 07/24] ALSA: 6fire: Drop the dead code Takashi Iwai
2019-11-05 15:18 ` [alsa-devel] [PATCH 08/24] ALSA: usb-audio: Convert to the common vmalloc memalloc Takashi Iwai
2019-11-05 15:18 ` [alsa-devel] [PATCH 09/24] ALSA: aloop: " Takashi Iwai
2019-11-05 15:18 ` [alsa-devel] [PATCH 10/24] ALSA: firewire: " Takashi Iwai
2019-11-05 15:18 ` [alsa-devel] [PATCH 11/24] ALSA: 6fire: " Takashi Iwai
2019-11-05 15:18 ` [alsa-devel] [PATCH 12/24] ALSA: caiaq: " Takashi Iwai
2019-11-05 15:18 ` [alsa-devel] [PATCH 13/24] ALSA: hiface: " Takashi Iwai
2019-11-05 15:18 ` [alsa-devel] [PATCH 14/24] ALSA: ua101: " Takashi Iwai
2019-11-05 15:18 ` [alsa-devel] [PATCH 15/24] ALSA: vx: " Takashi Iwai
2019-11-05 15:18 ` [alsa-devel] [PATCH 16/24] ALSA: pdaudiocf: " Takashi Iwai
2019-11-05 15:18 ` [alsa-devel] [PATCH 17/24] ALSA: mips: " Takashi Iwai
2019-11-05 15:18 ` [alsa-devel] [PATCH 18/24] ALSA: pci: Drop superfluous snd_pcm_sgbuf_ops_page Takashi Iwai
2019-11-05 15:18 ` [alsa-devel] [PATCH 19/24] ALSA: aoa: Avoid non-standard macro usage Takashi Iwai
2019-11-05 15:18 ` [alsa-devel] [PATCH 20/24] ALSA: echoaudio: " Takashi Iwai
2019-11-05 15:18 ` [alsa-devel] [PATCH 21/24] ALSA: es1968: " Takashi Iwai
2019-11-05 15:18 ` Takashi Iwai [this message]
2019-11-05 15:18 ` [alsa-devel] [PATCH 23/24] ALSA: pci: " Takashi Iwai
2019-11-05 15:18 ` [alsa-devel] [PATCH 24/24] ALSA: docs: Remove snd_dma_pci_data() usage in documentation Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191105151856.10785-23-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.