Skip to content

Commit

Permalink
ALSA: pci: Avoid non-standard macro usage
Browse files Browse the repository at this point in the history
Pass the device pointer from the PCI pointer directly, instead of a
non-standard macro.  The macro didn't give any better readability.

Link: https://lore.kernel.org/r/20191105151856.10785-24-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Takashi Iwai committed Nov 6, 2019
1 parent 1a81043 commit 6974f8a
Show file tree
Hide file tree
Showing 46 changed files with 145 additions and 116 deletions.
6 changes: 3 additions & 3 deletions sound/pci/ad1889.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,9 +633,9 @@ snd_ad1889_pcm_init(struct snd_ad1889 *chip, int device)
chip->csubs = NULL;

snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(chip->pci),
BUFFER_BYTES_MAX / 2,
BUFFER_BYTES_MAX);
&chip->pci->dev,
BUFFER_BYTES_MAX / 2,
BUFFER_BYTES_MAX);

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion sound/pci/ali5451/ali5451.c
Original file line number Diff line number Diff line change
Expand Up @@ -1672,7 +1672,7 @@ static int snd_ali_pcm(struct snd_ali *codec, int device,
desc->capture_ops);

snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(codec->pci),
&codec->pci->dev,
64*1024, 128*1024);

pcm->info_flags = 0;
Expand Down
3 changes: 2 additions & 1 deletion sound/pci/als300.c
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,8 @@ static int snd_als300_new_pcm(struct snd_als300 *chip)

/* pre-allocation of buffers */
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(chip->pci), 64*1024, 64*1024);
&chip->pci->dev,
64*1024, 64*1024);
return 0;
}

Expand Down
3 changes: 2 additions & 1 deletion sound/pci/als4000.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,8 @@ static int snd_als4000_pcm(struct snd_sb *chip, int device)
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_als4000_playback_ops);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_als4000_capture_ops);

snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
&chip->pci->dev,
64*1024, 64*1024);

chip->pcm = pcm;
Expand Down
4 changes: 2 additions & 2 deletions sound/pci/asihpi/asihpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1325,8 +1325,8 @@ static int snd_card_asihpi_pcm_new(struct snd_card_asihpi *asihpi, int device)
/*? do we want to emulate MMAP for non-BBM cards?
Jack doesn't work with ALSAs MMAP emulation - WHY NOT? */
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(asihpi->pci),
64*1024, BUFFER_BYTES_MAX);
&asihpi->pci->dev,
64*1024, BUFFER_BYTES_MAX);

return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions sound/pci/atiixp.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ static int atiixp_build_dma_packets(struct atiixp *chip, struct atiixp_dma *dma,

if (dma->desc_buf.area == NULL) {
if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(chip->pci),
&chip->pci->dev,
ATI_DESC_LIST_SIZE,
&dma->desc_buf) < 0)
return -ENOMEM;
Expand Down Expand Up @@ -1284,7 +1284,7 @@ static int snd_atiixp_pcm_new(struct atiixp *chip)
chip->pcmdevs[ATI_PCMDEV_ANALOG] = pcm;

snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(chip->pci),
&chip->pci->dev,
64*1024, 128*1024);

err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK,
Expand Down Expand Up @@ -1317,7 +1317,7 @@ static int snd_atiixp_pcm_new(struct atiixp *chip)
chip->pcmdevs[ATI_PCMDEV_DIGITAL] = pcm;

snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(chip->pci),
&chip->pci->dev,
64*1024, 128*1024);

/* pre-select AC97 SPDIF slots 10/11 */
Expand Down
4 changes: 2 additions & 2 deletions sound/pci/atiixp_modem.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ static int atiixp_build_dma_packets(struct atiixp_modem *chip,
return -ENOMEM;

if (dma->desc_buf.area == NULL) {
if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),
if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &chip->pci->dev,
ATI_DESC_LIST_SIZE, &dma->desc_buf) < 0)
return -ENOMEM;
dma->period_bytes = dma->periods = 0; /* clear */
Expand Down Expand Up @@ -995,7 +995,7 @@ static int snd_atiixp_pcm_new(struct atiixp_modem *chip)
chip->pcmdevs[ATI_PCMDEV_ANALOG] = pcm;

snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(chip->pci),
&chip->pci->dev,
64*1024, 128*1024);

return 0;
Expand Down
2 changes: 1 addition & 1 deletion sound/pci/au88x0/au88x0_pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ static int snd_vortex_new_pcm(vortex_t *chip, int idx, int nr)
/* pre-allocation of Scatter-Gather buffers */

snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
snd_dma_pci_data(chip->pci_dev),
&chip->pci_dev,
0x10000, 0x10000);

