static int __devinit snd_card_pcsp_probe(int devnum, struct device *dev) { struct snd_card *card; int err; if (devnum != 0) return -EINVAL; hrtimer_init(&pcsp_chip.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); pcsp_chip.timer.function = pcsp_do_timer; err = snd_card_create(index, id, THIS_MODULE, 0, &card); if (err < 0) return err; err = snd_pcsp_create(card); if (err < 0) { snd_card_free(card); return err; } if (!nopcm) { err = snd_pcsp_new_pcm(&pcsp_chip); if (err < 0) { snd_card_free(card); return err; } } err = snd_pcsp_new_mixer(&pcsp_chip, nopcm); if (err < 0) { snd_card_free(card); return err; } snd_card_set_dev(pcsp_chip.card, dev); strcpy(card->driver, "PC-Speaker"); strcpy(card->shortname, "pcsp"); sprintf(card->longname, "Internal PC-Speaker at port 0x%x", pcsp_chip.port); err = snd_card_register(card); if (err < 0) { snd_card_free(card); return err; } return 0; }
static int __init snd_card_pcsp_probe(int dev) { struct snd_card *card; int err; if (dev != 0) return -EINVAL; hrtimer_init(&pcsp_chip.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); pcsp_chip.timer.cb_mode = HRTIMER_CB_IRQSAFE; pcsp_chip.timer.function = pcsp_do_timer; card = snd_card_new(index, id, THIS_MODULE, 0); if (!card) return -ENOMEM; err = snd_pcsp_create(card); if (err < 0) { snd_card_free(card); return err; } err = snd_pcsp_new_pcm(&pcsp_chip); if (err < 0) { snd_card_free(card); return err; } err = snd_pcsp_new_mixer(&pcsp_chip); if (err < 0) { snd_card_free(card); return err; } strcpy(card->driver, "PC-Speaker"); strcpy(card->shortname, "pcsp"); sprintf(card->longname, "Internal PC-Speaker at port 0x%x", pcsp_chip.port); err = snd_card_register(card); if (err < 0) { snd_card_free(card); return err; } pcspkr_input_init(&pcsp_chip.input_dev); return 0; }