Skip to content

Commit

Permalink
ALSA: pci: Convert to snd_card_new() with a device pointer
Browse files Browse the repository at this point in the history
Also remove superfluous snd_card_set_dev() calls.

Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
tiwai committed Feb 12, 2014
1 parent 4323cc4 commit 60c5772
Show file tree
Hide file tree
Showing 56 changed files with 98 additions and 156 deletions.
5 changes: 2 additions & 3 deletions sound/pci/ad1889.c
Original file line number Diff line number Diff line change
Expand Up @@ -965,8 +965,6 @@ snd_ad1889_create(struct snd_card *card,
return err;
}

snd_card_set_dev(card, &pci->dev);

*rchip = chip;

return 0;
Expand Down Expand Up @@ -996,7 +994,8 @@ snd_ad1889_probe(struct pci_dev *pci,
}

/* (2) */
err = snd_card_create(index[devno], id[devno], THIS_MODULE, 0, &card);
err = snd_card_new(&pci->dev, index[devno], id[devno], THIS_MODULE,
0, &card);
/* XXX REVISIT: we can probably allocate chip in this call */
if (err < 0)
return err;
Expand Down
4 changes: 1 addition & 3 deletions sound/pci/ali5451/ali5451.c
Original file line number Diff line number Diff line change
Expand Up @@ -2218,8 +2218,6 @@ static int snd_ali_create(struct snd_card *card,
return err;
}

snd_card_set_dev(card, &pci->dev);

/* initialise synth voices*/
for (i = 0; i < ALI_CHANNELS; i++)
codec->synth.voices[i].number = i;
Expand Down Expand Up @@ -2253,7 +2251,7 @@ static int snd_ali_probe(struct pci_dev *pci,

snd_ali_printk("probe ...\n");

err = snd_card_create(index, id, THIS_MODULE, 0, &card);
err = snd_card_new(&pci->dev, index, id, THIS_MODULE, 0, &card);
if (err < 0)
return err;

Expand Down
5 changes: 2 additions & 3 deletions sound/pci/als300.c
Original file line number Diff line number Diff line change
Expand Up @@ -761,8 +761,6 @@ static int snd_als300_create(struct snd_card *card,
return err;
}

snd_card_set_dev(card, &pci->dev);

*rchip = chip;
snd_als300_dbgcallleave();
return 0;
Expand Down Expand Up @@ -829,7 +827,8 @@ static int snd_als300_probe(struct pci_dev *pci,
return -ENOENT;
}

err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
0, &card);

