Commit 669f65ea authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: pci: Simplify with dma_set_mask_and_coherent()

Many PCI drivers still have two explicit calls of dma_set_mask() and
dma_set_coherent_mask().

Let's simplify with dma_set_mask_and_coherent().

Link: https://lore.kernel.org/r/20210114125412.993-2-tiwai@suse.de


Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 9a08676f
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -857,8 +857,7 @@ snd_ad1889_create(struct snd_card *card,
		return err;

	/* check PCI availability (32bit DMA) */
	if (dma_set_mask(&pci->dev, DMA_BIT_MASK(32)) < 0 ||
	    dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(32)) < 0) {
	if (dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(32))) {
		dev_err(card->dev, "error setting 32-bit DMA mask.\n");
		pci_disable_device(pci);
		return -ENXIO;
+1 −2
Original line number Diff line number Diff line
@@ -2057,8 +2057,7 @@ static int snd_ali_create(struct snd_card *card,
	if (err < 0)
		return err;
	/* check, if we can restrict PCI DMA transfers to 31 bits */
	if (dma_set_mask(&pci->dev, DMA_BIT_MASK(31)) < 0 ||
	    dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(31)) < 0) {
	if (dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(31))) {
		dev_err(card->dev,
			"architecture does not support 31bit PCI busmaster DMA\n");
		pci_disable_device(pci);
+1 −2
Original line number Diff line number Diff line
@@ -625,8 +625,7 @@ static int snd_als300_create(struct snd_card *card,
	if ((err = pci_enable_device(pci)) < 0)
		return err;

	if (dma_set_mask(&pci->dev, DMA_BIT_MASK(28)) < 0 ||
		dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(28)) < 0) {
	if (dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(28))) {
		dev_err(card->dev, "error setting 28bit DMA mask\n");
		pci_disable_device(pci);
		return -ENXIO;
+1 −2
Original line number Diff line number Diff line
@@ -837,8 +837,7 @@ static int snd_card_als4000_probe(struct pci_dev *pci,
		return err;
	}
	/* check, if we can restrict PCI DMA transfers to 24 bits */
	if (dma_set_mask(&pci->dev, DMA_BIT_MASK(24)) < 0 ||
	    dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(24)) < 0) {
	if (dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(24))) {
		dev_err(&pci->dev, "architecture does not support 24bit PCI busmaster DMA\n");
		pci_disable_device(pci);
		return -ENXIO;
+1 −2
Original line number Diff line number Diff line
@@ -151,8 +151,7 @@ snd_vortex_create(struct snd_card *card, struct pci_dev *pci, vortex_t ** rchip)
	// check PCI availability (DMA).
	if ((err = pci_enable_device(pci)) < 0)
		return err;
	if (dma_set_mask(&pci->dev, DMA_BIT_MASK(32)) < 0 ||
	    dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(32)) < 0) {
	if (dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(32))) {
		dev_err(card->dev, "error to set DMA mask\n");
		pci_disable_device(pci);
		return -ENXIO;
Loading