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

Merge changes from Paul's uniaud32next branch.

Location:
GPL/trunk
Files:
3 edited
1 copied

Legend:

Unmodified
Added
Removed
  • GPL/trunk

  • GPL/trunk/alsa-kernel/pci/ymfpci/ymfpci.c

    r598 r679  
     1// SPDX-License-Identifier: GPL-2.0-or-later
    12/*
    23 *  The driver for the Yamaha's DS1/DS1E cards
    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
     
    238#include <linux/pci.h>
    249#include <linux/time.h>
    25 #include <linux/moduleparam.h>
     10#include <linux/module.h>
    2611#include <sound/core.h>
    27 #include <sound/ymfpci.h>
     12#include "ymfpci.h"
    2813#include <sound/mpu401.h>
    2914#include <sound/opl3.h>
    3015#include <sound/initval.h>
     16
     17#ifdef TARGET_OS2
     18#define KBUILD_MODNAME "ymfpci"
     19#endif
    3120
    3221MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
     
    4231static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;      /* Index 0-MAX */
    4332static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;       /* ID for this card */
    44 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;      /* Enable this card */
     33static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;     /* Enable this card */
    4534static long fm_port[SNDRV_CARDS];
    4635static long mpu_port[SNDRV_CARDS];
     
    4837static long joystick_port[SNDRV_CARDS];
    4938#endif
    50 static int rear_switch[SNDRV_CARDS];
     39static bool rear_switch[SNDRV_CARDS];
    5140
    5241module_param_array(index, int, NULL, 0444);
     
    5645module_param_array(enable, bool, NULL, 0444);
    5746MODULE_PARM_DESC(enable, "Enable Yamaha DS-1 soundcard.");
    58 module_param_array(mpu_port, long, NULL, 0444);
     47module_param_hw_array(mpu_port, long, ioport, NULL, 0444);
    5948MODULE_PARM_DESC(mpu_port, "MPU-401 Port.");
    60 module_param_array(fm_port, long, NULL, 0444);
     49module_param_hw_array(fm_port, long, ioport, NULL, 0444);
    6150MODULE_PARM_DESC(fm_port, "FM OPL-3 Port.");
    6251#ifdef SUPPORT_JOYSTICK
    63 module_param_array(joystick_port, long, NULL, 0444);
     52module_param_hw_array(joystick_port, long, ioport, NULL, 0444);
    6453MODULE_PARM_DESC(joystick_port, "Joystick port address");
    6554#endif
     
    6756MODULE_PARM_DESC(rear_switch, "Enable shared rear/line-in switch");
    6857
    69 static DEFINE_PCI_DEVICE_TABLE(snd_ymfpci_ids) = {
     58static const struct pci_device_id snd_ymfpci_ids[] = {
    7059        { PCI_VDEVICE(YAMAHA, 0x0004), 0, },   /* YMF724 */
    7160        { PCI_VDEVICE(YAMAHA, 0x000d), 0, },   /* YMF724F */
     
    8069
    8170#ifdef SUPPORT_JOYSTICK
    82 static int __devinit snd_ymfpci_create_gameport(struct snd_ymfpci *chip, int dev,
    83                                                 int legacy_ctrl, int legacy_ctrl2)
     71static int snd_ymfpci_create_gameport(struct snd_ymfpci *chip, int dev,
     72                                      int legacy_ctrl, int legacy_ctrl2)
    8473{
    8574        struct gameport *gp;
     
    10796                        }
    10897                        if (!r) {
    109                                 printk(KERN_ERR "ymfpci: no gameport ports available\n");
     98                                dev_err(chip->card->dev,
     99                                        "no gameport ports available\n");
    110100                                return -EBUSY;
    111101                        }
     
    117107                case 0x205: legacy_ctrl2 |= 3 << 6; break;
    118108                default:
    119                         printk(KERN_ERR "ymfpci: invalid joystick port %#x", io_port);
     109                        dev_err(chip->card->dev,
     110                                "invalid joystick port %#x", io_port);
    120111                        return -EINVAL;
    121112                }
     
    123114
    124115        if (!r && !(r = request_region(io_port, 1, "YMFPCI gameport"))) {
    125                 printk(KERN_ERR "ymfpci: joystick port %#x is in use.\n", io_port);
     116                dev_err(chip->card->dev,
     117                        "joystick port %#x is in use.\n", io_port);
    126118                return -EBUSY;
    127119        }
     
    129121        chip->gameport = gp = gameport_allocate_port();
    130122        if (!gp) {
    131                 printk(KERN_ERR "ymfpci: cannot allocate memory for gameport\n");
     123                dev_err(chip->card->dev,
     124                        "cannot allocate memory for gameport\n");
    132125                release_and_free_resource(r);
    133126                return -ENOMEM;
     
    168161#endif /* SUPPORT_JOYSTICK */
    169162
    170 static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci,
    171                                           const struct pci_device_id *pci_id)
     163static int snd_card_ymfpci_probe(struct pci_dev *pci,
     164                                const struct pci_device_id *pci_id)
    172165{
    173166        static int dev;
     
    188181        }
    189182
    190         err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
     183        err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
     184                           0, &card);
    191185        if (err < 0)
    192186                return err;
     
    264258                                     old_legacy_ctrl,
    265259                                     &chip)) < 0) {
    266                 snd_card_free(card);
    267260                release_and_free_resource(mpu_res);
    268261                release_and_free_resource(fm_res);
    269                 return err;
     262                goto free_card;
    270263        }
    271264        chip->fm_res = fm_res;
     
    279272                chip->reg_area_phys,
    280273                chip->irq);
    281         if ((err = snd_ymfpci_pcm(chip, 0, NULL)) < 0) {
    282                 snd_card_free(card);
    283                 return err;
    284         }
    285         if ((err = snd_ymfpci_pcm_spdif(chip, 1, NULL)) < 0) {
    286                 snd_card_free(card);
    287                 return err;
    288         }
    289         if ((err = snd_ymfpci_pcm_4ch(chip, 2, NULL)) < 0) {
    290                 snd_card_free(card);
    291                 return err;
    292         }
    293         if ((err = snd_ymfpci_pcm2(chip, 3, NULL)) < 0) {
    294                 snd_card_free(card);
    295                 return err;
    296         }
    297         if ((err = snd_ymfpci_mixer(chip, rear_switch[dev])) < 0) {
    298                 snd_card_free(card);
    299                 return err;
    300         }
    301         if ((err = snd_ymfpci_timer(chip, 0)) < 0) {
    302                 snd_card_free(card);
    303                 return err;
    304         }
     274        err = snd_ymfpci_pcm(chip, 0);
     275        if (err < 0)
     276                goto free_card;
     277
     278        err = snd_ymfpci_pcm_spdif(chip, 1);
     279        if (err < 0)
     280                goto free_card;
     281
     282        err = snd_ymfpci_mixer(chip, rear_switch[dev]);
     283        if (err < 0)
     284                goto free_card;
     285
     286        if (chip->ac97->ext_id & AC97_EI_SDAC) {
     287                err = snd_ymfpci_pcm_4ch(chip, 2);
     288                if (err < 0)
     289                        goto free_card;
     290
     291                err = snd_ymfpci_pcm2(chip, 3);
     292                if (err < 0)
     293                        goto free_card;
     294        }
     295        err = snd_ymfpci_timer(chip, 0);
     296        if (err < 0)
     297                goto free_card;
     298
    305299        if (chip->mpu_res) {
    306300                if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_YMFPCI,
    307301                                               mpu_port[dev],
    308                                                MPU401_INFO_INTEGRATED,
    309                                                pci->irq, 0, &chip->rawmidi)) < 0) {
    310                         printk(KERN_WARNING "ymfpci: cannot initialize MPU401 at 0x%lx, skipping...\n", mpu_port[dev]);
     302                                               MPU401_INFO_INTEGRATED |
     303                                               MPU401_INFO_IRQ_HOOK,
     304                                               -1, &chip->rawmidi)) < 0) {
     305                        dev_warn(card->dev,
     306                                 "cannot initialize MPU401 at 0x%lx, skipping...\n",
     307                                 mpu_port[dev]);
    311308                        legacy_ctrl &= ~YMFPCI_LEGACY_MIEN; /* disable MPU401 irq */
    312309                        pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl);
     
    318315                                           fm_port[dev] + 2,
    319316                                           OPL3_HW_OPL3, 1, &opl3)) < 0) {
    320                         printk(KERN_WARNING "ymfpci: cannot initialize FM OPL3 at 0x%lx, skipping...\n", fm_port[dev]);
     317                        dev_warn(card->dev,
     318                                 "cannot initialize FM OPL3 at 0x%lx, skipping...\n",
     319                                 fm_port[dev]);
    321320                        legacy_ctrl &= ~YMFPCI_LEGACY_FMEN;
    322321                        pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl);
    323322                } else if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
    324                         snd_card_free(card);
    325                         snd_printk(KERN_ERR "cannot create opl3 hwdep\n");
    326                         return err;
     323                        dev_err(card->dev, "cannot create opl3 hwdep\n");
     324                        goto free_card;
    327325                }
    328326        }
     
    330328        snd_ymfpci_create_gameport(chip, dev, legacy_ctrl, legacy_ctrl2);
    331329
    332         if ((err = snd_card_register(card)) < 0) {
    333                 snd_card_free(card);
    334                 return err;
    335         }
     330        err = snd_card_register(card);
     331        if (err < 0)
     332                goto free_card;
     333
    336334        pci_set_drvdata(pci, card);
    337335        dev++;
    338336        return 0;
     337
     338free_card:
     339        snd_card_free(card);
     340        return err;
    339341}
    340342
    341 static void __devexit snd_card_ymfpci_remove(struct pci_dev *pci)
     343static void snd_card_ymfpci_remove(struct pci_dev *pci)
    342344{
    343345        snd_card_free(pci_get_drvdata(pci));
    344         pci_set_drvdata(pci, NULL);
    345346}
    346347
    347 static struct pci_driver driver = {
    348         .name = "Yamaha DS-1 PCI",
     348static struct pci_driver ymfpci_driver = {
     349        .name = KBUILD_MODNAME,
    349350        .id_table = snd_ymfpci_ids,
    350351        .probe = snd_card_ymfpci_probe,
    351         .remove = __devexit_p(snd_card_ymfpci_remove),
    352 #ifdef CONFIG_PM
    353         .suspend = snd_ymfpci_suspend,
    354         .resume = snd_ymfpci_resume,
     352        .remove = snd_card_ymfpci_remove,
     353#ifdef CONFIG_PM_SLEEP
     354        .driver = {
     355                .pm = &snd_ymfpci_pm,
     356        },
    355357#endif
    356358};
    357359
    358 static int __init alsa_card_ymfpci_init(void)
    359 {
    360         return pci_register_driver(&driver);
    361 }
    362 
    363 static void __exit alsa_card_ymfpci_exit(void)
    364 {
    365         pci_unregister_driver(&driver);
    366 }
    367 
    368 module_init(alsa_card_ymfpci_init)
    369 module_exit(alsa_card_ymfpci_exit)
     360module_pci_driver(ymfpci_driver);
  • GPL/trunk/alsa-kernel/pci/ymfpci/ymfpci_main.c

    r598 r679  
     1// SPDX-License-Identifier: GPL-2.0-or-later
    12/*
    23 *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
    34 *  Routines for control of YMF724/740/744/754 chips
    4  *
    5  *   This program is free software; you can redistribute it and/or modify
    6  *   it under the terms of the GNU General Public License as published by
    7  *   the Free Software Foundation; either version 2 of the License, or
    8  *   (at your option) any later version.
    9  *
    10  *   This program is distributed in the hope that it will be useful,
    11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13  *   GNU General Public License for more details.
    14  *
    15  *   You should have received a copy of the GNU General Public License
    16  *   along with this program; if not, write to the Free Software
    17  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    18  *
    195 */
     6
     7#ifdef TARGET_OS2
     8#define KBUILD_MODNAME "ymfpci"
     9#endif
    2010
    2111#include <linux/delay.h>
     
    2616#include <linux/sched.h>
    2717#include <linux/slab.h>
    28 #include <linux/vmalloc.h>
    2918#include <linux/mutex.h>
     19#include <linux/module.h>
     20#include <linux/io.h>
    3021
    3122#include <sound/core.h>
     
    3324#include <sound/info.h>
    3425#include <sound/tlv.h>
    35 #include <sound/ymfpci.h>
     26#include "ymfpci.h"
    3627#include <sound/asoundef.h>
    3728#include <sound/mpu401.h>
    3829
    39 #include <asm/io.h>
    4030#include <asm/byteorder.h>
    4131
     
    8777                schedule_timeout_uninterruptible(1);
    8878        } while (time_before(jiffies, end_time));
    89         snd_printk(KERN_ERR "codec_ready: codec %i is not ready [0x%x]\n", secondary, snd_ymfpci_readw(chip, reg));
     79        dev_err(chip->card->dev,
     80                "codec_ready: codec %i is not ready [0x%x]\n",
     81                secondary, snd_ymfpci_readw(chip, reg));
    9082        return -EBUSY;
    9183}
     
    135127}
    136128
    137 static u32 def_rate[8] = {
     129static const u32 def_rate[8] = {
    138130        100, 2000, 8000, 11025, 16000, 22050, 32000, 48000
    139131};
     
    142134{
    143135        u32 i;
    144         static u32 val[8] = {
     136        static const u32 val[8] = {
    145137                0x00570000, 0x06AA0000, 0x18B20000, 0x20930000,
    146138                0x2B9A0000, 0x35A10000, 0x3EAA0000, 0x40000000
     
    158150{
    159151        u32 i;
    160         static u32 val[8] = {
     152        static const u32 val[8] = {
    161153                0x35280000, 0x34A70000, 0x32020000, 0x31770000,
    162154                0x31390000, 0x31C90000, 0x33D00000, 0x40000000
     
    320312                if (ypcm->period_pos >= ypcm->period_size) {
    321313                        /*
    322                         printk(KERN_DEBUG
     314                        dev_dbg(chip->card->dev,
    323315                               "done - active_bank = 0x%x, start = 0x%x\n",
    324316                               chip->active_bank,
     
    335327                        unsigned int next_bank = 1 - chip->active_bank;
    336328                        struct snd_ymfpci_playback_bank *bank;
    337                         u32 volume;
     329                        __le32 volume;
    338330                       
    339331                        bank = &voice->bank[next_bank];
     
    373365                        ypcm->period_pos %= ypcm->period_size;
    374366                        /*
    375                         printk(KERN_DEBUG
     367                        dev_dbg(chip->card->dev,
    376368                               "done - active_bank = 0x%x, start = 0x%x\n",
    377369                               chip->active_bank,
     
    413405                        kctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE;
    414406                }
    415                 /* fall through */
     407                fallthrough;
    416408        case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
    417409        case SNDRV_PCM_TRIGGER_SUSPEND:
     
    504496        struct snd_ymfpci_playback_bank *bank;
    505497        unsigned int nbank;
    506         u32 vol_left, vol_right;
     498        __le32 vol_left, vol_right;
    507499        u8 use_left, use_right;
    508500        unsigned long flags;
     
    598590}
    599591
    600 static int __devinit snd_ymfpci_ac3_init(struct snd_ymfpci *chip)
    601 {
    602         if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),
     592static int snd_ymfpci_ac3_init(struct snd_ymfpci *chip)
     593{
     594        if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &chip->pci->dev,
    603595                                4096, &chip->ac3_tmp_base) < 0)
    604596                return -ENOMEM;
     
    641633        int err;
    642634
    643         if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0)
    644                 return err;
    645635        if ((err = snd_ymfpci_pcm_voice_alloc(ypcm, params_channels(hw_params))) < 0)
    646636                return err;
     
    660650        /* wait, until the PCI operations are not finished */
    661651        snd_ymfpci_irq_wait(chip);
    662         snd_pcm_lib_free_pages(substream);
    663652        if (ypcm->voices[1]) {
    664653                snd_ymfpci_voice_free(chip, ypcm->voices[1]);
     
    696685}
    697686
    698 static int snd_ymfpci_capture_hw_params(struct snd_pcm_substream *substream,
    699                                         struct snd_pcm_hw_params *hw_params)
    700 {
    701         return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
    702 }
    703 
    704687static int snd_ymfpci_capture_hw_free(struct snd_pcm_substream *substream)
    705688{
     
    708691        /* wait, until the PCI operations are not finished */
    709692        snd_ymfpci_irq_wait(chip);
    710         return snd_pcm_lib_free_pages(substream);
     693        return 0;
    711694}
    712695
     
    780763static void snd_ymfpci_irq_wait(struct snd_ymfpci *chip)
    781764{
    782         wait_queue_t wait;
     765        wait_queue_entry_t wait;
    783766        int loops = 4;
    784767
     
    844827}
    845828
    846 static struct snd_pcm_hardware snd_ymfpci_playback =
     829static const struct snd_pcm_hardware snd_ymfpci_playback =
    847830{
    848831        .info =                 (SNDRV_PCM_INFO_MMAP |
     
    866849};
    867850
    868 static struct snd_pcm_hardware snd_ymfpci_capture =
     851static const struct snd_pcm_hardware snd_ymfpci_capture =
    869852{
    870853        .info =                 (SNDRV_PCM_INFO_MMAP |
     
    898881        struct snd_pcm_runtime *runtime = substream->runtime;
    899882        struct snd_ymfpci_pcm *ypcm;
     883        int err;
     884
     885        runtime->hw = snd_ymfpci_playback;
     886        /* FIXME? True value is 256/48 = 5.33333 ms */
     887        err = snd_pcm_hw_constraint_minmax(runtime,
     888                                           SNDRV_PCM_HW_PARAM_PERIOD_TIME,
     889                                           5334, UINT_MAX);
     890        if (err < 0)
     891                return err;
     892        err = snd_pcm_hw_rule_noresample(runtime, 48000);
     893        if (err < 0)
     894                return err;
    900895
    901896        ypcm = kzalloc(sizeof(*ypcm), GFP_KERNEL);
     
    905900        ypcm->type = PLAYBACK_VOICE;
    906901        ypcm->substream = substream;
    907         runtime->hw = snd_ymfpci_playback;
    908902        runtime->private_data = ypcm;
    909903        runtime->private_free = snd_ymfpci_pcm_free_substream;
    910         /* FIXME? True value is 256/48 = 5.33333 ms */
    911         snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_TIME, 5333, UINT_MAX);
    912904        return 0;
    913905}
     
    10141006        struct snd_pcm_runtime *runtime = substream->runtime;
    10151007        struct snd_ymfpci_pcm *ypcm;
     1008        int err;
     1009
     1010        runtime->hw = snd_ymfpci_capture;
     1011        /* FIXME? True value is 256/48 = 5.33333 ms */
     1012        err = snd_pcm_hw_constraint_minmax(runtime,
     1013                                           SNDRV_PCM_HW_PARAM_PERIOD_TIME,
     1014                                           5334, UINT_MAX);
     1015        if (err < 0)
     1016                return err;
     1017        err = snd_pcm_hw_rule_noresample(runtime, 48000);
     1018        if (err < 0)
     1019                return err;
    10161020
    10171021        ypcm = kzalloc(sizeof(*ypcm), GFP_KERNEL);
     
    10231027        ypcm->capture_bank_number = capture_bank_number;
    10241028        chip->capture_substream[capture_bank_number] = substream;
    1025         runtime->hw = snd_ymfpci_capture;
    1026         /* FIXME? True value is 256/48 = 5.33333 ms */
    1027         snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_TIME, 5333, UINT_MAX);
    10281029        runtime->private_data = ypcm;
    10291030        runtime->private_free = snd_ymfpci_pcm_free_substream;
     
    11041105}
    11051106
    1106 static struct snd_pcm_ops snd_ymfpci_playback_ops = {
     1107static const struct snd_pcm_ops snd_ymfpci_playback_ops = {
    11071108        .open =                 snd_ymfpci_playback_open,
    11081109        .close =                snd_ymfpci_playback_close,
    1109         .ioctl =                snd_pcm_lib_ioctl,
    11101110        .hw_params =            snd_ymfpci_playback_hw_params,
    11111111        .hw_free =              snd_ymfpci_playback_hw_free,
     
    11151115};
    11161116
    1117 static struct snd_pcm_ops snd_ymfpci_capture_rec_ops = {
     1117static const struct snd_pcm_ops snd_ymfpci_capture_rec_ops = {
    11181118        .open =                 snd_ymfpci_capture_rec_open,
    11191119        .close =                snd_ymfpci_capture_close,
    1120         .ioctl =                snd_pcm_lib_ioctl,
    1121         .hw_params =            snd_ymfpci_capture_hw_params,
    11221120        .hw_free =              snd_ymfpci_capture_hw_free,
    11231121        .prepare =              snd_ymfpci_capture_prepare,
     
    11261124};
    11271125
    1128 int __devinit snd_ymfpci_pcm(struct snd_ymfpci *chip, int device, struct snd_pcm ** rpcm)
     1126int snd_ymfpci_pcm(struct snd_ymfpci *chip, int device)
    11291127{
    11301128        struct snd_pcm *pcm;
    11311129        int err;
    11321130
    1133         if (rpcm)
    1134                 *rpcm = NULL;
    11351131        if ((err = snd_pcm_new(chip->card, "YMFPCI", device, 32, 1, &pcm)) < 0)
    11361132                return err;
     
    11451141        chip->pcm = pcm;
    11461142
    1147         snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
    1148                                               snd_dma_pci_data(chip->pci), 64*1024, 256*1024);
    1149 
    1150         if (rpcm)
    1151                 *rpcm = pcm;
    1152         return 0;
    1153 }
    1154 
    1155 static struct snd_pcm_ops snd_ymfpci_capture_ac97_ops = {
     1143        snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
     1144                                       &chip->pci->dev, 64*1024, 256*1024);
     1145
     1146        return snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK,
     1147                                     snd_pcm_std_chmaps, 2, 0, NULL);
     1148}
     1149
     1150static const struct snd_pcm_ops snd_ymfpci_capture_ac97_ops = {
    11561151        .open =                 snd_ymfpci_capture_ac97_open,
    11571152        .close =                snd_ymfpci_capture_close,
    1158         .ioctl =                snd_pcm_lib_ioctl,
    1159         .hw_params =            snd_ymfpci_capture_hw_params,
    11601153        .hw_free =              snd_ymfpci_capture_hw_free,
    11611154        .prepare =              snd_ymfpci_capture_prepare,
     
    11641157};
    11651158
    1166 int __devinit snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device, struct snd_pcm ** rpcm)
     1159int snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device)
    11671160{
    11681161        struct snd_pcm *pcm;
    11691162        int err;
    11701163
    1171         if (rpcm)
    1172                 *rpcm = NULL;
    11731164        if ((err = snd_pcm_new(chip->card, "YMFPCI - PCM2", device, 0, 1, &pcm)) < 0)
    11741165                return err;
     
    11831174        chip->pcm2 = pcm;
    11841175
    1185         snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
    1186                                               snd_dma_pci_data(chip->pci), 64*1024, 256*1024);
    1187 
    1188         if (rpcm)
    1189                 *rpcm = pcm;
    1190         return 0;
    1191 }
    1192 
    1193 static struct snd_pcm_ops snd_ymfpci_playback_spdif_ops = {
     1176        snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
     1177                                       &chip->pci->dev, 64*1024, 256*1024);
     1178
     1179        return 0;
     1180}
     1181
     1182static const struct snd_pcm_ops snd_ymfpci_playback_spdif_ops = {
    11941183        .open =                 snd_ymfpci_playback_spdif_open,
    11951184        .close =                snd_ymfpci_playback_spdif_close,
    1196         .ioctl =                snd_pcm_lib_ioctl,
    11971185        .hw_params =            snd_ymfpci_playback_hw_params,
    11981186        .hw_free =              snd_ymfpci_playback_hw_free,
     
    12021190};
    12031191
    1204 int __devinit snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device, struct snd_pcm ** rpcm)
     1192int snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device)
    12051193{
    12061194        struct snd_pcm *pcm;
    12071195        int err;
    12081196
    1209         if (rpcm)
    1210                 *rpcm = NULL;
    12111197        if ((err = snd_pcm_new(chip->card, "YMFPCI - IEC958", device, 1, 0, &pcm)) < 0)
    12121198                return err;
     
    12201206        chip->pcm_spdif = pcm;
    12211207
    1222         snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
    1223                                               snd_dma_pci_data(chip->pci), 64*1024, 256*1024);
    1224 
    1225         if (rpcm)
    1226                 *rpcm = pcm;
    1227         return 0;
    1228 }
    1229 
    1230 static struct snd_pcm_ops snd_ymfpci_playback_4ch_ops = {
     1208        snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
     1209                                       &chip->pci->dev, 64*1024, 256*1024);
     1210
     1211        return 0;
     1212}
     1213
     1214static const struct snd_pcm_ops snd_ymfpci_playback_4ch_ops = {
    12311215        .open =                 snd_ymfpci_playback_4ch_open,
    12321216        .close =                snd_ymfpci_playback_4ch_close,
    1233         .ioctl =                snd_pcm_lib_ioctl,
    12341217        .hw_params =            snd_ymfpci_playback_hw_params,
    12351218        .hw_free =              snd_ymfpci_playback_hw_free,
     
    12391222};
    12401223
    1241 int __devinit snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device, struct snd_pcm ** rpcm)
     1224static const struct snd_pcm_chmap_elem surround_map[] = {
     1225        { .channels = 1,
     1226          .map = { SNDRV_CHMAP_MONO } },
     1227        { .channels = 2,
     1228          .map = { SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } },
     1229        {0}
     1230};
     1231
     1232int snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device)
    12421233{
    12431234        struct snd_pcm *pcm;
    12441235        int err;
    12451236
    1246         if (rpcm)
    1247                 *rpcm = NULL;
    12481237        if ((err = snd_pcm_new(chip->card, "YMFPCI - Rear", device, 1, 0, &pcm)) < 0)
    12491238                return err;
     
    12571246        chip->pcm_4ch = pcm;
    12581247
    1259         snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
    1260                                               snd_dma_pci_data(chip->pci), 64*1024, 256*1024);
    1261 
    1262         if (rpcm)
    1263                 *rpcm = pcm;
    1264         return 0;
     1248        snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
     1249                                       &chip->pci->dev, 64*1024, 256*1024);
     1250
     1251        return snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK,
     1252                                     surround_map, 2, 0, NULL);
    12651253}
    12661254
     
    13031291}
    13041292
    1305 static struct snd_kcontrol_new snd_ymfpci_spdif_default __devinitdata =
     1293static const struct snd_kcontrol_new snd_ymfpci_spdif_default =
    13061294{
    13071295        .iface =        SNDRV_CTL_ELEM_IFACE_PCM,
     
    13311319}
    13321320
    1333 static struct snd_kcontrol_new snd_ymfpci_spdif_mask __devinitdata =
     1321static const struct snd_kcontrol_new snd_ymfpci_spdif_mask =
    13341322{
    13351323        .access =       SNDRV_CTL_ELEM_ACCESS_READ,
     
    13781366}
    13791367
    1380 static struct snd_kcontrol_new snd_ymfpci_spdif_stream __devinitdata =
     1368static const struct snd_kcontrol_new snd_ymfpci_spdif_stream =
    13811369{
    13821370        .access =       SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE,
     
    14261414}
    14271415
    1428 static struct snd_kcontrol_new snd_ymfpci_drec_source __devinitdata = {
     1416static const struct snd_kcontrol_new snd_ymfpci_drec_source = {
    14291417        .access =       SNDRV_CTL_ELEM_ACCESS_READWRITE,
    14301418        .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
     
    15961584}
    15971585
    1598 
    1599 static struct snd_kcontrol_new snd_ymfpci_controls[] __devinitdata = {
     1586static const struct snd_kcontrol_new snd_ymfpci_dup4ch = {
     1587        .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
     1588        .name = "4ch Duplication",
     1589        .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
     1590        .info = snd_ymfpci_info_dup4ch,
     1591        .get = snd_ymfpci_get_dup4ch,
     1592        .put = snd_ymfpci_put_dup4ch,
     1593};
     1594
     1595static const struct snd_kcontrol_new snd_ymfpci_controls[] = {
    16001596{
    16011597        .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
     
    16161612YMFPCI_DOUBLE("ADC Playback Volume", 1, YDSXGR_SECADCOUTVOL),
    16171613YMFPCI_DOUBLE("ADC Capture Volume", 1, YDSXGR_SECADCLOOPVOL),
    1618 YMFPCI_DOUBLE("FM Legacy Volume", 0, YDSXGR_LEGACYOUTVOL),
     1614YMFPCI_DOUBLE("FM Legacy Playback Volume", 0, YDSXGR_LEGACYOUTVOL),
    16191615YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("AC97 ", PLAYBACK,VOLUME), 0, YDSXGR_ZVOUTVOL),
    16201616YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("", CAPTURE,VOLUME), 0, YDSXGR_ZVLOOPVOL),
     
    16241620YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), 0, YDSXGR_SPDIFINCTRL, 0),
    16251621YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("Loop",NONE,NONE), 0, YDSXGR_SPDIFINCTRL, 4),
    1626 {
    1627         .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
    1628         .name = "4ch Duplication",
    1629         .info = snd_ymfpci_info_dup4ch,
    1630         .get = snd_ymfpci_get_dup4ch,
    1631         .put = snd_ymfpci_put_dup4ch,
    1632 },
    16331622};
    16341623
     
    16981687}
    16991688
    1700 static struct snd_kcontrol_new snd_ymfpci_rear_shared __devinitdata = {
     1689static const struct snd_kcontrol_new snd_ymfpci_rear_shared = {
    17011690        .name = "Shared Rear/Line-In Switch",
    17021691        .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
     
    17621751}
    17631752
    1764 static struct snd_kcontrol_new snd_ymfpci_pcm_volume __devinitdata = {
     1753static const struct snd_kcontrol_new snd_ymfpci_pcm_volume = {
    17651754        .iface = SNDRV_CTL_ELEM_IFACE_PCM,
    17661755        .name = "PCM Playback Volume",
     
    17891778}
    17901779
    1791 int __devinit snd_ymfpci_mixer(struct snd_ymfpci *chip, int rear_switch)
     1780int snd_ymfpci_mixer(struct snd_ymfpci *chip, int rear_switch)
    17921781{
    17931782        struct snd_ac97_template ac97;
     
    17961785        unsigned int idx;
    17971786        int err;
    1798         static struct snd_ac97_bus_ops ops = {
     1787        static const struct snd_ac97_bus_ops ops = {
    17991788                .write = snd_ymfpci_codec_write,
    18001789                .read = snd_ymfpci_codec_read,
     
    18181807        for (idx = 0; idx < ARRAY_SIZE(snd_ymfpci_controls); idx++) {
    18191808                if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_ymfpci_controls[idx], chip))) < 0)
     1809                        return err;
     1810        }
     1811        if (chip->ac97->ext_id & AC97_EI_SDAC) {
     1812                kctl = snd_ctl_new1(&snd_ymfpci_dup4ch, chip);
     1813                err = snd_ctl_add(chip->card, kctl);
     1814                if (err < 0)
    18201815                        return err;
    18211816        }
     
    19181913}
    19191914
    1920 static struct snd_timer_hardware snd_ymfpci_timer_hw = {
     1915static const struct snd_timer_hardware snd_ymfpci_timer_hw = {
    19211916        .flags = SNDRV_TIMER_HW_AUTO,
    19221917        .resolution = 10417, /* 1 / 96 kHz = 10.41666...us */
     
    19271922};
    19281923
    1929 int __devinit snd_ymfpci_timer(struct snd_ymfpci *chip, int device)
     1924int snd_ymfpci_timer(struct snd_ymfpci *chip, int device)
    19301925{
    19311926        struct snd_timer *timer = NULL;
     
    19631958}
    19641959
    1965 static int __devinit snd_ymfpci_proc_init(struct snd_card *card, struct snd_ymfpci *chip)
    1966 {
    1967         struct snd_info_entry *entry;
    1968        
    1969         if (! snd_card_proc_new(card, "ymfpci", &entry))
    1970                 snd_info_set_text_ops(entry, chip, snd_ymfpci_proc_read);
    1971         return 0;
     1960static int snd_ymfpci_proc_init(struct snd_card *card, struct snd_ymfpci *chip)
     1961{
     1962        return snd_card_ro_proc_new(card, "ymfpci", chip, snd_ymfpci_proc_read);
    19721963}
    19731964
     
    20232014        if (err >= 0) {
    20242015                if (chip->dsp_microcode->size != YDSXG_DSPLENGTH) {
    2025                         snd_printk(KERN_ERR "DSP microcode has wrong size\n");
     2016                        dev_err(chip->card->dev,
     2017                                "DSP microcode has wrong size\n");
    20262018                        err = -EINVAL;
    20272019                }
     
    20382030        if (err >= 0) {
    20392031                if (chip->controller_microcode->size != YDSXG_CTRLLENGTH) {
    2040                         snd_printk(KERN_ERR "controller microcode"
    2041                                    " has wrong size\n");
     2032                        dev_err(chip->card->dev,
     2033                                "controller microcode has wrong size\n");
    20422034                        err = -EINVAL;
    20432035                }
     
    20852077}
    20862078
    2087 static int __devinit snd_ymfpci_memalloc(struct snd_ymfpci *chip)
     2079static int snd_ymfpci_memalloc(struct snd_ymfpci *chip)
    20882080{
    20892081        long size, playback_ctrl_size;
     
    21052097        /* work_ptr must be aligned to 256 bytes, but it's already
    21062098           covered with the kernel page allocation mechanism */
    2107         if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),
     2099        if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &chip->pci->dev,
    21082100                                size, &chip->work_ptr) < 0)
    21092101                return -ENOMEM;
     
    21142106        chip->bank_base_playback = ptr;
    21152107        chip->bank_base_playback_addr = ptr_addr;
    2116         chip->ctrl_playback = (u32 *)ptr;
     2108        chip->ctrl_playback = (__le32 *)ptr;
    21172109        chip->ctrl_playback[0] = cpu_to_le32(YDSXG_PLAYBACK_VOICES);
    21182110        ptr += ALIGN(playback_ctrl_size, 0x100);
     
    22142206         * the chip again unless reboot.  ACPI bug?
    22152207         */
    2216         pci_set_power_state(chip->pci, 3);
     2208        pci_set_power_state(chip->pci, PCI_D3hot);
    22172209#endif
    22182210
    2219 #ifdef CONFIG_PM
    2220         vfree(chip->saved_regs);
     2211#ifdef CONFIG_PM_SLEEP
     2212        kfree(chip->saved_regs);
    22212213#endif
    22222214        if (chip->irq >= 0)
     
    22252217        release_and_free_resource(chip->fm_res);
    22262218        snd_ymfpci_free_gameport(chip);
    2227         if (chip->reg_area_virt)
    2228                 iounmap(chip->reg_area_virt);
     2219        iounmap(chip->reg_area_virt);
    22292220        if (chip->work_ptr.area)
    22302221                snd_dma_free_pages(&chip->work_ptr);
     
    22472238}
    22482239
    2249 #ifdef CONFIG_PM
    2250 static int saved_regs_index[] = {
     2240#ifdef CONFIG_PM_SLEEP
     2241static const int saved_regs_index[] = {
    22512242        /* spdif */
    22522243        YDSXGR_SPDIFOUTCTRL,
     
    22772268#define YDSXGR_NUM_SAVED_REGS   ARRAY_SIZE(saved_regs_index)
    22782269
    2279 int snd_ymfpci_suspend(struct pci_dev *pci, pm_message_t state)
    2280 {
    2281         struct snd_card *card = pci_get_drvdata(pci);
     2270static int snd_ymfpci_suspend(struct device *dev)
     2271{
     2272        struct snd_card *card = dev_get_drvdata(dev);
    22822273        struct snd_ymfpci *chip = card->private_data;
    22832274        unsigned int i;
    22842275       
    22852276        snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
    2286         snd_pcm_suspend_all(chip->pcm);
    2287         snd_pcm_suspend_all(chip->pcm2);
    2288         snd_pcm_suspend_all(chip->pcm_spdif);
    2289         snd_pcm_suspend_all(chip->pcm_4ch);
    22902277        snd_ac97_suspend(chip->ac97);
    22912278        for (i = 0; i < YDSXGR_NUM_SAVED_REGS; i++)
    22922279                chip->saved_regs[i] = snd_ymfpci_readl(chip, saved_regs_index[i]);
    22932280        chip->saved_ydsxgr_mode = snd_ymfpci_readl(chip, YDSXGR_MODE);
     2281        pci_read_config_word(chip->pci, PCIR_DSXG_LEGACY,
     2282                             &chip->saved_dsxg_legacy);
     2283        pci_read_config_word(chip->pci, PCIR_DSXG_ELEGACY,
     2284                             &chip->saved_dsxg_elegacy);
    22942285        snd_ymfpci_writel(chip, YDSXGR_NATIVEDACOUTVOL, 0);
    22952286        snd_ymfpci_writel(chip, YDSXGR_BUF441OUTVOL, 0);
    22962287        snd_ymfpci_disable_dsp(chip);
    2297         pci_disable_device(pci);
    2298         pci_save_state(pci);
    2299         pci_set_power_state(pci, pci_choose_state(pci, state));
    2300         return 0;
    2301 }
    2302 
    2303 int snd_ymfpci_resume(struct pci_dev *pci)
    2304 {
    2305         struct snd_card *card = pci_get_drvdata(pci);
     2288        return 0;
     2289}
     2290
     2291static int snd_ymfpci_resume(struct device *dev)
     2292{
     2293        struct pci_dev *pci = to_pci_dev(dev);
     2294        struct snd_card *card = dev_get_drvdata(dev);
    23062295        struct snd_ymfpci *chip = card->private_data;
    23072296        unsigned int i;
    23082297
    2309         pci_set_power_state(pci, PCI_D0);
    2310         pci_restore_state(pci);
    2311         if (pci_enable_device(pci) < 0) {
    2312                 printk(KERN_ERR "ymfpci: pci_enable_device failed, "
    2313                        "disabling device\n");
    2314                 snd_card_disconnect(card);
    2315                 return -EIO;
    2316         }
    2317         pci_set_master(pci);
    23182298        snd_ymfpci_aclink_reset(pci);
    23192299        snd_ymfpci_codec_ready(chip, 0);
     
    23252305
    23262306        snd_ac97_resume(chip->ac97);
     2307
     2308        pci_write_config_word(chip->pci, PCIR_DSXG_LEGACY,
     2309                              chip->saved_dsxg_legacy);
     2310        pci_write_config_word(chip->pci, PCIR_DSXG_ELEGACY,
     2311                              chip->saved_dsxg_elegacy);
    23272312
    23282313        /* start hw again */
     
    23362321        return 0;
    23372322}
    2338 #endif /* CONFIG_PM */
    2339 
    2340 int __devinit snd_ymfpci_create(struct snd_card *card,
    2341                                 struct pci_dev * pci,
    2342                                 unsigned short old_legacy_ctrl,
    2343                                 struct snd_ymfpci ** rchip)
     2323
     2324SIMPLE_DEV_PM_OPS(snd_ymfpci_pm, snd_ymfpci_suspend, snd_ymfpci_resume);
     2325#endif /* CONFIG_PM_SLEEP */
     2326
     2327int snd_ymfpci_create(struct snd_card *card,
     2328                      struct pci_dev *pci,
     2329                      unsigned short old_legacy_ctrl,
     2330                      struct snd_ymfpci **rchip)
    23442331{
    23452332        struct snd_ymfpci *chip;
    23462333        int err;
    2347         static struct snd_device_ops ops = {
     2334        static const struct snd_device_ops ops = {
    23482335                .dev_free =     snd_ymfpci_dev_free,
    23492336        };
     
    23692356        chip->irq = -1;
    23702357        chip->device_id = pci->device;
    2371 #ifndef TARGET_OS2
    23722358        chip->rev = pci->revision;
    2373 #else
    2374         chip->rev = snd_pci_revision(pci);
    2375 #endif
    23762359        chip->reg_area_phys = pci_resource_start(pci, 0);
    2377         chip->reg_area_virt = ioremap_nocache(chip->reg_area_phys, 0x8000);
     2360        chip->reg_area_virt = ioremap(chip->reg_area_phys, 0x8000);
    23782361        pci_set_master(pci);
    23792362        chip->src441_used = -1;
    23802363
    23812364        if ((chip->res_reg_area = request_mem_region(chip->reg_area_phys, 0x8000, "YMFPCI")) == NULL) {
    2382                 snd_printk(KERN_ERR "unable to grab memory region 0x%lx-0x%lx\n", chip->reg_area_phys, chip->reg_area_phys + 0x8000 - 1);
    2383                 snd_ymfpci_free(chip);
    2384                 return -EBUSY;
     2365                dev_err(chip->card->dev,
     2366                        "unable to grab memory region 0x%lx-0x%lx\n",
     2367                        chip->reg_area_phys, chip->reg_area_phys + 0x8000 - 1);
     2368                err = -EBUSY;
     2369                goto free_chip;
    23852370        }
    23862371        if (request_irq(pci->irq, snd_ymfpci_interrupt, IRQF_SHARED,
    2387                         "YMFPCI", chip)) {
    2388                 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
    2389                 snd_ymfpci_free(chip);
    2390                 return -EBUSY;
     2372                        KBUILD_MODNAME, chip)) {
     2373                dev_err(chip->card->dev, "unable to grab IRQ %d\n", pci->irq);
     2374                err = -EBUSY;
     2375                goto free_chip;
    23912376        }
    23922377        chip->irq = pci->irq;
     2378        card->sync_irq = chip->irq;
    23932379
    23942380        snd_ymfpci_aclink_reset(pci);
    23952381        if (snd_ymfpci_codec_ready(chip, 0) < 0) {
    2396                 snd_ymfpci_free(chip);
    2397                 return -EIO;
     2382                err = -EIO;
     2383                goto free_chip;
    23982384        }
    23992385
    24002386        err = snd_ymfpci_request_firmware(chip);
    24012387        if (err < 0) {
    2402                 snd_printk(KERN_ERR "firmware request failed: %d\n", err);
    2403                 snd_ymfpci_free(chip);
    2404                 return err;
     2388                dev_err(chip->card->dev, "firmware request failed: %d\n", err);
     2389                goto free_chip;
    24052390        }
    24062391        snd_ymfpci_download_image(chip);
     
    24092394
    24102395        if (snd_ymfpci_memalloc(chip) < 0) {
    2411                 snd_ymfpci_free(chip);
    2412                 return -EIO;
    2413         }
    2414 
    2415         if ((err = snd_ymfpci_ac3_init(chip)) < 0) {
    2416                 snd_ymfpci_free(chip);
    2417                 return err;
    2418         }
    2419 
    2420 #ifdef CONFIG_PM
    2421         chip->saved_regs = vmalloc(YDSXGR_NUM_SAVED_REGS * sizeof(u32));
     2396                err = -EIO;
     2397                goto free_chip;
     2398        }
     2399
     2400        err = snd_ymfpci_ac3_init(chip);
     2401        if (err < 0)
     2402                goto free_chip;
     2403
     2404#ifdef CONFIG_PM_SLEEP
     2405        chip->saved_regs = kmalloc_array(YDSXGR_NUM_SAVED_REGS, sizeof(u32),
     2406                                         GFP_KERNEL);
    24222407        if (chip->saved_regs == NULL) {
    2423                 snd_ymfpci_free(chip);
    2424                 return -ENOMEM;
     2408                err = -ENOMEM;
     2409                goto free_chip;
    24252410        }
    24262411#endif
    24272412
    2428         if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
    2429                 snd_ymfpci_free(chip);
    2430                 return err;
    2431         }
     2413        err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
     2414        if (err < 0)
     2415                goto free_chip;
    24322416
    24332417        snd_ymfpci_proc_init(card, chip);
    24342418
    2435         snd_card_set_dev(card, &pci->dev);
    2436 
    24372419        *rchip = chip;
    24382420        return 0;
    2439 }
     2421
     2422free_chip:
     2423        snd_ymfpci_free(chip);
     2424        return err;
     2425}
Note: See TracChangeset for help on using the changeset viewer.