if (err < 0)
return err;
Expand Down
7 changes: 3 additions & 4 deletions sound/pci/als4000.c
Original file line number Diff line number Diff line change
Expand Up @@ -888,9 +888,9 @@ static int snd_card_als4000_probe(struct pci_dev *pci,
pci_write_config_word(pci, PCI_COMMAND, word | PCI_COMMAND_IO);
pci_set_master(pci);

err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(*acard) /* private_data: acard */,
&card);
err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
sizeof(*acard) /* private_data: acard */,
&card);
if (err < 0) {
pci_release_regions(pci);
pci_disable_device(pci);
Expand Down Expand Up @@ -920,7 +920,6 @@ static int snd_card_als4000_probe(struct pci_dev *pci,

chip->pci = pci;
chip->alt_port = iobase;
snd_card_set_dev(card, &pci->dev);

snd_als4000_configure(chip);

Expand Down
16 changes: 5 additions & 11 deletions sound/pci/asihpi/asihpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -2827,26 +2827,20 @@ static int snd_asihpi_probe(struct pci_dev *pci_dev,
hpi = pci_get_drvdata(pci_dev);
adapter_index = hpi->adapter->index;
/* first try to give the card the same index as its hardware index */
err = snd_card_create(adapter_index,
id[adapter_index], THIS_MODULE,
sizeof(struct snd_card_asihpi),
&card);
err = snd_card_new(&pci_dev->dev, adapter_index, id[adapter_index],
THIS_MODULE, sizeof(struct snd_card_asihpi), &card);
if (err < 0) {
/* if that fails, try the default index==next available */
err =
snd_card_create(index[dev], id[dev],
THIS_MODULE,
sizeof(struct snd_card_asihpi),
&card);
err = snd_card_new(&pci_dev->dev, index[dev], id[dev],
THIS_MODULE, sizeof(struct snd_card_asihpi),
&card);
if (err < 0)
return err;
snd_printk(KERN_WARNING
"**** WARNING **** Adapter index %d->ALSA index %d\n",
adapter_index, card->number);
}

snd_card_set_dev(card, &pci_dev->dev);

asihpi = card->private_data;
asihpi->card = card;
asihpi->pci = pci_dev;
Expand Down
4 changes: 1 addition & 3 deletions sound/pci/atiixp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1657,8 +1657,6 @@ static int snd_atiixp_create(struct snd_card *card,
return err;
}

snd_card_set_dev(card, &pci->dev);

*r_chip = chip;
return 0;
}
Expand All @@ -1671,7 +1669,7 @@ static int snd_atiixp_probe(struct pci_dev *pci,
struct atiixp *chip;
int err;

err = snd_card_create(index, id, THIS_MODULE, 0, &card);
err = snd_card_new(&pci->dev, index, id, THIS_MODULE, 0, &card);
if (err < 0)
return err;

Expand Down
4 changes: 1 addition & 3 deletions sound/pci/atiixp_modem.c
Original file line number Diff line number Diff line change
Expand Up @@ -1282,8 +1282,6 @@ static int snd_atiixp_create(struct snd_card *card,
return err;
}

snd_card_set_dev(card, &pci->dev);

*r_chip = chip;
return 0;
}
Expand All @@ -1296,7 +1294,7 @@ static int snd_atiixp_probe(struct pci_dev *pci,
struct atiixp_modem *chip;
int err;

err = snd_card_create(index, id, THIS_MODULE, 0, &card);
err = snd_card_new(&pci->dev, index, id, THIS_MODULE, 0, &card);
if (err < 0)
return err;

Expand Down
5 changes: 2 additions & 3 deletions sound/pci/au88x0/au88x0.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,6 @@ snd_vortex_create(struct snd_card *card, struct pci_dev *pci, vortex_t ** rchip)
goto alloc_out;
}

snd_card_set_dev(card, &pci->dev);

*rchip = chip;

return 0;
Expand Down Expand Up @@ -250,7 +248,8 @@ snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
return -ENOENT;
}
// (2)
err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
0, &card);
if (err < 0)
return err;

Expand Down
4 changes: 2 additions & 2 deletions sound/pci/aw2/aw2-alsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,6 @@ static int snd_aw2_create(struct snd_card *card,
return err;
}

snd_card_set_dev(card, &pci->dev);
*rchip = chip;

printk(KERN_INFO
Expand All @@ -349,7 +348,8 @@ static int snd_aw2_probe(struct pci_dev *pci,
}

/* (2) Create card instance */
err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
0, &card);
if (err < 0)
return err;

Expand Down
5 changes: 2 additions & 3 deletions sound/pci/azt3328.c
Original file line number Diff line number Diff line change
Expand Up @@ -2599,8 +2599,6 @@ snd_azf3328_create(struct snd_card *card,
spin_unlock_irq(codec->lock);
}

snd_card_set_dev(card, &pci->dev);

*rchip = chip;

err = 0;
Expand Down Expand Up @@ -2635,7 +2633,8 @@ snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
goto out;
}

err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
0, &card);
if (err < 0)
goto out;

Expand Down
4 changes: 2 additions & 2 deletions sound/pci/bt87x.c
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,6 @@ static int snd_bt87x_create(struct snd_card *card,
if (err < 0)
goto fail;

snd_card_set_dev(card, &pci->dev);
*rchip = chip;
return 0;

Expand Down Expand Up @@ -888,7 +887,8 @@ static int snd_bt87x_probe(struct pci_dev *pci,
return -ENOENT;
}

err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
0, &card);
if (err < 0)
return err;

Expand Down
5 changes: 2 additions & 3 deletions sound/pci/ca0106/ca0106_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1843,7 +1843,8 @@ static int snd_ca0106_probe(struct pci_dev *pci,
return -ENOENT;
}

err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
0, &card);
if (err < 0)
return err;

Expand Down Expand Up @@ -1878,8 +1879,6 @@ static int snd_ca0106_probe(struct pci_dev *pci,
snd_ca0106_proc_init(chip);
#endif

snd_card_set_dev(card, &pci->dev);

err = snd_card_register(card);
if (err < 0)
goto error;
Expand Down
5 changes: 2 additions & 3 deletions sound/pci/cmipci.c
Original file line number Diff line number Diff line change
Expand Up @@ -3254,8 +3254,6 @@ static int snd_cmipci_create(struct snd_card *card, struct pci_dev *pci,
if (snd_cmipci_create_gameport(cm, dev) < 0)
snd_cmipci_clear_bit(cm, CM_REG_FUNCTRL1, CM_JYSTK_EN);

snd_card_set_dev(card, &pci->dev);

*rcmipci = cm;
return 0;
}
Expand All @@ -3280,7 +3278,8 @@ static int snd_cmipci_probe(struct pci_dev *pci,
return -ENOENT;
}

err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
0, &card);
if (err < 0)
return err;

