Commit 15c75b09 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: ctxfi: Fallback DMA mask to 32bit

Currently ctxfi driver tries to set only the 64bit DMA mask on 64bit
architectures, and bails out if it fails.  This causes a problem on
some platforms since the 64bit DMA isn't always guaranteed.  We should
fall back to the default 32bit DMA when 64bit DMA fails.

Fixes: 6d74b86d ("ALSA: ctxfi - Allow 64bit DMA")
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 71321eb3
...@@ -27,12 +27,6 @@ ...@@ -27,12 +27,6 @@
#include "cthw20k1.h" #include "cthw20k1.h"
#include "ct20k1reg.h" #include "ct20k1reg.h"
#if BITS_PER_LONG == 32
#define CT_XFI_DMA_MASK DMA_BIT_MASK(32) /* 32 bit PTE */
#else
#define CT_XFI_DMA_MASK DMA_BIT_MASK(64) /* 64 bit PTE */
#endif
struct hw20k1 { struct hw20k1 {
struct hw hw; struct hw hw;
spinlock_t reg_20k1_lock; spinlock_t reg_20k1_lock;
...@@ -1904,19 +1898,18 @@ static int hw_card_start(struct hw *hw) ...@@ -1904,19 +1898,18 @@ static int hw_card_start(struct hw *hw)
{ {
int err; int err;
struct pci_dev *pci = hw->pci; struct pci_dev *pci = hw->pci;
const unsigned int dma_bits = BITS_PER_LONG;
err = pci_enable_device(pci); err = pci_enable_device(pci);
if (err < 0) if (err < 0)
return err; return err;
/* Set DMA transfer mask */ /* Set DMA transfer mask */
if (dma_set_mask(&pci->dev, CT_XFI_DMA_MASK) < 0 || if (dma_set_mask(&pci->dev, DMA_BIT_MASK(dma_bits))) {
dma_set_coherent_mask(&pci->dev, CT_XFI_DMA_MASK) < 0) { dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(dma_bits));
dev_err(hw->card->dev, } else {
"architecture does not support PCI busmaster DMA with mask 0x%llx\n", dma_set_mask(&pci->dev, DMA_BIT_MASK(32));
CT_XFI_DMA_MASK); dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(32));
err = -ENXIO;
goto error1;
} }
if (!hw->io_base) { if (!hw->io_base) {
......
...@@ -26,12 +26,6 @@ ...@@ -26,12 +26,6 @@
#include "cthw20k2.h" #include "cthw20k2.h"
#include "ct20k2reg.h" #include "ct20k2reg.h"
#if BITS_PER_LONG == 32
#define CT_XFI_DMA_MASK DMA_BIT_MASK(32) /* 32 bit PTE */
#else
#define CT_XFI_DMA_MASK DMA_BIT_MASK(64) /* 64 bit PTE */
#endif
struct hw20k2 { struct hw20k2 {
struct hw hw; struct hw hw;
/* for i2c */ /* for i2c */
...@@ -2029,19 +2023,18 @@ static int hw_card_start(struct hw *hw) ...@@ -2029,19 +2023,18 @@ static int hw_card_start(struct hw *hw)
int err = 0; int err = 0;
struct pci_dev *pci = hw->pci; struct pci_dev *pci = hw->pci;
unsigned int gctl; unsigned int gctl;
const unsigned int dma_bits = BITS_PER_LONG;
err = pci_enable_device(pci); err = pci_enable_device(pci);
if (err < 0) if (err < 0)
return err; return err;
/* Set DMA transfer mask */ /* Set DMA transfer mask */
if (dma_set_mask(&pci->dev, CT_XFI_DMA_MASK) < 0 || if (!dma_set_mask(&pci->dev, DMA_BIT_MASK(dma_bits))) {
dma_set_coherent_mask(&pci->dev, CT_XFI_DMA_MASK) < 0) { dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(dma_bits));
dev_err(hw->card->dev, } else {
"architecture does not support PCI busmaster DMA with mask 0x%llx\n", dma_set_mask(&pci->dev, DMA_BIT_MASK(32));
CT_XFI_DMA_MASK); dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(32));
err = -ENXIO;
goto error1;
} }
if (!hw->io_base) { if (!hw->io_base) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment