xfs: pass state not whichfork to trace_xfs_extlist
[linux/fpc-iii.git] / sound / isa / adlib.c
blob8d3060fd7ad7e3319553c4cf604d29dc7d73bd45
1 /*
2 * AdLib FM card driver.
3 */
5 #include <linux/kernel.h>
6 #include <linux/module.h>
7 #include <linux/isa.h>
8 #include <sound/core.h>
9 #include <sound/initval.h>
10 #include <sound/opl3.h>
12 #define CRD_NAME "AdLib FM"
13 #define DEV_NAME "adlib"
15 MODULE_DESCRIPTION(CRD_NAME);
16 MODULE_AUTHOR("Rene Herman");
17 MODULE_LICENSE("GPL");
19 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
20 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
21 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE;
22 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;
24 module_param_array(index, int, NULL, 0444);
25 MODULE_PARM_DESC(index, "Index value for " CRD_NAME " soundcard.");
26 module_param_array(id, charp, NULL, 0444);
27 MODULE_PARM_DESC(id, "ID string for " CRD_NAME " soundcard.");
28 module_param_array(enable, bool, NULL, 0444);
29 MODULE_PARM_DESC(enable, "Enable " CRD_NAME " soundcard.");
30 module_param_array(port, long, NULL, 0444);
31 MODULE_PARM_DESC(port, "Port # for " CRD_NAME " driver.");
33 static int snd_adlib_match(struct device *dev, unsigned int n)
35 if (!enable[n])
36 return 0;
38 if (port[n] == SNDRV_AUTO_PORT) {
39 dev_err(dev, "please specify port\n");
40 return 0;
42 return 1;
45 static void snd_adlib_free(struct snd_card *card)
47 release_and_free_resource(card->private_data);
50 static int snd_adlib_probe(struct device *dev, unsigned int n)
52 struct snd_card *card;
53 struct snd_opl3 *opl3;
54 int error;
56 error = snd_card_new(dev, index[n], id[n], THIS_MODULE, 0, &card);
57 if (error < 0) {
58 dev_err(dev, "could not create card\n");
59 return error;
62 card->private_data = request_region(port[n], 4, CRD_NAME);
63 if (!card->private_data) {
64 dev_err(dev, "could not grab ports\n");
65 error = -EBUSY;
66 goto out;
68 card->private_free = snd_adlib_free;
70 strcpy(card->driver, DEV_NAME);
71 strcpy(card->shortname, CRD_NAME);
72 sprintf(card->longname, CRD_NAME " at %#lx", port[n]);
74 error = snd_opl3_create(card, port[n], port[n] + 2, OPL3_HW_AUTO, 1, &opl3);
75 if (error < 0) {
76 dev_err(dev, "could not create OPL\n");
77 goto out;
80 error = snd_opl3_hwdep_new(opl3, 0, 0, NULL);
81 if (error < 0) {
82 dev_err(dev, "could not create FM\n");
83 goto out;
86 error = snd_card_register(card);
87 if (error < 0) {
88 dev_err(dev, "could not register card\n");
89 goto out;
92 dev_set_drvdata(dev, card);
93 return 0;
95 out: snd_card_free(card);
96 return error;
99 static int snd_adlib_remove(struct device *dev, unsigned int n)
101 snd_card_free(dev_get_drvdata(dev));
102 return 0;
105 static struct isa_driver snd_adlib_driver = {
106 .match = snd_adlib_match,
107 .probe = snd_adlib_probe,
108 .remove = snd_adlib_remove,
110 .driver = {
111 .name = DEV_NAME
115 module_isa_driver(snd_adlib_driver, SNDRV_CARDS);