switch (VORTEX_PCM_TYPE(pcm)) {
Expand Down
6 changes: 3 additions & 3 deletions sound/pci/aw2/aw2-alsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ static int snd_aw2_new_pcm(struct aw2 *chip)
/* Preallocate continuous pages. */
snd_pcm_lib_preallocate_pages_for_all(pcm_playback_ana,
SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(chip->pci),
&chip->pci->dev,
64 * 1024, 64 * 1024);

err = snd_pcm_new(chip->card, "Audiowerk2 digital playback", 1, 1, 0,
Expand Down Expand Up @@ -645,7 +645,7 @@ static int snd_aw2_new_pcm(struct aw2 *chip)
/* Preallocate continuous pages. */
snd_pcm_lib_preallocate_pages_for_all(pcm_playback_num,
SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(chip->pci),
&chip->pci->dev,
64 * 1024, 64 * 1024);

err = snd_pcm_new(chip->card, "Audiowerk2 capture", 2, 0, 1,
Expand Down Expand Up @@ -678,7 +678,7 @@ static int snd_aw2_new_pcm(struct aw2 *chip)
/* Preallocate continuous pages. */
snd_pcm_lib_preallocate_pages_for_all(pcm_capture,
SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(chip->pci),
&chip->pci->dev,
64 * 1024, 64 * 1024);

/* Create control */
Expand Down
8 changes: 4 additions & 4 deletions sound/pci/azt3328.c
Original file line number Diff line number Diff line change
Expand Up @@ -2135,8 +2135,8 @@ snd_azf3328_pcm(struct snd_azf3328 *chip)
chip->pcm[AZF_CODEC_CAPTURE] = pcm;

snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(chip->pci),
64*1024, 64*1024);
&chip->pci->dev,
64*1024, 64*1024);

err = snd_pcm_new(chip->card, "AZF3328 I2S OUT", AZF_PCMDEV_I2S_OUT,
1, 0, &pcm);
Expand All @@ -2151,8 +2151,8 @@ snd_azf3328_pcm(struct snd_azf3328 *chip)
chip->pcm[AZF_CODEC_I2S_OUT] = pcm;

snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(chip->pci),
64*1024, 64*1024);
&chip->pci->dev,
64*1024, 64*1024);

return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions sound/pci/bt87x.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ static int snd_bt87x_create_risc(struct snd_bt87x *chip, struct snd_pcm_substrea
__le32 *risc;

if (chip->dma_risc.area == NULL) {
if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),
if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &chip->pci->dev,
PAGE_ALIGN(MAX_RISC_SIZE), &chip->dma_risc) < 0)
return -ENOMEM;
}
Expand Down Expand Up @@ -700,7 +700,7 @@ static int snd_bt87x_pcm(struct snd_bt87x *chip, int device, char *name)
strcpy(pcm->name, name);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_bt87x_pcm_ops);
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
snd_dma_pci_data(chip->pci),
&chip->pci->dev,
128 * 1024,
ALIGN(255 * 4092, 1024));
return 0;
Expand Down
6 changes: 3 additions & 3 deletions sound/pci/ca0106/ca0106_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1389,15 +1389,15 @@ static int snd_ca0106_pcm(struct snd_ca0106 *emu, int device)
substream;
substream = substream->next) {
snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(emu->pci),
&emu->pci->dev,
64*1024, 64*1024);
}

for (substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream;
substream;
substream = substream->next) {
snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(emu->pci),
&emu->pci->dev,
64*1024, 64*1024);
}

Expand Down Expand Up @@ -1692,7 +1692,7 @@ static int snd_ca0106_create(int dev, struct snd_card *card,
chip->irq = pci->irq;

/* This stores the periods table. */
if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &pci->dev,
1024, &chip->buffer) < 0) {
snd_ca0106_free(chip);
return -ENOMEM;
Expand Down
6 changes: 3 additions & 3 deletions sound/pci/cmipci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1902,7 +1902,7 @@ static int snd_cmipci_pcm_new(struct cmipci *cm, int device)
cm->pcm = pcm;

snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(cm->pci), 64*1024, 128*1024);
&cm->pci->dev, 64*1024, 128*1024);

return 0;
}
Expand All @@ -1924,7 +1924,7 @@ static int snd_cmipci_pcm2_new(struct cmipci *cm, int device)
cm->pcm2 = pcm;

snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(cm->pci), 64*1024, 128*1024);
&cm->pci->dev, 64*1024, 128*1024);

return 0;
}
Expand All @@ -1947,7 +1947,7 @@ static int snd_cmipci_pcm_spdif_new(struct cmipci *cm, int device)
cm->pcm_spdif = pcm;

snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(cm->pci), 64*1024, 128*1024);
&cm->pci->dev, 64*1024, 128*1024);

err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK,
snd_pcm_alt_chmaps, cm->max_channels, 0,
Expand Down
3 changes: 2 additions & 1 deletion sound/pci/cs4281.c
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,8 @@ static int snd_cs4281_pcm(struct cs4281 *chip, int device)
chip->pcm = pcm;

snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(chip->pci), 64*1024, 512*1024);
&chip->pci->dev,
64*1024, 512*1024);

