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/sb/sb8.c

    r598 r679  
     1// SPDX-License-Identifier: GPL-2.0-or-later
    12/*
    23 *  Driver for SoundBlaster 1.0/2.0/Pro soundcards and compatible
    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
     
    249#include <linux/isa.h>
    2510#include <linux/ioport.h>
    26 #include <linux/moduleparam.h>
     11#include <linux/module.h>
    2712#include <sound/core.h>
    2813#include <sound/sb.h>
     
    3722static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;      /* Index 0-MAX */
    3823static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;       /* ID for this card */
    39 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE;  /* Enable this card */
     24static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */
    4025static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;     /* 0x220,0x240,0x260 */
    4126static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;        /* 5,7,9,10 */
     
    4833module_param_array(enable, bool, NULL, 0444);
    4934MODULE_PARM_DESC(enable, "Enable Sound Blaster soundcard.");
    50 module_param_array(port, long, NULL, 0444);
     35module_param_hw_array(port, long, ioport, NULL, 0444);
    5136MODULE_PARM_DESC(port, "Port # for SB8 driver.");
    52 module_param_array(irq, int, NULL, 0444);
     37module_param_hw_array(irq, int, irq, NULL, 0444);
    5338MODULE_PARM_DESC(irq, "IRQ # for SB8 driver.");
    54 module_param_array(dma8, int, NULL, 0444);
     39module_param_hw_array(dma8, int, dma, NULL, 0444);
    5540MODULE_PARM_DESC(dma8, "8-bit DMA # for SB8 driver.");
    5641
     
    8065}
    8166
    82 static int __devinit snd_sb8_match(struct device *pdev, unsigned int dev)
     67static int snd_sb8_match(struct device *pdev, unsigned int dev)
    8368{
    8469        if (!enable[dev])
     
    9580}
    9681
    97 static int __devinit snd_sb8_probe(struct device *pdev, unsigned int dev)
     82static int snd_sb8_probe(struct device *pdev, unsigned int dev)
    9883{
    9984        struct snd_sb *chip;
     
    10388        int err;
    10489
    105         err = snd_card_create(index[dev], id[dev], THIS_MODULE,
    106                               sizeof(struct snd_sb8), &card);
     90        err = snd_card_new(pdev, index[dev], id[dev], THIS_MODULE,
     91                           sizeof(struct snd_sb8), &card);
    10792        if (err < 0)
    10893                return err;
     
    11297        /* block the 0x388 port to avoid PnP conflicts */
    11398        acard->fm_res = request_region(0x388, 4, "SoundBlaster FM");
     99        if (!acard->fm_res) {
     100                err = -EBUSY;
     101                goto _err;
     102        }
    114103
    115104        if (port[dev] != SNDRV_AUTO_PORT) {
     
    123112        } else {
    124113                /* auto-probe legacy ports */
    125                 static unsigned long possible_ports[] = {
     114                static const unsigned long possible_ports[] = {
    126115                        0x220, 0x240, 0x260,
    127116                };
     
    158147        }
    159148
    160         if ((err = snd_sb8dsp_pcm(chip, 0, NULL)) < 0)
     149        if ((err = snd_sb8dsp_pcm(chip, 0)) < 0)
    161150                goto _err;
    162151
     
    183172        }
    184173
    185         if ((err = snd_sb8dsp_midi(chip, 0, NULL)) < 0)
     174        if ((err = snd_sb8dsp_midi(chip, 0)) < 0)
    186175                goto _err;
    187176
     
    193182                irq[dev], dma8[dev]);
    194183
    195         snd_card_set_dev(card, pdev);
    196 
    197184        if ((err = snd_card_register(card)) < 0)
    198185                goto _err;
     
    206193}
    207194
    208 static int __devexit snd_sb8_remove(struct device *pdev, unsigned int dev)
     195static int snd_sb8_remove(struct device *pdev, unsigned int dev)
    209196{
    210197        snd_card_free(dev_get_drvdata(pdev));
    211         dev_set_drvdata(pdev, NULL);
    212198        return 0;
    213199}
     
    222208
    223209        snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
    224         snd_pcm_suspend_all(chip->pcm);
    225210        snd_sbmixer_suspend(chip);
    226211        return 0;
     
    245230        .match          = snd_sb8_match,
    246231        .probe          = snd_sb8_probe,
    247         .remove         = __devexit_p(snd_sb8_remove),
     232        .remove         = snd_sb8_remove,
    248233#ifdef CONFIG_PM
    249234        .suspend        = snd_sb8_suspend,
     
    255240};
    256241
    257 static int __init alsa_card_sb8_init(void)
    258 {
    259         return isa_register_driver(&snd_sb8_driver, SNDRV_CARDS);
    260 }
    261 
    262 static void __exit alsa_card_sb8_exit(void)
    263 {
    264         isa_unregister_driver(&snd_sb8_driver);
    265 }
    266 
    267 module_init(alsa_card_sb8_init)
    268 module_exit(alsa_card_sb8_exit)
     242module_isa_driver(snd_sb8_driver, SNDRV_CARDS);
Note: See TracChangeset for help on using the changeset viewer.