ALSA: remove deprecated use of pci api
Subsystems (4)
PATCH 1/1 ALSA: remove deprecated use of pci api
Replace occurences of the pci api by appropriate call to the dma api.
A simplified version of the semantic patch that finds this problem is as
follows: (http://coccinelle.lip6.fr)
@deprecated@
idexpression id;
position p;
@@
(
pci_dma_supported@p ( id, ...)
|
pci_alloc_consistent@p ( id, ...)
)
@bad1@
idexpression id;
position deprecated.p;
@@
...when != &id->dev
when != pci_get_drvdata ( id )
when != pci_enable_device ( id )
(
pci_dma_supported@p ( id, ...)
|
pci_alloc_consistent@p ( id, ...)
)
@depends on !bad1@
idexpression id;
expression direction;
position deprecated.p;
@@
(
- pci_dma_supported@p ( id,
+ dma_supported ( &id->dev,
...
+ , GFP_ATOMIC
)
|
- pci_alloc_consistent@p ( id,
+ dma_alloc_coherent ( &id->dev,
...
+ , GFP_ATOMIC
)
)
--- sound/pci/ad1889.c | 4 ++-- sound/pci/ali5451/ali5451.c | 4 ++-- sound/pci/als300.c | 4 ++-- sound/pci/als4000.c | 4 ++-- sound/pci/au88x0/au88x0.c | 4 ++-- sound/pci/aw2/aw2-alsa.c | 4 ++-- sound/pci/azt3328.c | 4 ++-- sound/pci/ca0106/ca0106_main.c | 4 ++-- sound/pci/cs5535audio/cs5535audio.c | 4 ++-- sound/pci/ctxfi/cthw20k1.c | 4 ++-- sound/pci/ctxfi/cthw20k2.c | 4 ++-- sound/pci/emu10k1/emu10k1_main.c | 4 ++-- sound/pci/es1938.c | 4 ++-- sound/pci/es1968.c | 4 ++-- sound/pci/hda/hda_intel.c | 8 ++++---- sound/pci/ice1712/ice1712.c | 4 ++-- sound/pci/lx6464es/lx6464es.c | 2 +- sound/pci/maestro3.c | 4 ++-- sound/pci/mixart/mixart.c | 2 +- sound/pci/pcxhr/pcxhr.c | 2 +- sound/pci/sis7019.c | 10 +++++----- sound/pci/sonicvibes.c | 4 ++-- sound/pci/trident/trident_main.c | 4 ++-- 23 files changed, 48 insertions(+), 48 deletions(-)
sound/pci/ad1889.c +2 -2
@@ -898,8 +898,8 @@ snd_ad1889_create(struct snd_card *card,return err;/* check PCI availability (32bit DMA) */ -if (pci_set_dma_mask (pci,DMA_BIT_MASK (32 )) <0 || -pci_set_consistent_dma_mask (pci,DMA_BIT_MASK (32 )) <0 ) { +if (dma_set_mask (&pci->dev,DMA_BIT_MASK (32 )) <0 || +dma_set_coherent_mask (&pci->dev,DMA_BIT_MASK (32 )) <0 ) {dev_err (card->dev,"error setting 32-bit DMA mask.\n" );pci_disable_device (pci);return -ENXIO ;
sound/pci/ali5451/ali5451.c +2 -2
@@ -2105,8 +2105,8 @@ static int snd_ali_create(struct snd_carif (err <0 )return err;/* check, if we can restrict PCI DMA transfers to 31 bits */ -if (pci_set_dma_mask (pci,DMA_BIT_MASK (31 )) <0 || -pci_set_consistent_dma_mask (pci,DMA_BIT_MASK (31 )) <0 ) { +if (dma_set_mask (&pci->dev,DMA_BIT_MASK (31 )) <0 || +dma_set_coherent_mask (&pci->dev,DMA_BIT_MASK (31 )) <0 ) {dev_err (card->dev,"architecture does not support 31bit PCI busmaster DMA\n" );pci_disable_device (pci);
sound/pci/als300.c +2 -2
@@ -658,8 +658,8 @@ static int snd_als300_create(struct snd_if ((err =pci_enable_device (pci)) <0 )return err; -if (pci_set_dma_mask (pci,DMA_BIT_MASK (28 )) <0 || -pci_set_consistent_dma_mask (pci,DMA_BIT_MASK (28 )) <0 ) { +if (dma_set_mask (&pci->dev,DMA_BIT_MASK (28 )) <0 || +dma_set_coherent_mask (&pci->dev,DMA_BIT_MASK (28 )) <0 ) {dev_err (card->dev,"error setting 28bit DMA mask\n" );pci_disable_device (pci);return -ENXIO ;
sound/pci/als4000.c +2 -2
@@ -871,8 +871,8 @@ static int snd_card_als4000_probe(structreturn err; }/* check, if we can restrict PCI DMA transfers to 24 bits */ -if (pci_set_dma_mask (pci,DMA_BIT_MASK (24 )) <0 || -pci_set_consistent_dma_mask (pci,DMA_BIT_MASK (24 )) <0 ) { +if (dma_set_mask (&pci->dev,DMA_BIT_MASK (24 )) <0 || +dma_set_coherent_mask (&pci->dev,DMA_BIT_MASK (24 )) <0 ) {dev_err (&pci->dev,"architecture does not support 24bit PCI busmaster DMA\n" );pci_disable_device (pci);return -ENXIO ;
sound/pci/au88x0/au88x0.c +2 -2
@@ -150,8 +150,8 @@ snd_vortex_create(struct snd_card *card,// check PCI availability (DMA). if ((err =pci_enable_device (pci)) <0 )return err; -if (pci_set_dma_mask (pci,DMA_BIT_MASK (32 )) <0 || -pci_set_consistent_dma_mask (pci,DMA_BIT_MASK (32 )) <0 ) { +if (dma_set_mask (&pci->dev,DMA_BIT_MASK (32 )) <0 || +dma_set_coherent_mask (&pci->dev,DMA_BIT_MASK (32 )) <0 ) {dev_err (card->dev,"error to set DMA mask\n" );pci_disable_device (pci);return -ENXIO ;
sound/pci/aw2/aw2-alsa.c +2 -2
@@ -258,8 +258,8 @@ static int snd_aw2_create(struct snd_carpci_set_master (pci);/* check PCI availability (32bit DMA) */ -if ((pci_set_dma_mask (pci,DMA_BIT_MASK (32 )) <0 ) || - (pci_set_consistent_dma_mask (pci,DMA_BIT_MASK (32 )) <0 )) { +if ((dma_set_mask (&pci->dev,DMA_BIT_MASK (32 )) <0 ) || + (dma_set_coherent_mask (&pci->dev,DMA_BIT_MASK (32 )) <0 )) {dev_err (card->dev,"Impossible to set 32bit mask DMA\n" );pci_disable_device (pci);return -ENXIO ;
sound/pci/azt3328.c +2 -2
@@ -2420,8 +2420,8 @@ snd_azf3328_create(struct snd_card *card chip->irq =-1 ;/* check if we can restrict PCI DMA transfers to 24 bits */ -if (pci_set_dma_mask (pci,DMA_BIT_MASK (24 )) <0 || -pci_set_consistent_dma_mask (pci,DMA_BIT_MASK (24 )) <0 ) { +if (dma_set_mask (&pci->dev,DMA_BIT_MASK (24 )) <0 || +dma_set_coherent_mask (&pci->dev,DMA_BIT_MASK (24 )) <0 ) {dev_err (card->dev,"architecture does not support 24bit PCI busmaster DMA\n" );
sound/pci/ca0106/ca0106_main.c +2 -2
@@ -1676,8 +1676,8 @@ static int snd_ca0106_create(int dev, st err =pci_enable_device (pci);if (err <0 )return err; -if (pci_set_dma_mask (pci,DMA_BIT_MASK (32 )) <0 || -pci_set_consistent_dma_mask (pci,DMA_BIT_MASK (32 )) <0 ) { +if (dma_set_mask (&pci->dev,DMA_BIT_MASK (32 )) <0 || +dma_set_coherent_mask (&pci->dev,DMA_BIT_MASK (32 )) <0 ) {dev_err (card->dev,"error to set 32bit mask DMA\n" );pci_disable_device (pci);return -ENXIO ;
sound/pci/cs5535audio/cs5535audio.c +2 -2
@@ -289,8 +289,8 @@ static int snd_cs5535audio_create(structif ((err =pci_enable_device (pci)) <0 )return err; -if (pci_set_dma_mask (pci,DMA_BIT_MASK (32 )) <0 || -pci_set_consistent_dma_mask (pci,DMA_BIT_MASK (32 )) <0 ) { +if (dma_set_mask (&pci->dev,DMA_BIT_MASK (32 )) <0 || +dma_set_coherent_mask (&pci->dev,DMA_BIT_MASK (32 )) <0 ) {dev_warn (card->dev,"unable to get 32bit dma\n" ); err = -ENXIO ; goto pcifail;
sound/pci/ctxfi/cthw20k1.c +2 -2
@@ -1910,8 +1910,8 @@ static int hw_card_start(struct hw *hw)return err;/* Set DMA transfer mask */ -if (pci_set_dma_mask (pci,CT_XFI_DMA_MASK ) <0 || -pci_set_consistent_dma_mask (pci,CT_XFI_DMA_MASK ) <0 ) { +if (dma_set_mask (&pci->dev,CT_XFI_DMA_MASK ) <0 || +dma_set_coherent_mask (&pci->dev,CT_XFI_DMA_MASK ) <0 ) {dev_err (hw->card->dev,"architecture does not support PCI busmaster DMA with mask 0x%llx\n" ,CT_XFI_DMA_MASK );
sound/pci/ctxfi/cthw20k2.c +2 -2
@@ -2035,8 +2035,8 @@ static int hw_card_start(struct hw *hw)return err;/* Set DMA transfer mask */ -if (pci_set_dma_mask (pci,CT_XFI_DMA_MASK ) <0 || -pci_set_consistent_dma_mask (pci,CT_XFI_DMA_MASK ) <0 ) { +if (dma_set_mask (&pci->dev,CT_XFI_DMA_MASK ) <0 || +dma_set_coherent_mask (&pci->dev,CT_XFI_DMA_MASK ) <0 ) {dev_err (hw->card->dev,"architecture does not support PCI busmaster DMA with mask 0x%llx\n" ,CT_XFI_DMA_MASK );
sound/pci/emu10k1/emu10k1_main.c +2 -2
@@ -1904,8 +1904,8 @@ int snd_emu10k1_create(struct snd_card */* set the DMA transfer mask */ emu->dma_mask = is_audigy ?AUDIGY_DMA_MASK :EMU10K1_DMA_MASK ; -if (pci_set_dma_mask (pci, emu->dma_mask) <0 || -pci_set_consistent_dma_mask (pci, emu->dma_mask) <0 ) { +if (dma_set_mask (&pci->dev, emu->dma_mask) <0 || +dma_set_coherent_mask (&pci->dev, emu->dma_mask) <0 ) {dev_err (card->dev,"architecture does not support PCI busmaster DMA with mask 0x%lx\n" , emu->dma_mask);
sound/pci/es1938.c +2 -2
@@ -1580,8 +1580,8 @@ static int snd_es1938_create(struct snd_if ((err =pci_enable_device (pci)) <0 )return err;/* check, if we can restrict PCI DMA transfers to 24 bits */ -if (pci_set_dma_mask (pci,DMA_BIT_MASK (24 )) <0 || -pci_set_consistent_dma_mask (pci,DMA_BIT_MASK (24 )) <0 ) { +if (dma_set_mask (&pci->dev,DMA_BIT_MASK (24 )) <0 || +dma_set_coherent_mask (&pci->dev,DMA_BIT_MASK (24 )) <0 ) {dev_err (card->dev,"architecture does not support 24bit PCI busmaster DMA\n" );pci_disable_device (pci);
sound/pci/es1968.c +2 -2
@@ -2689,8 +2689,8 @@ static int snd_es1968_create(struct snd_if ((err =pci_enable_device (pci)) <0 )return err;/* check, if we can restrict PCI DMA transfers to 28 bits */ -if (pci_set_dma_mask (pci,DMA_BIT_MASK (28 )) <0 || -pci_set_consistent_dma_mask (pci,DMA_BIT_MASK (28 )) <0 ) { +if (dma_set_mask (&pci->dev,DMA_BIT_MASK (28 )) <0 || +dma_set_coherent_mask (&pci->dev,DMA_BIT_MASK (28 )) <0 ) {dev_err (card->dev,"architecture does not support 28bit PCI busmaster DMA\n" );pci_disable_device (pci);
sound/pci/hda/hda_intel.c +4 -4
@@ -1528,11 +1528,11 @@ static int azx_first_init(struct azx *ch/* allow 64bit DMA address if supported by H/W */ if (!(gcap &AZX_GCAP_64OK )) dma_bits =32 ; -if (!pci_set_dma_mask (pci,DMA_BIT_MASK (dma_bits))) { -pci_set_consistent_dma_mask (pci,DMA_BIT_MASK (dma_bits)); +if (!dma_set_mask (&pci->dev,DMA_BIT_MASK (dma_bits))) { +dma_set_coherent_mask (&pci->dev,DMA_BIT_MASK (dma_bits)); }else { -pci_set_dma_mask (pci,DMA_BIT_MASK (32 )); -pci_set_consistent_dma_mask (pci,DMA_BIT_MASK (32 )); +dma_set_mask (&pci->dev,DMA_BIT_MASK (32 )); +dma_set_coherent_mask (&pci->dev,DMA_BIT_MASK (32 )); }/* read number of streams from GCAP register instead of using
sound/pci/ice1712/ice1712.c +2 -2
@@ -2530,8 +2530,8 @@ static int snd_ice1712_create(struct sndif (err <0 )return err;/* check, if we can restrict PCI DMA transfers to 28 bits */ -if (pci_set_dma_mask (pci,DMA_BIT_MASK (28 )) <0 || -pci_set_consistent_dma_mask (pci,DMA_BIT_MASK (28 )) <0 ) { +if (dma_set_mask (&pci->dev,DMA_BIT_MASK (28 )) <0 || +dma_set_coherent_mask (&pci->dev,DMA_BIT_MASK (28 )) <0 ) {dev_err (card->dev,"architecture does not support 28bit PCI busmaster DMA\n" );pci_disable_device (pci);
sound/pci/lx6464es/lx6464es.c +1 -1
@@ -981,7 +981,7 @@ static int snd_lx6464es_create(struct snpci_set_master (pci);/* check if we can restrict PCI DMA transfers to 32 bits */ - err =pci_set_dma_mask (pci,DMA_BIT_MASK (32 )); + err =dma_set_mask (&pci->dev,DMA_BIT_MASK (32 ));if (err <0 ) {dev_err (card->dev,"architecture does not support 32bit PCI busmaster DMA\n" );
sound/pci/maestro3.c +2 -2
@@ -2537,8 +2537,8 @@ snd_m3_create(struct snd_card *card, strreturn -EIO ;/* check, if we can restrict PCI DMA transfers to 28 bits */ -if (pci_set_dma_mask (pci,DMA_BIT_MASK (28 )) <0 || -pci_set_consistent_dma_mask (pci,DMA_BIT_MASK (28 )) <0 ) { +if (dma_set_mask (&pci->dev,DMA_BIT_MASK (28 )) <0 || +dma_set_coherent_mask (&pci->dev,DMA_BIT_MASK (28 )) <0 ) {dev_err (card->dev,"architecture does not support 28bit PCI busmaster DMA\n" );pci_disable_device (pci);
sound/pci/mixart/mixart.c +1 -1
@@ -1269,7 +1269,7 @@ static int snd_mixart_probe(struct pci_dpci_set_master (pci);/* check if we can restrict PCI DMA transfers to 32 bits */ -if (pci_set_dma_mask (pci,DMA_BIT_MASK (32 )) <0 ) { +if (dma_set_mask (&pci->dev,DMA_BIT_MASK (32 )) <0 ) {dev_err (&pci->dev,"architecture does not support 32bit PCI busmaster DMA\n" );pci_disable_device (pci);
sound/pci/pcxhr/pcxhr.c +1 -1
@@ -1537,7 +1537,7 @@ static int pcxhr_probe(struct pci_dev *ppci_set_master (pci);/* check if we can restrict PCI DMA transfers to 32 bits */ -if (pci_set_dma_mask (pci,DMA_BIT_MASK (32 )) <0 ) { +if (dma_set_mask (&pci->dev,DMA_BIT_MASK (32 )) <0 ) {dev_err (&pci->dev,"architecture does not support 32bit PCI busmaster DMA\n" );pci_disable_device (pci);
sound/pci/sis7019.c +5 -5
@@ -383,9 +383,9 @@ static void __sis_map_silence(struct sis {/* Helper function: must hold sis->voice_lock on entry */ if (!sis->silence_users) - sis->silence_dma_addr =pci_map_single (sis->pci, + sis->silence_dma_addr =dma_map_single (&sis->pci->dev, sis->suspend_state[0 ], -4096 ,PCI_DMA_TODEVICE ); +4096 ,DMA_TO_DEVICE ); sis->silence_users++; }
@@ -394,8 +394,8 @@ static void __sis_unmap_silence(struct s/* Helper function: must hold sis->voice_lock on entry */ sis->silence_users--;if (!sis->silence_users) -pci_unmap_single (sis->pci, sis->silence_dma_addr,4096 , -PCI_DMA_TODEVICE ); +dma_unmap_single (&sis->pci->dev, sis->silence_dma_addr,4096 , +DMA_TO_DEVICE ); }static void sis_free_voice (struct sis7019 *sis,struct voice *voice)
@@ -1325,7 +1325,7 @@ static int sis_chip_create(struct snd_caif (rc) goto error_out; - rc =pci_set_dma_mask (pci,DMA_BIT_MASK (30 )); + rc =dma_set_mask (&pci->dev,DMA_BIT_MASK (30 ));if (rc <0 ) {dev_err (&pci->dev,"architecture does not support 30-bit PCI busmaster DMA" ); goto error_out_enabled;
sound/pci/sonicvibes.c +2 -2
@@ -1259,8 +1259,8 @@ static int snd_sonicvibes_create(structif ((err =pci_enable_device (pci)) <0 )return err;/* check, if we can restrict PCI DMA transfers to 24 bits */ -if (pci_set_dma_mask (pci,DMA_BIT_MASK (24 )) <0 || -pci_set_consistent_dma_mask (pci,DMA_BIT_MASK (24 )) <0 ) { +if (dma_set_mask (&pci->dev,DMA_BIT_MASK (24 )) <0 || +dma_set_coherent_mask (&pci->dev,DMA_BIT_MASK (24 )) <0 ) {dev_err (card->dev,"architecture does not support 24bit PCI busmaster DMA\n" );pci_disable_device (pci);
sound/pci/trident/trident_main.c +2 -2
@@ -3551,8 +3551,8 @@ int snd_trident_create(struct snd_card *if ((err =pci_enable_device (pci)) <0 )return err;/* check, if we can restrict PCI DMA transfers to 30 bits */ -if (pci_set_dma_mask (pci,DMA_BIT_MASK (30 )) <0 || -pci_set_consistent_dma_mask (pci,DMA_BIT_MASK (30 )) <0 ) { +if (dma_set_mask (&pci->dev,DMA_BIT_MASK (30 )) <0 || +dma_set_coherent_mask (&pci->dev,DMA_BIT_MASK (30 )) <0 ) {dev_err (card->dev,"architecture does not support 30bit PCI busmaster DMA\n" );pci_disable_device (pci);
Takashi Iwai
AppliedAt Wed, 15 Apr 2015 16:10:17 +0200,
Quoted 50 lines · Quentin Lambert
Replace occurences of the pci api by appropriate call to the dma api.
A simplified version of the semantic patch that finds this problem is as
follows: (http://coccinelle.lip6.fr)@deprecated@
idexpression id;
position p;
@@(
pci_dma_supported@p ( id, ...)
|
pci_alloc_consistent@p ( id, ...)
)@bad1@
idexpression id;
position deprecated.p;
@@
...when !=&id->dev
when !=pci_get_drvdata( id )
when !=pci_enable_device( id )
(
pci_dma_supported@p ( id, ...)
|
pci_alloc_consistent@p ( id, ...)
)@depends on !bad1@
idexpression id;
expression direction;
position deprecated.p;
@@(
- pci_dma_supported@p ( id,
+dma_supported(&id->dev,
...
+ ,GFP_ATOMIC
)
|
- pci_alloc_consistent@p ( id,
+dma_alloc_coherent(&id->dev,
...
+ ,GFP_ATOMIC
)
)
Quoted 1 line
Signed-off-by Quentin Lambert <[email protected]>
Thanks, applied to for-4.2 branch.
Takashi