return 0;
}
Expand Down
16 changes: 10 additions & 6 deletions sound/pci/cs46xx/cs46xx_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1494,7 +1494,7 @@ static int _cs46xx_playback_open_channel (struct snd_pcm_substream *substream,in
cpcm = kzalloc(sizeof(*cpcm), GFP_KERNEL);
if (cpcm == NULL)
return -ENOMEM;
if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),
if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &chip->pci->dev,
PAGE_SIZE, &cpcm->hw_buf) < 0) {
kfree(cpcm);
return -ENOMEM;
Expand Down Expand Up @@ -1582,7 +1582,7 @@ static int snd_cs46xx_capture_open(struct snd_pcm_substream *substream)
{
struct snd_cs46xx *chip = snd_pcm_substream_chip(substream);

if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),
if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &chip->pci->dev,
PAGE_SIZE, &chip->capt.hw_buf) < 0)
return -ENOMEM;
chip->capt.substream = substream;
Expand Down Expand Up @@ -1784,7 +1784,8 @@ int snd_cs46xx_pcm(struct snd_cs46xx *chip, int device)
chip->pcm = pcm;

snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(chip->pci), 64*1024, 256*1024);
&chip->pci->dev,
64*1024, 256*1024);

return 0;
}
Expand All @@ -1809,7 +1810,8 @@ int snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device)
chip->pcm_rear = pcm;

snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(chip->pci), 64*1024, 256*1024);
&chip->pci->dev,
64*1024, 256*1024);

return 0;
}
Expand All @@ -1832,7 +1834,8 @@ int snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device)
chip->pcm_center_lfe = pcm;

snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(chip->pci), 64*1024, 256*1024);
&chip->pci->dev,
64*1024, 256*1024);

return 0;
}
Expand All @@ -1855,7 +1858,8 @@ int snd_cs46xx_pcm_iec958(struct snd_cs46xx *chip, int device)
chip->pcm_iec958 = pcm;

snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(chip->pci), 64*1024, 256*1024);
&chip->pci->dev,
64*1024, 256*1024);

return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions sound/pci/cs5535audio/cs5535audio_pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ static int cs5535audio_build_dma_packets(struct cs5535audio *cs5535au,

if (dma->desc_buf.area == NULL) {
if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(cs5535au->pci),
&cs5535au->pci->dev,
CS5535AUDIO_DESC_LIST_SIZE+1,
&dma->desc_buf) < 0)
return -ENOMEM;
Expand Down Expand Up @@ -432,8 +432,8 @@ int snd_cs5535audio_pcm(struct cs5535audio *cs5535au)
strcpy(pcm->name, "CS5535 Audio");

snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(cs5535au->pci),
64*1024, 128*1024);
&cs5535au->pci->dev,
64*1024, 128*1024);
cs5535au->pcm = pcm;

return 0;
Expand Down
3 changes: 2 additions & 1 deletion sound/pci/ctxfi/ctpcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,8 @@ int ct_alsa_pcm_create(struct ct_atc *atc,
SNDRV_PCM_STREAM_CAPTURE, &ct_pcm_capture_ops);

snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
snd_dma_pci_data(atc->pci), 128*1024, 128*1024);
&atc->pci->dev,
128*1024, 128*1024);

chs = 2;
switch (device) {
Expand Down
2 changes: 1 addition & 1 deletion sound/pci/ctxfi/ctvmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ int ct_vm_create(struct ct_vm **rvm, struct pci_dev *pci)
/* Allocate page table pages */
for (i = 0; i < CT_PTP_NUM; i++) {
err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(pci),
&pci->dev,
PAGE_SIZE, &vm->ptp[i]);
if (err < 0)
break;
Expand Down
5 changes: 3 additions & 2 deletions sound/pci/emu10k1/emu10k1.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,9 @@ static int snd_card_emu10k1_probe(struct pci_dev *pci,
goto error;
/* This stores the periods table. */
if (emu->card_capabilities->ca0151_chip) { /* P16V */
if ((err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
1024, &emu->p16v_buffer)) < 0)
err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &pci->dev,
1024, &emu->p16v_buffer);
if (err < 0)
goto error;
}

Expand Down
6 changes: 3 additions & 3 deletions sound/pci/emu10k1/emu10k1x.c
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ static int snd_emu10k1x_pcm(struct emu10k1x *emu, int device)
emu->pcm = pcm;

snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(emu->pci),
&emu->pci->dev,
32*1024, 32*1024);

return snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, map, 2,
Expand Down Expand Up @@ -936,8 +936,8 @@ static int snd_emu10k1x_create(struct snd_card *card,
}
chip->irq = pci->irq;

if(snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
4 * 1024, &chip->dma_buffer) < 0) {
if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &pci->dev,
4 * 1024, &chip->dma_buffer) < 0) {
snd_emu10k1x_free(chip);
return -ENOMEM;
}
Expand Down
2 changes: 1 addition & 1 deletion sound/pci/emu10k1/emufx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2464,7 +2464,7 @@ int snd_emu10k1_fx8010_tram_setup(struct snd_emu10k1 *emu, u32 size)
}

if (size > 0) {
if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(emu->pci),
if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &emu->pci->dev,
size * 2, &emu->fx8010.etram_pages) < 0)
return -ENOMEM;
memset(emu->fx8010.etram_pages.area, 0, size * 2);
Expand Down
Loading

0 comments on commit 6974f8a

Please sign in to comment.