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/pci/emu10k1/emu10k1x.c

    r598 r679  
     1// SPDX-License-Identifier: GPL-2.0-or-later
    12/*
    23 *  Copyright (c) by Francisco Moraes <fmoraes@nc.rr.com>
     
    1415 *    - EMU10K1X-DBQ
    1516 *    - STAC 9708T
    16  *
    17  *   This program is free software; you can redistribute it and/or modify
    18  *   it under the terms of the GNU General Public License as published by
    19  *   the Free Software Foundation; either version 2 of the License, or
    20  *   (at your option) any later version.
    21  *
    22  *   This program is distributed in the hope that it will be useful,
    23  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
    24  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    25  *   GNU General Public License for more details.
    26  *
    27  *   You should have received a copy of the GNU General Public License
    28  *   along with this program; if not, write to the Free Software
    29  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    30  *
    3117 */
     18#ifdef TARGET_OS2
     19#define KBUILD_MODNAME "emu10k1"
     20#endif
    3221#include <linux/init.h>
    3322#include <linux/interrupt.h>
     
    3524#include <linux/dma-mapping.h>
    3625#include <linux/slab.h>
    37 #include <linux/moduleparam.h>
     26#include <linux/module.h>
    3827#include <sound/core.h>
    3928#include <sound/initval.h>
     
    5140static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
    5241static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
    53 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
     42static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
    5443
    5544module_param_array(index, int, NULL, 0444);
     
    10897/********************************************************************************************************/
    10998#define PLAYBACK_LIST_ADDR      0x00            /* Base DMA address of a list of pointers to each period/size */
    110                                                 /* One list entry: 4 bytes for DMA address,
     99                                                /* One list entry: 4 bytes for DMA address, 
    111100                                                 * 4 bytes for period_size << 16.
    112101                                                 * One list entry is 8 bytes long.
     
    181170/* From 0x50 - 0x5f, last samples captured */
    182171
    183 /**
     172/*
    184173 * The hardware has 3 channels for playback and 1 for capture.
    185174 *  - channel 0 is the front channel
     
    187176 *  - channel 2 is the center/lfe channel
    188177 * Volume is controlled by the AC97 for the front and rear channels by
    189  * the PCM Playback Volume, Sigmatel Surround Playback Volume and
     178 * the PCM Playback Volume, Sigmatel Surround Playback Volume and 
    190179 * Surround Playback Volume. The Sigmatel 4-Speaker Stereo switch affects
    191180 * the front/rear channel mixing in the REAR OUT jack. When using the
     
    200189        int number;
    201190        int use;
    202 
     191 
    203192        struct emu10k1x_pcm *epcm;
    204193};
     
    255244
    256245/* hardware definition */
    257 static struct snd_pcm_hardware snd_emu10k1x_playback_hw = {
    258         .info =                 (SNDRV_PCM_INFO_MMAP |
     246static const struct snd_pcm_hardware snd_emu10k1x_playback_hw = {
     247        .info =                 (SNDRV_PCM_INFO_MMAP | 
    259248                                 SNDRV_PCM_INFO_INTERLEAVED |
    260249                                 SNDRV_PCM_INFO_BLOCK_TRANSFER |
     
    274263};
    275264
    276 static struct snd_pcm_hardware snd_emu10k1x_capture_hw = {
    277         .info =                 (SNDRV_PCM_INFO_MMAP |
     265static const struct snd_pcm_hardware snd_emu10k1x_capture_hw = {
     266        .info =                 (SNDRV_PCM_INFO_MMAP | 
    278267                                 SNDRV_PCM_INFO_INTERLEAVED |
    279268                                 SNDRV_PCM_INFO_BLOCK_TRANSFER |
     
    293282};
    294283
    295 static unsigned int snd_emu10k1x_ptr_read(struct emu10k1x * emu,
    296                                           unsigned int reg,
     284static unsigned int snd_emu10k1x_ptr_read(struct emu10k1x * emu, 
     285                                          unsigned int reg, 
    297286                                          unsigned int chn)
    298287{
    299288        unsigned long flags;
    300289        unsigned int regptr, val;
    301 
     290 
    302291        regptr = (reg << 16) | chn;
    303292
     
    370359                return;
    371360#if 0
    372         snd_printk(KERN_INFO "IRQ: position = 0x%x, period = 0x%x, size = 0x%x\n",
     361        dev_info(emu->card->dev,
     362                 "IRQ: position = 0x%x, period = 0x%x, size = 0x%x\n",
    373363                   epcm->substream->ops->pointer(epcm->substream),
    374364                   snd_pcm_lib_period_bytes(epcm->substream),
     
    397387        epcm->emu = chip;
    398388        epcm->substream = substream;
    399 
     389 
    400390        runtime->private_data = epcm;
    401391        runtime->private_free = snd_emu10k1x_pcm_free_substream;
    402 
     392 
    403393        runtime->hw = snd_emu10k1x_playback_hw;
    404394
     
    425415        }
    426416
    427         return snd_pcm_lib_malloc_pages(substream,
    428                                         params_buffer_bytes(hw_params));
     417        return 0;
    429418}
    430419
     
    446435        }
    447436
    448         return snd_pcm_lib_free_pages(substream);
     437        return 0;
    449438}
    450439
     
    488477        int result = 0;
    489478
    490 //      snd_printk(KERN_INFO "trigger - emu10k1x = 0x%x, cmd = %i, pointer = %d\n", (int)emu, cmd, (int)substream->ops->pointer(substream));
     479        /*
     480        dev_dbg(emu->card->dev,
     481                "trigger - emu10k1x = 0x%x, cmd = %i, pointer = %d\n",
     482                (int)emu, cmd, (int)substream->ops->pointer(substream));
     483        */
    491484
    492485        switch (cmd) {
     
    531524                return 0;
    532525       
    533         if (ptr3 != ptr4)
     526        if (ptr3 != ptr4) 
    534527                ptr1 = snd_emu10k1x_ptr_read(emu, PLAYBACK_POINTER, channel);
    535528        ptr2 = bytes_to_frames(runtime, ptr1);
     
    544537
    545538/* operators */
    546 static struct snd_pcm_ops snd_emu10k1x_playback_ops = {
     539static const struct snd_pcm_ops snd_emu10k1x_playback_ops = {
    547540        .open =        snd_emu10k1x_playback_open,
    548541        .close =       snd_emu10k1x_playback_close,
    549         .ioctl =       snd_pcm_lib_ioctl,
    550542        .hw_params =   snd_emu10k1x_pcm_hw_params,
    551543        .hw_free =     snd_emu10k1x_pcm_hw_free,
     
    604596        }
    605597
    606         return snd_pcm_lib_malloc_pages(substream,
    607                                         params_buffer_bytes(hw_params));
     598        return 0;
    608599}
    609600
     
    625616        }
    626617
    627         return snd_pcm_lib_free_pages(substream);
     618        return 0;
    628619}
    629620
     
    653644        switch (cmd) {
    654645        case SNDRV_PCM_TRIGGER_START:
    655                 snd_emu10k1x_intr_enable(emu, INTE_CAP_0_LOOP |
     646                snd_emu10k1x_intr_enable(emu, INTE_CAP_0_LOOP | 
    656647                                         INTE_CAP_0_HALF_LOOP);
    657648                snd_emu10k1x_ptr_write(emu, TRIGGER_CHANNEL, 0, snd_emu10k1x_ptr_read(emu, TRIGGER_CHANNEL, 0)|TRIGGER_CAPTURE);
     
    660651        case SNDRV_PCM_TRIGGER_STOP:
    661652                epcm->running = 0;
    662                 snd_emu10k1x_intr_disable(emu, INTE_CAP_0_LOOP |
     653                snd_emu10k1x_intr_disable(emu, INTE_CAP_0_LOOP | 
    663654                                          INTE_CAP_0_HALF_LOOP);
    664655                snd_emu10k1x_ptr_write(emu, TRIGGER_CHANNEL, 0, snd_emu10k1x_ptr_read(emu, TRIGGER_CHANNEL, 0) & ~(TRIGGER_CAPTURE));
     
    690681}
    691682
    692 static struct snd_pcm_ops snd_emu10k1x_capture_ops = {
     683static const struct snd_pcm_ops snd_emu10k1x_capture_ops = {
    693684        .open =        snd_emu10k1x_pcm_open_capture,
    694685        .close =       snd_emu10k1x_pcm_close_capture,
    695         .ioctl =       snd_pcm_lib_ioctl,
    696686        .hw_params =   snd_emu10k1x_pcm_hw_params_capture,
    697687        .hw_free =     snd_emu10k1x_pcm_hw_free_capture,
     
    707697        unsigned long flags;
    708698        unsigned short val;
    709 
     699 
    710700        spin_lock_irqsave(&emu->emu_lock, flags);
    711701        outb(reg, emu->port + AC97ADDRESS);
     
    720710        struct emu10k1x *emu = ac97->private_data;
    721711        unsigned long flags;
    722 
     712 
    723713        spin_lock_irqsave(&emu->emu_lock, flags);
    724714        outb(reg, emu->port + AC97ADDRESS);
     
    732722        struct snd_ac97_template ac97;
    733723        int err;
    734         static struct snd_ac97_bus_ops ops = {
     724        static const struct snd_ac97_bus_ops ops = {
    735725                .write = snd_emu10k1x_ac97_write,
    736726                .read = snd_emu10k1x_ac97_read,
    737727        };
    738 
     728 
    739729        if ((err = snd_ac97_bus(chip->card, 0, &ops, NULL, &pbus)) < 0)
    740730                return err;
     
    799789                if (cap_voice->use)
    800790                        snd_emu10k1x_pcm_interrupt(chip, cap_voice);
    801                 else
    802                         snd_emu10k1x_intr_disable(chip,
     791                else 
     792                        snd_emu10k1x_intr_disable(chip, 
    803793                                                  INTE_CAP_0_LOOP |
    804794                                                  INTE_CAP_0_HALF_LOOP);
     
    827817        outl(status, chip->port + IPR);
    828818
    829         // snd_printk(KERN_INFO "interrupt %08x\n", status);
     819        /* dev_dbg(chip->card->dev, "interrupt %08x\n", status); */
    830820        return IRQ_HANDLED;
    831821}
    832822
    833 static int __devinit snd_emu10k1x_pcm(struct emu10k1x *emu, int device, struct snd_pcm **rpcm)
     823static const struct snd_pcm_chmap_elem surround_map[] = {
     824        { .channels = 2,
     825          .map = { SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } },
     826        {0}
     827};
     828
     829static const struct snd_pcm_chmap_elem clfe_map[] = {
     830        { .channels = 2,
     831          .map = { SNDRV_CHMAP_FC, SNDRV_CHMAP_LFE } },
     832        {0}
     833};
     834
     835static int snd_emu10k1x_pcm(struct emu10k1x *emu, int device)
    834836{
    835837        struct snd_pcm *pcm;
     838        const struct snd_pcm_chmap_elem *map = NULL;
    836839        int err;
    837840        int capture = 0;
    838 
    839         if (rpcm)
    840                 *rpcm = NULL;
     841 
    841842        if (device == 0)
    842843                capture = 1;
     
    844845        if ((err = snd_pcm_new(emu->card, "emu10k1x", device, 1, capture, &pcm)) < 0)
    845846                return err;
    846 
     847 
    847848        pcm->private_data = emu;
    848849       
     
    862863        case 0:
    863864                strcpy(pcm->name, "EMU10K1X Front");
     865                map = snd_pcm_std_chmaps;
    864866                break;
    865867        case 1:
    866868                strcpy(pcm->name, "EMU10K1X Rear");
     869                map = surround_map;
    867870                break;
    868871        case 2:
    869872                strcpy(pcm->name, "EMU10K1X Center/LFE");
     873                map = clfe_map;
    870874                break;
    871875        }
    872876        emu->pcm = pcm;
    873877
    874         snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
    875                                               snd_dma_pci_data(emu->pci),
    876                                               32*1024, 32*1024);
    877 
    878         if (rpcm)
    879                 *rpcm = pcm;
    880 
    881         return 0;
    882 }
    883 
    884 static int __devinit snd_emu10k1x_create(struct snd_card *card,
    885                                          struct pci_dev *pci,
    886                                          struct emu10k1x **rchip)
     878        snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
     879                                       &emu->pci->dev, 32*1024, 32*1024);
     880 
     881        return snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, map, 2,
     882                                     1 << 2, NULL);
     883}
     884
     885static int snd_emu10k1x_create(struct snd_card *card,
     886                               struct pci_dev *pci,
     887                               struct emu10k1x **rchip)
    887888{
    888889        struct emu10k1x *chip;
    889890        int err;
    890891        int ch;
    891         static struct snd_device_ops ops = {
     892        static const struct snd_device_ops ops = {
    892893                .dev_free = snd_emu10k1x_dev_free,
    893894        };
     
    899900        if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 ||
    900901            pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) {
    901                 snd_printk(KERN_ERR "error to set 28bit mask DMA\n");
     902                dev_err(card->dev, "error to set 28bit mask DMA\n");
    902903                pci_disable_device(pci);
    903904                return -ENXIO;
     
    916917        spin_lock_init(&chip->emu_lock);
    917918        spin_lock_init(&chip->voice_lock);
    918 
     919 
    919920        chip->port = pci_resource_start(pci, 0);
    920921        if ((chip->res_port = request_region(chip->port, 8,
    921                                              "EMU10K1X")) == NULL) {
    922                 snd_printk(KERN_ERR "emu10k1x: cannot allocate the port 0x%lx\n", chip->port);
     922                                             "EMU10K1X")) == NULL) {
     923                dev_err(card->dev, "cannot allocate the port 0x%lx\n",
     924                        chip->port);
    923925                snd_emu10k1x_free(chip);
    924926                return -EBUSY;
     
    926928
    927929        if (request_irq(pci->irq, snd_emu10k1x_interrupt,
    928                         IRQF_SHARED, "EMU10K1X", chip)) {
    929                 snd_printk(KERN_ERR "emu10k1x: cannot grab irq %d\n", pci->irq);
     930                        IRQF_SHARED, KBUILD_MODNAME, chip)) {
     931                dev_err(card->dev, "cannot grab irq %d\n", pci->irq);
    930932                snd_emu10k1x_free(chip);
    931933                return -EBUSY;
    932934        }
    933935        chip->irq = pci->irq;
    934 
    935         if(snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
    936                                4 * 1024, &chip->dma_buffer) < 0) {
     936        card->sync_irq = chip->irq;
     937 
     938        if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &pci->dev,
     939                                4 * 1024, &chip->dma_buffer) < 0) {
    937940                snd_emu10k1x_free(chip);
    938941                return -ENOMEM;
     
    948951        pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &chip->serial);
    949952        pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &chip->model);
    950         snd_printk(KERN_INFO "Model %04x Rev %08x Serial %08x\n", chip->model,
     953        dev_info(card->dev, "Model %04x Rev %08x Serial %08x\n", chip->model,
    951954                   chip->revision, chip->serial);
    952955
     
    973976         */
    974977        snd_emu10k1x_ptr_write(chip, SPCS0, 0,
    975                                chip->spdif_bits[0] =
     978                               chip->spdif_bits[0] = 
    976979                               SPCS_CLKACCY_1000PPM | SPCS_SAMPLERATE_48 |
    977980                               SPCS_CHANNELNUM_LEFT | SPCS_SOURCENUM_UNSPEC |
     
    979982                               0x00000000 | SPCS_EMPHASIS_NONE | SPCS_COPYRIGHT);
    980983        snd_emu10k1x_ptr_write(chip, SPCS1, 0,
    981                                chip->spdif_bits[1] =
     984                               chip->spdif_bits[1] = 
    982985                               SPCS_CLKACCY_1000PPM | SPCS_SAMPLERATE_48 |
    983986                               SPCS_CHANNELNUM_LEFT | SPCS_SOURCENUM_UNSPEC |
     
    985988                               0x00000000 | SPCS_EMPHASIS_NONE | SPCS_COPYRIGHT);
    986989        snd_emu10k1x_ptr_write(chip, SPCS2, 0,
    987                                chip->spdif_bits[2] =
     990                               chip->spdif_bits[2] = 
    988991                               SPCS_CLKACCY_1000PPM | SPCS_SAMPLERATE_48 |
    989992                               SPCS_CHANNELNUM_LEFT | SPCS_SOURCENUM_UNSPEC |
     
    10061009}
    10071010
    1008 static void snd_emu10k1x_proc_reg_read(struct snd_info_entry *entry,
     1011static void snd_emu10k1x_proc_reg_read(struct snd_info_entry *entry, 
    10091012                                       struct snd_info_buffer *buffer)
    10101013{
     
    10341037}
    10351038
    1036 static void snd_emu10k1x_proc_reg_write(struct snd_info_entry *entry,
     1039static void snd_emu10k1x_proc_reg_write(struct snd_info_entry *entry, 
    10371040                                        struct snd_info_buffer *buffer)
    10381041{
     
    10451048                        continue;
    10461049
    1047                 if (reg < 0x49 && /* val <= 0xffffffff && DAZ */ channel_id <= 2)
     1050                if (reg < 0x49 && channel_id <= 2)
    10481051                        snd_emu10k1x_ptr_write(emu, reg, channel_id, val);
    10491052        }
    10501053}
    10511054
    1052 static int __devinit snd_emu10k1x_proc_init(struct emu10k1x * emu)
    1053 {
    1054         struct snd_info_entry *entry;
    1055        
    1056         if(! snd_card_proc_new(emu->card, "emu10k1x_regs", &entry)) {
    1057                 snd_info_set_text_ops(entry, emu, snd_emu10k1x_proc_reg_read);
    1058                 entry->c.text.write = snd_emu10k1x_proc_reg_write;
    1059                 entry->mode |= S_IWUSR;
    1060                 entry->private_data = emu;
    1061         }
    1062        
     1055static int snd_emu10k1x_proc_init(struct emu10k1x *emu)
     1056{
     1057        snd_card_rw_proc_new(emu->card, "emu10k1x_regs", emu,
     1058                             snd_emu10k1x_proc_reg_read,
     1059                             snd_emu10k1x_proc_reg_write);
    10631060        return 0;
    10641061}
     
    10811078        struct emu10k1x *emu = snd_kcontrol_chip(kcontrol);
    10821079        unsigned int val;
    1083         int change = 0;
    10841080
    10851081        val = ucontrol->value.integer.value[0] ;
     
    10961092                snd_emu10k1x_gpio_write(emu, 0x1080);
    10971093        }
    1098         return change;
    1099 }
    1100 
    1101 static struct snd_kcontrol_new snd_emu10k1x_shared_spdif __devinitdata =
     1094        return 0;
     1095}
     1096
     1097static const struct snd_kcontrol_new snd_emu10k1x_shared_spdif =
    11021098{
    11031099        .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
     
    11581154}
    11591155
    1160 static struct snd_kcontrol_new snd_emu10k1x_spdif_mask_control =
     1156static const struct snd_kcontrol_new snd_emu10k1x_spdif_mask_control =
    11611157{
    11621158        .access =       SNDRV_CTL_ELEM_ACCESS_READ,
     
    11681164};
    11691165
    1170 static struct snd_kcontrol_new snd_emu10k1x_spdif_control =
     1166static const struct snd_kcontrol_new snd_emu10k1x_spdif_control =
    11711167{
    11721168        .iface =        SNDRV_CTL_ELEM_IFACE_PCM,
     
    11781174};
    11791175
    1180 static int __devinit snd_emu10k1x_mixer(struct emu10k1x *emu)
     1176static int snd_emu10k1x_mixer(struct emu10k1x *emu)
    11811177{
    11821178        int err;
     
    12321228#ifdef CONFIG_SND_DEBUG
    12331229        if (timeout <= 0)
    1234                 snd_printk(KERN_ERR "cmd: clear rx timeout (status = 0x%x)\n", mpu401_read_stat(emu, mpu));
     1230                dev_err(emu->card->dev,
     1231                        "cmd: clear rx timeout (status = 0x%x)\n",
     1232                        mpu401_read_stat(emu, mpu));
    12351233#endif
    12361234}
     
    13061304        spin_unlock_irqrestore(&midi->input_lock, flags);
    13071305        if (!ok) {
    1308                 snd_printk(KERN_ERR "midi_cmd: 0x%x failed at 0x%lx (status = 0x%x, data = 0x%x)!!!\n",
     1306                dev_err(emu->card->dev,
     1307                        "midi_cmd: 0x%x failed at 0x%lx (status = 0x%x, data = 0x%x)!!!\n",
    13091308                           cmd, emu->port,
    13101309                           mpu401_read_stat(emu, midi),
     
    14701469 */
    14711470
    1472 static struct snd_rawmidi_ops snd_emu10k1x_midi_output =
     1471static const struct snd_rawmidi_ops snd_emu10k1x_midi_output =
    14731472{
    14741473        .open =         snd_emu10k1x_midi_output_open,
     
    14771476};
    14781477
    1479 static struct snd_rawmidi_ops snd_emu10k1x_midi_input =
     1478static const struct snd_rawmidi_ops snd_emu10k1x_midi_input =
    14801479{
    14811480        .open =         snd_emu10k1x_midi_input_open,
     
    14911490}
    14921491
    1493 static int __devinit emu10k1x_midi_init(struct emu10k1x *emu,
    1494                                         struct emu10k1x_midi *midi, int device, char *name)
     1492static int emu10k1x_midi_init(struct emu10k1x *emu,
     1493                              struct emu10k1x_midi *midi, int device,
     1494                              char *name)
    14951495{
    14961496        struct snd_rawmidi *rmidi;
     
    15151515}
    15161516
    1517 static int __devinit snd_emu10k1x_midi(struct emu10k1x *emu)
     1517static int snd_emu10k1x_midi(struct emu10k1x *emu)
    15181518{
    15191519        struct emu10k1x_midi *midi = &emu->midi;
     
    15321532}
    15331533
    1534 static int __devinit snd_emu10k1x_probe(struct pci_dev *pci,
    1535                                         const struct pci_device_id *pci_id)
     1534static int snd_emu10k1x_probe(struct pci_dev *pci,
     1535                              const struct pci_device_id *pci_id)
    15361536{
    15371537        static int dev;
     
    15471547        }
    15481548
    1549         err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
     1549        err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
     1550                           0, &card);
    15501551        if (err < 0)
    15511552                return err;
     
    15561557        }
    15571558
    1558         if ((err = snd_emu10k1x_pcm(chip, 0, NULL)) < 0) {
     1559        if ((err = snd_emu10k1x_pcm(chip, 0)) < 0) {
    15591560                snd_card_free(card);
    15601561                return err;
    15611562        }
    1562         if ((err = snd_emu10k1x_pcm(chip, 1, NULL)) < 0) {
     1563        if ((err = snd_emu10k1x_pcm(chip, 1)) < 0) {
    15631564                snd_card_free(card);
    15641565                return err;
    15651566        }
    1566         if ((err = snd_emu10k1x_pcm(chip, 2, NULL)) < 0) {
     1567        if ((err = snd_emu10k1x_pcm(chip, 2)) < 0) {
    15671568                snd_card_free(card);
    15681569                return err;
     
    15911592                card->shortname, chip->port, chip->irq);
    15921593
    1593         snd_card_set_dev(card, &pci->dev);
    1594 
    15951594        if ((err = snd_card_register(card)) < 0) {
    15961595                snd_card_free(card);
     
    16031602}
    16041603
    1605 static void __devexit snd_emu10k1x_remove(struct pci_dev *pci)
     1604static void snd_emu10k1x_remove(struct pci_dev *pci)
    16061605{
    16071606        snd_card_free(pci_get_drvdata(pci));
    1608         pci_set_drvdata(pci, NULL);
    16091607}
    16101608
    16111609// PCI IDs
    1612 static DEFINE_PCI_DEVICE_TABLE(snd_emu10k1x_ids) = {
     1610static const struct pci_device_id snd_emu10k1x_ids[] = {
    16131611        { PCI_VDEVICE(CREATIVE, 0x0006), 0 },   /* Dell OEM version (EMU10K1) */
    16141612        { 0, }
     
    16171615
    16181616// pci_driver definition
    1619 static struct pci_driver driver = {
    1620         .name = "EMU10K1X",
     1617static struct pci_driver emu10k1x_driver = {
     1618        .name = KBUILD_MODNAME,
    16211619        .id_table = snd_emu10k1x_ids,
    16221620        .probe = snd_emu10k1x_probe,
    1623         .remove = __devexit_p(snd_emu10k1x_remove),
     1621        .remove = snd_emu10k1x_remove,
    16241622};
    16251623
    1626 // initialization of the module
    1627 static int __init alsa_card_emu10k1x_init(void)
    1628 {
    1629         return pci_register_driver(&driver);
    1630 }
    1631 
    1632 // clean up the module
    1633 static void __exit alsa_card_emu10k1x_exit(void)
    1634 {
    1635         pci_unregister_driver(&driver);
    1636 }
    1637 
    1638 module_init(alsa_card_emu10k1x_init)
    1639 module_exit(alsa_card_emu10k1x_exit)
     1624module_pci_driver(emu10k1x_driver);
Note: See TracChangeset for help on using the changeset viewer.