Expand Down
5 changes: 2 additions & 3 deletions sound/pci/cs4281.c
Original file line number Diff line number Diff line change
Expand Up @@ -1402,8 +1402,6 @@ static int snd_cs4281_create(struct snd_card *card,

snd_cs4281_proc_init(chip);

snd_card_set_dev(card, &pci->dev);

*rchip = chip;
return 0;
}
Expand Down Expand Up @@ -1917,7 +1915,8 @@ static int snd_cs4281_probe(struct pci_dev *pci,
return -ENOENT;
}

err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
0, &card);
if (err < 0)
return err;

Expand Down
3 changes: 2 additions & 1 deletion sound/pci/cs46xx/cs46xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ static int snd_card_cs46xx_probe(struct pci_dev *pci,
return -ENOENT;
}

err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
0, &card);
if (err < 0)
return err;
if ((err = snd_cs46xx_create(card, pci,
Expand Down
2 changes: 0 additions & 2 deletions sound/pci/cs46xx/cs46xx_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -4058,8 +4058,6 @@ int snd_cs46xx_create(struct snd_card *card,

chip->active_ctrl(chip, -1); /* disable CLKRUN */

snd_card_set_dev(card, &pci->dev);

*rchip = chip;
return 0;
}
4 changes: 2 additions & 2 deletions sound/pci/cs5530.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ static int snd_cs5530_create(struct snd_card *card,
return err;
}

snd_card_set_dev(card, &pci->dev);
*rchip = chip;
return 0;
}
Expand All @@ -264,7 +263,8 @@ static int snd_cs5530_probe(struct pci_dev *pci,
return -ENOENT;
}

err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
0, &card);

if (err < 0)
return err;
Expand Down
5 changes: 2 additions & 3 deletions sound/pci/cs5535audio/cs5535audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,6 @@ static int snd_cs5535audio_create(struct snd_card *card,
cs5535au, &ops)) < 0)
goto sndfail;

snd_card_set_dev(card, &pci->dev);

*rcs5535au = cs5535au;
return 0;

Expand Down Expand Up @@ -353,7 +351,8 @@ static int snd_cs5535audio_probe(struct pci_dev *pci,
return -ENOENT;
}

err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
0, &card);
if (err < 0)
return err;

Expand Down
2 changes: 0 additions & 2 deletions sound/pci/ctxfi/ctatc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1739,8 +1739,6 @@ int ct_atc_create(struct snd_card *card, struct pci_dev *pci,
if (err < 0)
goto error1;

snd_card_set_dev(card, &pci->dev);

*ratc = atc;
return 0;

Expand Down
3 changes: 2 additions & 1 deletion sound/pci/ctxfi/xfi.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ ct_card_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
dev++;
return -ENOENT;
}
err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
0, &card);
if (err)
return err;
if ((reference_rate != 48000) && (reference_rate != 44100)) {
Expand Down
5 changes: 2 additions & 3 deletions sound/pci/echoaudio/echoaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -2058,12 +2058,11 @@ static int snd_echo_probe(struct pci_dev *pci,

DE_INIT(("Echoaudio driver starting...\n"));
i = 0;
err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
0, &card);
if (err < 0)
return err;

snd_card_set_dev(card, &pci->dev);

chip = NULL; /* Tells snd_echo_create to allocate chip */
if ((err = snd_echo_create(card, pci, &chip)) < 0) {
snd_card_free(card);
Expand Down
3 changes: 2 additions & 1 deletion sound/pci/emu10k1/emu10k1.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ static int snd_card_emu10k1_probe(struct pci_dev *pci,
return -ENOENT;
}

err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
0, &card);
if (err < 0)
return err;
if (max_buffer_size[dev] < 32)
Expand Down
1 change: 0 additions & 1 deletion sound/pci/emu10k1/emu10k1_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2021,7 +2021,6 @@ int snd_emu10k1_create(struct snd_card *card,
snd_emu10k1_proc_init(emu);
#endif

snd_card_set_dev(card, &pci->dev);
*remu = emu;
return 0;

Expand Down
Loading

0 comments on commit 60c5772

Please sign in to comment.