Ignore:
Timestamp:
Mar 18, 2021, 8:57:36 PM (4 years ago)
Author:
David Azarewicz
Message:

Merge changes from Paul's uniaud32next branch.

Location:
GPL/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • GPL/trunk

  • GPL/trunk/alsa-kernel/drivers/mpu401/mpu401.c

    r598 r679  
     1// SPDX-License-Identifier: GPL-2.0-or-later
    12/*
    23 *  Driver for generic MPU-401 boards (UART mode only)
    34 *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
    45 *  Copyright (c) 2004 by Castet Matthieu <castet.matthieu@free.fr>
    5  *
    6  *
    7  *   This program is free software; you can redistribute it and/or modify
    8  *   it under the terms of the GNU General Public License as published by
    9  *   the Free Software Foundation; either version 2 of the License, or
    10  *   (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 of
    14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    15  *   GNU General Public License for more details.
    16  *
    17  *   You should have received a copy of the GNU General Public License
    18  *   along with this program; if not, write to the Free Software
    19  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    20  *
    216 */
    227
    23 #ifdef TARGET_OS2
    24 #include <sound/config.h>
    25 #endif
    268#include <linux/init.h>
    279#include <linux/pnp.h>
    2810#include <linux/err.h>
    2911#include <linux/platform_device.h>
    30 #include <linux/moduleparam.h>
     12#include <linux/module.h>
    3113#include <sound/core.h>
    3214#include <sound/mpu401.h>
     
    4325#endif
    4426static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;       /* ID for this card */
    45 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE;  /* Enable this card */
     27static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */
    4628#ifdef CONFIG_PNP
    4729#ifndef TARGET_OS2
    48 static int pnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
     30static bool pnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
    4931#else
    5032static int pnp[SNDRV_CARDS] = {1,1,1,1,1,1,1,1};
     
    5436static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;        /* MPU-401 IRQ */
    5537#ifndef TARGET_OS2
    56 static int uart_enter[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
     38static bool uart_enter[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
    5739#else
    5840static int uart_enter[SNDRV_CARDS] = {1,1,1,1,1,1,1,1};
     
    6951MODULE_PARM_DESC(pnp, "PnP detection for MPU-401 device.");
    7052#endif
    71 module_param_array(port, long, NULL, 0444);
     53module_param_hw_array(port, long, ioport, NULL, 0444);
    7254MODULE_PARM_DESC(port, "Port # for MPU-401 device.");
    73 module_param_array(irq, int, NULL, 0444);
     55module_param_hw_array(irq, int, irq, NULL, 0444);
    7456MODULE_PARM_DESC(irq, "IRQ # for MPU-401 device.");
    7557module_param_array(uart_enter, bool, NULL, 0444);
     
    8062static unsigned int snd_mpu401_devices;
    8163
    82 static int snd_mpu401_create(int dev, struct snd_card **rcard)
     64static int snd_mpu401_create(struct device *devptr, int dev,
     65                             struct snd_card **rcard)
    8366{
    8467        struct snd_card *card;
     
    8972
    9073        *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);
    9276        if (err < 0)
    9377                return err;
     
    10286
    10387        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);
    10689        if (err < 0) {
    10790                printk(KERN_ERR "MPU401 not detected at 0x%lx\n", port[dev]);
     
    117100}
    118101
    119 static int __devinit snd_mpu401_probe(struct platform_device *devptr)
     102static int snd_mpu401_probe(struct platform_device *devptr)
    120103{
    121104        int dev = devptr->id;
     
    131114                return -EINVAL;
    132115        }
    133         err = snd_mpu401_create(dev, &card);
     116        err = snd_mpu401_create(&devptr->dev, dev, &card);
    134117        if (err < 0)
    135118                return err;
    136         snd_card_set_dev(card, &devptr->dev);
    137119        if ((err = snd_card_register(card)) < 0) {
    138120                snd_card_free(card);
     
    143125}
    144126
    145 static int __devexit snd_mpu401_remove(struct platform_device *devptr)
     127static int snd_mpu401_remove(struct platform_device *devptr)
    146128{
    147129        snd_card_free(platform_get_drvdata(devptr));
    148         platform_set_drvdata(devptr, NULL);
    149130        return 0;
    150131}
     
    154135static struct platform_driver snd_mpu401_driver = {
    155136        .probe          = snd_mpu401_probe,
    156         .remove         = __devexit_p(snd_mpu401_remove),
     137        .remove         = snd_mpu401_remove,
    157138        .driver         = {
    158                 .name   = SND_MPU401_DRIVER
     139                .name   = SND_MPU401_DRIVER,
    159140        },
    160141};
     
    165146#define IO_EXTENT 2
    166147
    167 static struct pnp_device_id snd_mpu401_pnpids[] = {
     148static const struct pnp_device_id snd_mpu401_pnpids[] = {
    168149        { .id = "PNPb006" },
    169150        { .id = "" }
     
    172153MODULE_DEVICE_TABLE(pnp, snd_mpu401_pnpids);
    173154
    174 static int __devinit snd_mpu401_pnp(int dev, struct pnp_dev *device,
    175                                 const struct pnp_device_id *id)
     155static int snd_mpu401_pnp(int dev, struct pnp_dev *device,
     156                          const struct pnp_device_id *id)
    176157{
    177158        if (!pnp_port_valid(device, 0) ||
     
    198179}
    199180
    200 static int __devinit snd_mpu401_pnp_probe(struct pnp_dev *pnp_dev,
    201                                           const struct pnp_device_id *id)
     181static int snd_mpu401_pnp_probe(struct pnp_dev *pnp_dev,
     182                                const struct pnp_device_id *id)
    202183{
    203184        static int dev;
     
    211192                if (err < 0)
    212193                        return err;
    213                 err = snd_mpu401_create(dev, &card);
     194                err = snd_mpu401_create(&pnp_dev->dev, dev, &card);
    214195                if (err < 0)
    215196                        return err;
     
    218199                        return err;
    219200                }
    220                 snd_card_set_dev(card, &pnp_dev->dev);
    221201                pnp_set_drvdata(pnp_dev, card);
    222202                snd_mpu401_devices++;
     
    227207}
    228208
    229 static void __devexit snd_mpu401_pnp_remove(struct pnp_dev *dev)
     209static void snd_mpu401_pnp_remove(struct pnp_dev *dev)
    230210{
    231211        struct snd_card *card = (struct snd_card *) pnp_get_drvdata(dev);
     
    239219        .id_table = snd_mpu401_pnpids,
    240220        .probe = snd_mpu401_pnp_probe,
    241         .remove = __devexit_p(snd_mpu401_pnp_remove),
     221        .remove = snd_mpu401_pnp_remove,
    242222};
    243223#else
Note: See TracChangeset for help on using the changeset viewer.