Changeset 679 for GPL/trunk/alsa-kernel/drivers/mpu401/mpu401.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/mpu401/mpu401.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Driver for generic MPU-401 boards (UART mode only) 3 4 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 4 5 * Copyright (c) 2004 by Castet Matthieu <castet.matthieu@free.fr> 5 *6 *7 * This program is free software; you can redistribute it and/or modify8 * it under the terms of the GNU General Public License as published by9 * the Free Software Foundation; either version 2 of the License, or10 * (at your option) any later version.11 *12 * This program is distributed in the hope that it will be useful,13 * but WITHOUT ANY WARRANTY; without even the implied warranty of14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15 * GNU General Public License for more details.16 *17 * You should have received a copy of the GNU General Public License18 * along with this program; if not, write to the Free Software19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA20 *21 6 */ 22 7 23 #ifdef TARGET_OS224 #include <sound/config.h>25 #endif26 8 #include <linux/init.h> 27 9 #include <linux/pnp.h> 28 10 #include <linux/err.h> 29 11 #include <linux/platform_device.h> 30 #include <linux/module param.h>12 #include <linux/module.h> 31 13 #include <sound/core.h> 32 14 #include <sound/mpu401.h> … … 43 25 #endif 44 26 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 45 static intenable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */27 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 46 28 #ifdef CONFIG_PNP 47 29 #ifndef TARGET_OS2 48 static intpnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};30 static bool pnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 49 31 #else 50 32 static int pnp[SNDRV_CARDS] = {1,1,1,1,1,1,1,1}; … … 54 36 static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* MPU-401 IRQ */ 55 37 #ifndef TARGET_OS2 56 static intuart_enter[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};38 static bool uart_enter[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 57 39 #else 58 40 static int uart_enter[SNDRV_CARDS] = {1,1,1,1,1,1,1,1}; … … 69 51 MODULE_PARM_DESC(pnp, "PnP detection for MPU-401 device."); 70 52 #endif 71 module_param_ array(port, long, NULL, 0444);53 module_param_hw_array(port, long, ioport, NULL, 0444); 72 54 MODULE_PARM_DESC(port, "Port # for MPU-401 device."); 73 module_param_ array(irq, int, NULL, 0444);55 module_param_hw_array(irq, int, irq, NULL, 0444); 74 56 MODULE_PARM_DESC(irq, "IRQ # for MPU-401 device."); 75 57 module_param_array(uart_enter, bool, NULL, 0444); … … 80 62 static unsigned int snd_mpu401_devices; 81 63 82 static int snd_mpu401_create(int dev, struct snd_card **rcard) 64 static int snd_mpu401_create(struct device *devptr, int dev, 65 struct snd_card **rcard) 83 66 { 84 67 struct snd_card *card; … … 89 72 90 73 *rcard = NULL; 91 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); 74 err = snd_card_new(devptr, index[dev], id[dev], THIS_MODULE, 75 0, &card); 92 76 if (err < 0) 93 77 return err; … … 102 86 103 87 err = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, port[dev], 0, 104 irq[dev], irq[dev] >= 0 ? IRQF_DISABLED : 0, 105 NULL); 88 irq[dev], NULL); 106 89 if (err < 0) { 107 90 printk(KERN_ERR "MPU401 not detected at 0x%lx\n", port[dev]); … … 117 100 } 118 101 119 static int __devinitsnd_mpu401_probe(struct platform_device *devptr)102 static int snd_mpu401_probe(struct platform_device *devptr) 120 103 { 121 104 int dev = devptr->id; … … 131 114 return -EINVAL; 132 115 } 133 err = snd_mpu401_create( dev, &card);116 err = snd_mpu401_create(&devptr->dev, dev, &card); 134 117 if (err < 0) 135 118 return err; 136 snd_card_set_dev(card, &devptr->dev);137 119 if ((err = snd_card_register(card)) < 0) { 138 120 snd_card_free(card); … … 143 125 } 144 126 145 static int __devexitsnd_mpu401_remove(struct platform_device *devptr)127 static int snd_mpu401_remove(struct platform_device *devptr) 146 128 { 147 129 snd_card_free(platform_get_drvdata(devptr)); 148 platform_set_drvdata(devptr, NULL);149 130 return 0; 150 131 } … … 154 135 static struct platform_driver snd_mpu401_driver = { 155 136 .probe = snd_mpu401_probe, 156 .remove = __devexit_p(snd_mpu401_remove),137 .remove = snd_mpu401_remove, 157 138 .driver = { 158 .name = SND_MPU401_DRIVER 139 .name = SND_MPU401_DRIVER, 159 140 }, 160 141 }; … … 165 146 #define IO_EXTENT 2 166 147 167 static struct pnp_device_id snd_mpu401_pnpids[] = {148 static const struct pnp_device_id snd_mpu401_pnpids[] = { 168 149 { .id = "PNPb006" }, 169 150 { .id = "" } … … 172 153 MODULE_DEVICE_TABLE(pnp, snd_mpu401_pnpids); 173 154 174 static int __devinitsnd_mpu401_pnp(int dev, struct pnp_dev *device,175 155 static int snd_mpu401_pnp(int dev, struct pnp_dev *device, 156 const struct pnp_device_id *id) 176 157 { 177 158 if (!pnp_port_valid(device, 0) || … … 198 179 } 199 180 200 static int __devinitsnd_mpu401_pnp_probe(struct pnp_dev *pnp_dev,201 181 static int snd_mpu401_pnp_probe(struct pnp_dev *pnp_dev, 182 const struct pnp_device_id *id) 202 183 { 203 184 static int dev; … … 211 192 if (err < 0) 212 193 return err; 213 err = snd_mpu401_create( dev, &card);194 err = snd_mpu401_create(&pnp_dev->dev, dev, &card); 214 195 if (err < 0) 215 196 return err; … … 218 199 return err; 219 200 } 220 snd_card_set_dev(card, &pnp_dev->dev);221 201 pnp_set_drvdata(pnp_dev, card); 222 202 snd_mpu401_devices++; … … 227 207 } 228 208 229 static void __devexitsnd_mpu401_pnp_remove(struct pnp_dev *dev)209 static void snd_mpu401_pnp_remove(struct pnp_dev *dev) 230 210 { 231 211 struct snd_card *card = (struct snd_card *) pnp_get_drvdata(dev); … … 239 219 .id_table = snd_mpu401_pnpids, 240 220 .probe = snd_mpu401_pnp_probe, 241 .remove = __devexit_p(snd_mpu401_pnp_remove),221 .remove = snd_mpu401_pnp_remove, 242 222 }; 243 223 #else
Note:
See TracChangeset
for help on using the changeset viewer.