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/isa/gus/gusmax.c

    r598 r679  
     1// SPDX-License-Identifier: GPL-2.0-or-later
    12/*
    23 *  Driver for Gravis UltraSound MAX soundcard
    34 *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
    4  *
    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  *
    205 */
    216
     
    2510#include <linux/delay.h>
    2611#include <linux/time.h>
    27 #include <linux/moduleparam.h>
     12#include <linux/module.h>
    2813#include <asm/dma.h>
    2914#include <sound/core.h>
     
    4126static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;      /* Index 0-MAX */
    4227static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;       /* ID for this card */
    43 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE;  /* Enable this card */
     28static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */
    4429static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;     /* 0x220,0x230,0x240,0x250,0x260 */
    4530static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;        /* 2,3,5,9,11,12,15 */
     
    5742module_param_array(enable, bool, NULL, 0444);
    5843MODULE_PARM_DESC(enable, "Enable GUS MAX soundcard.");
    59 module_param_array(port, long, NULL, 0444);
     44module_param_hw_array(port, long, ioport, NULL, 0444);
    6045MODULE_PARM_DESC(port, "Port # for GUS MAX driver.");
    61 module_param_array(irq, int, NULL, 0444);
     46module_param_hw_array(irq, int, irq, NULL, 0444);
    6247MODULE_PARM_DESC(irq, "IRQ # for GUS MAX driver.");
    63 module_param_array(dma1, int, NULL, 0444);
     48module_param_hw_array(dma1, int, dma, NULL, 0444);
    6449MODULE_PARM_DESC(dma1, "DMA1 # for GUS MAX driver.");
    65 module_param_array(dma2, int, NULL, 0444);
     50module_param_hw_array(dma2, int, dma, NULL, 0444);
    6651MODULE_PARM_DESC(dma2, "DMA2 # for GUS MAX driver.");
    6752module_param_array(joystick_dac, int, NULL, 0444);
     
    8368#define PFX     "gusmax: "
    8469
    85 static int __devinit snd_gusmax_detect(struct snd_gus_card * gus)
     70static int snd_gusmax_detect(struct snd_gus_card *gus)
    8671{
    8772        unsigned char d;
     
    125110}
    126111
    127 static void __devinit snd_gusmax_init(int dev, struct snd_card *card,
    128                                       struct snd_gus_card * gus)
     112static void snd_gusmax_init(int dev, struct snd_card *card,
     113                            struct snd_gus_card *gus)
    129114{
    130115        gus->equal_irq = 1;
     
    141126}
    142127
    143 static int __devinit snd_gusmax_mixer(struct snd_wss *chip)
     128static int snd_gusmax_mixer(struct snd_wss *chip)
    144129{
    145130        struct snd_card *card = chip->card;
     
    200185}
    201186
    202 static int __devinit snd_gusmax_match(struct device *pdev, unsigned int dev)
     187static int snd_gusmax_match(struct device *pdev, unsigned int dev)
    203188{
    204189        return enable[dev];
    205190}
    206191
    207 static int __devinit snd_gusmax_probe(struct device *pdev, unsigned int dev)
    208 {
    209         static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1};
    210         static int possible_dmas[] = {5, 6, 7, 1, 3, -1};
     192static int snd_gusmax_probe(struct device *pdev, unsigned int dev)
     193{
     194        static const int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1};
     195        static const int possible_dmas[] = {5, 6, 7, 1, 3, -1};
    211196        int xirq, xdma1, xdma2, err;
    212197        struct snd_card *card;
     
    215200        struct snd_gusmax *maxcard;
    216201
    217         err = snd_card_create(index[dev], id[dev], THIS_MODULE,
    218                               sizeof(struct snd_gusmax), &card);
     202        err = snd_card_new(pdev, index[dev], id[dev], THIS_MODULE,
     203                           sizeof(struct snd_gusmax), &card);
    219204        if (err < 0)
    220205                return err;
     
    257242                                     0, &gus);
    258243        } else {
    259                 static unsigned long possible_ports[] = {
     244                static const unsigned long possible_ports[] = {
    260245                        0x220, 0x230, 0x240, 0x250, 0x260
    261246                };
     
    292277        }
    293278
    294         if (request_irq(xirq, snd_gusmax_interrupt, IRQF_DISABLED, "GUS MAX", (void *)maxcard)) {
     279        if (request_irq(xirq, snd_gusmax_interrupt, 0, "GUS MAX", (void *)maxcard)) {
    295280                snd_printk(KERN_ERR PFX "unable to grab IRQ %d\n", xirq);
    296281                err = -EBUSY;
     
    298283        }
    299284        maxcard->irq = xirq;
    300        
     285        card->sync_irq = maxcard->irq;
     286
    301287        err = snd_wss_create(card,
    302288                             gus->gf1.port + 0x10c, -1, xirq,
     
    310296                goto _err;
    311297
    312         err = snd_wss_pcm(wss, 0, NULL);
     298        err = snd_wss_pcm(wss, 0);
    313299        if (err < 0)
    314300                goto _err;
     
    318304                goto _err;
    319305
    320         err = snd_wss_timer(wss, 2, NULL);
     306        err = snd_wss_timer(wss, 2);
    321307        if (err < 0)
    322308                goto _err;
    323309
    324310        if (pcm_channels[dev] > 0) {
    325                 if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0)
     311                if ((err = snd_gf1_pcm_new(gus, 1, 1)) < 0)
    326312                        goto _err;
    327313        }
     
    330316                goto _err;
    331317
    332         err = snd_gf1_rawmidi_new(gus, 0, NULL);
     318        err = snd_gf1_rawmidi_new(gus, 0);
    333319        if (err < 0)
    334320                goto _err;
     
    338324                sprintf(card->longname + strlen(card->longname), "&%i", xdma2);
    339325
    340         snd_card_set_dev(card, pdev);
    341 
    342326        err = snd_card_register(card);
    343327        if (err < 0)
     
    355339}
    356340
    357 static int __devexit snd_gusmax_remove(struct device *devptr, unsigned int dev)
     341static int snd_gusmax_remove(struct device *devptr, unsigned int dev)
    358342{
    359343        snd_card_free(dev_get_drvdata(devptr));
    360         dev_set_drvdata(devptr, NULL);
    361344        return 0;
    362345}
     
    367350        .match          = snd_gusmax_match,
    368351        .probe          = snd_gusmax_probe,
    369         .remove         = __devexit_p(snd_gusmax_remove),
     352        .remove         = snd_gusmax_remove,
    370353        /* FIXME: suspend/resume */
    371354        .driver         = {
     
    374357};
    375358
    376 static int __init alsa_card_gusmax_init(void)
    377 {
    378         return isa_register_driver(&snd_gusmax_driver, SNDRV_CARDS);
    379 }
    380 
    381 static void __exit alsa_card_gusmax_exit(void)
    382 {
    383         isa_unregister_driver(&snd_gusmax_driver);
    384 }
    385 
    386 module_init(alsa_card_gusmax_init)
    387 module_exit(alsa_card_gusmax_exit)
     359module_isa_driver(snd_gusmax_driver, SNDRV_CARDS);
Note: See TracChangeset for help on using the changeset viewer.