Changeset 679 for GPL/trunk/alsa-kernel/drivers/virmidi.c
- Timestamp:
- Mar 18, 2021, 8:57:36 PM (4 years ago)
- Location:
- GPL/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk
- Property svn:mergeinfo changed
/GPL/branches/uniaud32-linux-3.2.102 (added) merged: 611-614 /GPL/branches/uniaud32-next (added) merged: 615-678
- Property svn:mergeinfo changed
-
GPL/trunk/alsa-kernel/drivers/virmidi.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Dummy soundcard for virtual rawmidi devices 3 4 * 4 5 * Copyright (c) 2000 by Takashi Iwai <tiwai@suse.de> 5 *6 * This program is free software; you can redistribute it and/or modify7 * it under the terms of the GNU General Public License as published by8 * the Free Software Foundation; either version 2 of the License, or9 * (at your option) any later version.10 *11 * This program is distributed in the hope that it will be useful,12 * but WITHOUT ANY WARRANTY; without even the implied warranty of13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14 * GNU General Public License for more details.15 *16 * You should have received a copy of the GNU General Public License17 * along with this program; if not, write to the Free Software18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA19 *20 6 */ 21 7 … … 46 32 #include <linux/err.h> 47 33 #include <linux/platform_device.h> 48 #include <linux/module param.h>34 #include <linux/module.h> 49 35 #include <sound/core.h> 50 36 #include <sound/seq_kernel.h> … … 64 50 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 65 51 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 66 static intenable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0};52 static bool enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0}; 67 53 static int midi_devs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 4}; 68 54 … … 84 70 85 71 86 static int __devinitsnd_virmidi_probe(struct platform_device *devptr)72 static int snd_virmidi_probe(struct platform_device *devptr) 87 73 { 88 74 struct snd_card *card; … … 91 77 int dev = devptr->id; 92 78 93 err = snd_card_ create(index[dev], id[dev], THIS_MODULE,94 79 err = snd_card_new(&devptr->dev, index[dev], id[dev], THIS_MODULE, 80 sizeof(struct snd_card_virmidi), &card); 95 81 if (err < 0) 96 82 return err; … … 100 86 if (midi_devs[dev] > MAX_MIDI_DEVICES) { 101 87 snd_printk(KERN_WARNING 102 "too much midi devices for virmidi %d: "103 "force to use %d\n",dev, MAX_MIDI_DEVICES);88 "too much midi devices for virmidi %d: force to use %d\n", 89 dev, MAX_MIDI_DEVICES); 104 90 midi_devs[dev] = MAX_MIDI_DEVICES; 105 91 } … … 107 93 struct snd_rawmidi *rmidi; 108 94 struct snd_virmidi_dev *rdev; 109 if ((err = snd_virmidi_new(card, idx, &rmidi)) < 0) 95 96 err = snd_virmidi_new(card, idx, &rmidi); 97 if (err < 0) 110 98 goto __nodev; 111 99 rdev = rmidi->private_data; … … 114 102 rdev->seq_mode = SNDRV_VIRMIDI_SEQ_DISPATCH; 115 103 } 116 104 117 105 strcpy(card->driver, "VirMIDI"); 118 106 strcpy(card->shortname, "VirMIDI"); 119 107 sprintf(card->longname, "Virtual MIDI Card %i", dev + 1); 120 108 121 snd_card_set_dev(card, &devptr->dev); 122 123 if ((err = snd_card_register(card)) == 0) { 109 err = snd_card_register(card); 110 if (!err) { 124 111 platform_set_drvdata(devptr, card); 125 112 return 0; 126 113 } 127 114 __nodev: 128 115 snd_card_free(card); 129 116 return err; 130 117 } 131 118 132 static int __devexitsnd_virmidi_remove(struct platform_device *devptr)119 static int snd_virmidi_remove(struct platform_device *devptr) 133 120 { 134 121 snd_card_free(platform_get_drvdata(devptr)); 135 platform_set_drvdata(devptr, NULL);136 122 return 0; 137 123 } … … 141 127 static struct platform_driver snd_virmidi_driver = { 142 128 .probe = snd_virmidi_probe, 143 .remove = __devexit_p(snd_virmidi_remove),129 .remove = snd_virmidi_remove, 144 130 .driver = { 145 .name = SND_VIRMIDI_DRIVER 131 .name = SND_VIRMIDI_DRIVER, 146 132 }, 147 133 }; … … 160 146 int i, cards, err; 161 147 162 if ((err = platform_driver_register(&snd_virmidi_driver)) < 0) 148 err = platform_driver_register(&snd_virmidi_driver); 149 if (err < 0) 163 150 return err; 164 151 … … 166 153 for (i = 0; i < SNDRV_CARDS; i++) { 167 154 struct platform_device *device; 168 if (! enable[i]) 155 156 if (!enable[i]) 169 157 continue; 170 158 device = platform_device_register_simple(SND_VIRMIDI_DRIVER,
Note:
See TracChangeset
for help on using the changeset viewer.