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/virmidi.c

    r598 r679  
     1// SPDX-License-Identifier: GPL-2.0-or-later
    12/*
    23 *  Dummy soundcard for virtual rawmidi devices
    34 *
    45 *  Copyright (c) 2000 by Takashi Iwai <tiwai@suse.de>
    5  *
    6  *   This program is free software; you can redistribute it and/or modify
    7  *   it under the terms of the GNU General Public License as published by
    8  *   the Free Software Foundation; either version 2 of the License, or
    9  *   (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 of
    13  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14  *   GNU General Public License for more details.
    15  *
    16  *   You should have received a copy of the GNU General Public License
    17  *   along with this program; if not, write to the Free Software
    18  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    19  *
    206 */
    217
     
    4632#include <linux/err.h>
    4733#include <linux/platform_device.h>
    48 #include <linux/moduleparam.h>
     34#include <linux/module.h>
    4935#include <sound/core.h>
    5036#include <sound/seq_kernel.h>
     
    6450static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;      /* Index 0-MAX */
    6551static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;       /* ID for this card */
    66 static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0};
     52static bool enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0};
    6753static int midi_devs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 4};
    6854
     
    8470
    8571
    86 static int __devinit snd_virmidi_probe(struct platform_device *devptr)
     72static int snd_virmidi_probe(struct platform_device *devptr)
    8773{
    8874        struct snd_card *card;
     
    9177        int dev = devptr->id;
    9278
    93         err = snd_card_create(index[dev], id[dev], THIS_MODULE,
    94                               sizeof(struct snd_card_virmidi), &card);
     79        err = snd_card_new(&devptr->dev, index[dev], id[dev], THIS_MODULE,
     80                           sizeof(struct snd_card_virmidi), &card);
    9581        if (err < 0)
    9682                return err;
     
    10086        if (midi_devs[dev] > MAX_MIDI_DEVICES) {
    10187                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);
    10490                midi_devs[dev] = MAX_MIDI_DEVICES;
    10591        }
     
    10793                struct snd_rawmidi *rmidi;
    10894                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)
    11098                        goto __nodev;
    11199                rdev = rmidi->private_data;
     
    114102                rdev->seq_mode = SNDRV_VIRMIDI_SEQ_DISPATCH;
    115103        }
    116        
     104
    117105        strcpy(card->driver, "VirMIDI");
    118106        strcpy(card->shortname, "VirMIDI");
    119107        sprintf(card->longname, "Virtual MIDI Card %i", dev + 1);
    120108
    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) {
    124111                platform_set_drvdata(devptr, card);
    125112                return 0;
    126113        }
    127       __nodev:
     114__nodev:
    128115        snd_card_free(card);
    129116        return err;
    130117}
    131118
    132 static int __devexit snd_virmidi_remove(struct platform_device *devptr)
     119static int snd_virmidi_remove(struct platform_device *devptr)
    133120{
    134121        snd_card_free(platform_get_drvdata(devptr));
    135         platform_set_drvdata(devptr, NULL);
    136122        return 0;
    137123}
     
    141127static struct platform_driver snd_virmidi_driver = {
    142128        .probe          = snd_virmidi_probe,
    143         .remove         = __devexit_p(snd_virmidi_remove),
     129        .remove         = snd_virmidi_remove,
    144130        .driver         = {
    145                 .name   = SND_VIRMIDI_DRIVER
     131                .name   = SND_VIRMIDI_DRIVER,
    146132        },
    147133};
     
    160146        int i, cards, err;
    161147
    162         if ((err = platform_driver_register(&snd_virmidi_driver)) < 0)
     148        err = platform_driver_register(&snd_virmidi_driver);
     149        if (err < 0)
    163150                return err;
    164151
     
    166153        for (i = 0; i < SNDRV_CARDS; i++) {
    167154                struct platform_device *device;
    168                 if (! enable[i])
     155
     156                if (!enable[i])
    169157                        continue;
    170158                device = platform_device_register_simple(SND_VIRMIDI_DRIVER,
Note: See TracChangeset for help on using the changeset viewer.