ALSA: Simplify with dma_set_mask_and_coherent()
Subsystems (3)
cover ALSA: Simplify with dma_set_mask_and_coherent()
Simple patches that convert the two calls of dma_set_mask*() into the single dma_set_mask_and_coherent() helper.
Just a minor cleanup, there should be no functional changes.
Takashi
===
Takashi Iwai (2):
ALSA: pci: Simplify with dma_set_mask_and_coherent()
ALSA: x86: Simplify with dma_set_mask_and_coherent()
sound/pci/ad1889.c | 3 +-- sound/pci/ali5451/ali5451.c | 3 +-- sound/pci/als300.c | 3 +-- sound/pci/als4000.c | 3 +-- sound/pci/au88x0/au88x0.c | 3 +-- sound/pci/aw2/aw2-alsa.c | 3 +-- sound/pci/azt3328.c | 3 +-- sound/pci/ca0106/ca0106_main.c | 3 +-- sound/pci/cs5535audio/cs5535audio.c | 3 +-- sound/pci/ctxfi/cthw20k1.c | 8 ++------ sound/pci/ctxfi/cthw20k2.c | 8 ++------ sound/pci/es1938.c | 3 +-- sound/pci/es1968.c | 3 +-- sound/pci/hda/hda_intel.c | 8 ++------ sound/pci/ice1712/ice1712.c | 3 +-- sound/pci/maestro3.c | 3 +-- sound/pci/sonicvibes.c | 3 +-- sound/pci/trident/trident_main.c | 3 +-- sound/x86/intel_hdmi_audio.c | 3 +-- 19 files changed, 22 insertions(+), 50 deletions(-)
Signature · 1 line
2.26.2
PATCH 1/2 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().
--- sound/pci/ad1889.c | 3 +-- sound/pci/ali5451/ali5451.c | 3 +-- sound/pci/als300.c | 3 +-- sound/pci/als4000.c | 3 +-- sound/pci/au88x0/au88x0.c | 3 +-- sound/pci/aw2/aw2-alsa.c | 3 +-- sound/pci/azt3328.c | 3 +-- sound/pci/ca0106/ca0106_main.c | 3 +-- sound/pci/cs5535audio/cs5535audio.c | 3 +-- sound/pci/ctxfi/cthw20k1.c | 8 ++------ sound/pci/ctxfi/cthw20k2.c | 8 ++------ sound/pci/es1938.c | 3 +-- sound/pci/es1968.c | 3 +-- sound/pci/hda/hda_intel.c | 8 ++------ sound/pci/ice1712/ice1712.c | 3 +-- sound/pci/maestro3.c | 3 +-- sound/pci/sonicvibes.c | 3 +-- sound/pci/trident/trident_main.c | 3 +-- 18 files changed, 21 insertions(+), 48 deletions(-)
sound/pci/ad1889.c +1 -2
@@ -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 ;
sound/pci/ali5451/ali5451.c +1 -2
@@ -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);
sound/pci/als300.c +1 -2
@@ -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 ;
sound/pci/als4000.c +1 -2
@@ -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 ;
sound/pci/au88x0/au88x0.c +1 -2
@@ -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 ;
sound/pci/aw2/aw2-alsa.c +1 -2
@@ -236,8 +236,7 @@ static int snd_aw2_create(struct snd_card *card,pci_set_master (pci);/* 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,"Impossible to set 32bit mask DMA\n" );pci_disable_device (pci);return -ENXIO ;
sound/pci/azt3328.c +1 -2
@@ -2379,8 +2379,7 @@ snd_azf3328_create(struct snd_card *card, chip->irq =-1 ;/* 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 (card->dev,"architecture does not support 24bit PCI busmaster DMA\n" );
sound/pci/ca0106/ca0106_main.c +1 -2
@@ -1605,8 +1605,7 @@ static int snd_ca0106_create(int dev, struct snd_card *card, err =pci_enable_device (pci);if (err <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 32bit mask DMA\n" );pci_disable_device (pci);return -ENXIO ;
sound/pci/cs5535audio/cs5535audio.c +1 -2
@@ -269,8 +269,7 @@ static int snd_cs5535audio_create(struct snd_card *card,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_warn (card->dev,"unable to get 32bit dma\n" ); err = -ENXIO ; goto pcifail;
sound/pci/ctxfi/cthw20k1.c +2 -6
@@ -1901,12 +1901,8 @@ static int hw_card_start(struct hw *hw)return err;/* Set DMA transfer mask */ -if (!dma_set_mask (&pci->dev,DMA_BIT_MASK (dma_bits))) { -dma_set_coherent_mask (&pci->dev,DMA_BIT_MASK (dma_bits)); - }else { -dma_set_mask (&pci->dev,DMA_BIT_MASK (32 )); -dma_set_coherent_mask (&pci->dev,DMA_BIT_MASK (32 )); - } +if (dma_set_mask_and_coherent (&pci->dev,DMA_BIT_MASK (dma_bits))) +dma_set_mask_and_coherent (&pci->dev,DMA_BIT_MASK (32 ));if (!hw->io_base) { err =pci_request_regions (pci,"XFi" );
sound/pci/ctxfi/cthw20k2.c +2 -6
@@ -2026,12 +2026,8 @@ static int hw_card_start(struct hw *hw)return err;/* Set DMA transfer mask */ -if (!dma_set_mask (&pci->dev,DMA_BIT_MASK (dma_bits))) { -dma_set_coherent_mask (&pci->dev,DMA_BIT_MASK (dma_bits)); - }else { -dma_set_mask (&pci->dev,DMA_BIT_MASK (32 )); -dma_set_coherent_mask (&pci->dev,DMA_BIT_MASK (32 )); - } +if (dma_set_mask_and_coherent (&pci->dev,DMA_BIT_MASK (dma_bits))) +dma_set_mask_and_coherent (&pci->dev,DMA_BIT_MASK (32 ));if (!hw->io_base) { err =pci_request_regions (pci,"XFi" );
sound/pci/es1938.c +1 -2
@@ -1560,8 +1560,7 @@ static int snd_es1938_create(struct snd_card *card,if ((err =pci_enable_device (pci)) <0 )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 (card->dev,"architecture does not support 24bit PCI busmaster DMA\n" );pci_disable_device (pci);
sound/pci/es1968.c +1 -2
@@ -2668,8 +2668,7 @@ static int snd_es1968_create(struct snd_card *card,if ((err =pci_enable_device (pci)) <0 )return err;/* check, if we can restrict PCI DMA transfers to 28 bits */ -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,"architecture does not support 28bit PCI busmaster DMA\n" );pci_disable_device (pci);
sound/pci/hda/hda_intel.c +2 -6
@@ -1967,12 +1967,8 @@ static int azx_first_init(struct azx *chip)/* allow 64bit DMA address if supported by H/W */ if (!(gcap &AZX_GCAP_64OK )) dma_bits =32 ; -if (!dma_set_mask (&pci->dev,DMA_BIT_MASK (dma_bits))) { -dma_set_coherent_mask (&pci->dev,DMA_BIT_MASK (dma_bits)); - }else { -dma_set_mask (&pci->dev,DMA_BIT_MASK (32 )); -dma_set_coherent_mask (&pci->dev,DMA_BIT_MASK (32 )); - } +if (dma_set_mask_and_coherent (&pci->dev,DMA_BIT_MASK (dma_bits))) +dma_set_mask_and_coherent (&pci->dev,DMA_BIT_MASK (32 ));/* read number of streams from GCAP register instead of using * hardcoded value
sound/pci/ice1712/ice1712.c +1 -2
@@ -2486,8 +2486,7 @@ static int snd_ice1712_create(struct snd_card *card,if (err <0 )return err;/* check, if we can restrict PCI DMA transfers to 28 bits */ -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,"architecture does not support 28bit PCI busmaster DMA\n" );pci_disable_device (pci);
sound/pci/maestro3.c +1 -2
@@ -2532,8 +2532,7 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci,return -EIO ;/* check, if we can restrict PCI DMA transfers to 28 bits */ -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,"architecture does not support 28bit PCI busmaster DMA\n" );pci_disable_device (pci);
sound/pci/sonicvibes.c +1 -2
@@ -1230,8 +1230,7 @@ static int snd_sonicvibes_create(struct snd_card *card,if ((err =pci_enable_device (pci)) <0 )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 (card->dev,"architecture does not support 24bit PCI busmaster DMA\n" );pci_disable_device (pci);
sound/pci/trident/trident_main.c +1 -2
@@ -3497,8 +3497,7 @@ int snd_trident_create(struct snd_card *card,if ((err =pci_enable_device (pci)) <0 )return err;/* check, if we can restrict PCI DMA transfers to 30 bits */ -if (dma_set_mask (&pci->dev,DMA_BIT_MASK (30 )) <0 || -dma_set_coherent_mask (&pci->dev,DMA_BIT_MASK (30 )) <0 ) { +if (dma_set_mask_and_coherent (&pci->dev,DMA_BIT_MASK (30 ))) {dev_err (card->dev,"architecture does not support 30bit PCI busmaster DMA\n" );pci_disable_device (pci);
Signature · 1 line
2.26.2
PATCH 2/2 ALSA: x86: Simplify with dma_set_mask_and_coherent()
In reply to Takashi IwaiLPE driver still has explicit calls of dma_set_mask() and dma_set_coherent_mask().
Let's simplify with dma_set_mask_and_coherent().
--- sound/x86/intel_hdmi_audio.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
sound/x86/intel_hdmi_audio.c +1 -2
@@ -1770,8 +1770,7 @@ static int hdmi_lpe_audio_probe(struct platform_device *pdev) card_ctx->irq = irq;/* only 32bit addressable */ -dma_set_mask (&pdev->dev,DMA_BIT_MASK (32 )); -dma_set_coherent_mask (&pdev->dev,DMA_BIT_MASK (32 )); +dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 ));init_channel_allocations ();
Signature · 1 line
2.26.2