Ignore:
Timestamp:
Jan 1, 2021, 5:31:48 AM (5 years ago)
Author:
Paul Smedley
Message:

Add source for uniaud32 based on code from linux kernel 5.4.86

Location:
GPL/branches/uniaud32-next
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • GPL/branches/uniaud32-next/alsa-kernel/pci/maestro3.c

    r612 r615  
     1// SPDX-License-Identifier: GPL-2.0-or-later
    12/*
    23 * Driver for ESS Maestro3/Allegro (ES1988) soundcards.
     
    78 * OSS/Free by Zach Brown.  Many thanks to Zach!
    89 *
    9  *   This program is free software; you can redistribute it and/or modify
    10  *   it under the terms of the GNU General Public License as published by
    11  *   the Free Software Foundation; either version 2 of the License, or
    12  *   (at your option) any later version.
    13  *
    14  *   This program is distributed in the hope that it will be useful,
    15  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
    16  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    17  *   GNU General Public License for more details.
    18  *
    19  *   You should have received a copy of the GNU General Public License
    20  *   along with this program; if not, write to the Free Software
    21  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    22  *
    23  *
    2410 * ChangeLog:
    2511 * Aug. 27, 2001
    2612 *     - Fixed deadlock on capture
    2713 *     - Added Canyon3D-2 support by Rob Riggs <rob@pangalactic.org>
    28  *
    2914 */
    3015 
     
    3520#endif
    3621
    37 #include <asm/io.h>
     22#include <linux/io.h>
    3823#include <linux/delay.h>
    3924#include <linux/interrupt.h>
     
    6853static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;      /* Index 0-MAX */
    6954static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;       /* ID for this card */
    70 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* all enabled */
     55static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* all enabled */
    7156#ifndef TARGET_OS2
    72 static int external_amp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
     57static bool external_amp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
    7358static int amp_gpio[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -1};
    7459#else
     
    369354#define DSP2HOST_REQ_TIMER      0x04
    370355
    371 /* AC97 registers */
    372 /* XXX fix this crap up */
    373 /*#define AC97_RESET              0x00*/
    374 
    375 #define AC97_VOL_MUTE_B         0x8000
    376 #define AC97_VOL_M              0x1F
    377 #define AC97_LEFT_VOL_S         8
    378 
    379 #define AC97_MASTER_VOL         0x02
    380 #define AC97_LINE_LEVEL_VOL     0x04
    381 #define AC97_MASTER_MONO_VOL    0x06
    382 #define AC97_PC_BEEP_VOL        0x0A
    383 #define AC97_PC_BEEP_VOL_M      0x0F
    384 #define AC97_SROUND_MASTER_VOL  0x38
    385 #define AC97_PC_BEEP_VOL_S      1
    386 
    387 /*#define AC97_PHONE_VOL          0x0C
    388 #define AC97_MIC_VOL            0x0E*/
    389 #define AC97_MIC_20DB_ENABLE    0x40
    390 
    391 /*#define AC97_LINEIN_VOL         0x10
    392 #define AC97_CD_VOL             0x12
    393 #define AC97_VIDEO_VOL          0x14
    394 #define AC97_AUX_VOL            0x16*/
    395 #define AC97_PCM_OUT_VOL        0x18
    396 /*#define AC97_RECORD_SELECT      0x1A*/
    397 #define AC97_RECORD_MIC         0x00
    398 #define AC97_RECORD_CD          0x01
    399 #define AC97_RECORD_VIDEO       0x02
    400 #define AC97_RECORD_AUX         0x03
    401 #define AC97_RECORD_MONO_MUX    0x02
    402 #define AC97_RECORD_DIGITAL     0x03
    403 #define AC97_RECORD_LINE        0x04
    404 #define AC97_RECORD_STEREO      0x05
    405 #define AC97_RECORD_MONO        0x06
    406 #define AC97_RECORD_PHONE       0x07
    407 
    408 /*#define AC97_RECORD_GAIN        0x1C*/
    409 #define AC97_RECORD_VOL_M       0x0F
    410 
    411 /*#define AC97_GENERAL_PURPOSE    0x20*/
    412 #define AC97_POWER_DOWN_CTRL    0x26
    413 #define AC97_ADC_READY          0x0001
    414 #define AC97_DAC_READY          0x0002
    415 #define AC97_ANALOG_READY       0x0004
    416 #define AC97_VREF_ON            0x0008
    417 #define AC97_PR0                0x0100
    418 #define AC97_PR1                0x0200
    419 #define AC97_PR2                0x0400
    420 #define AC97_PR3                0x0800
    421 #define AC97_PR4                0x1000
    422 
    423 #define AC97_RESERVED1          0x28
    424 
    425 #define AC97_VENDOR_TEST        0x5A
    426 
    427 #define AC97_CLOCK_DELAY        0x5C
    428 #define AC97_LINEOUT_MUX_SEL    0x0001
    429 #define AC97_MONO_MUX_SEL       0x0002
    430 #define AC97_CLOCK_DELAY_SEL    0x1F
    431 #define AC97_DAC_CDS_SHIFT      6
    432 #define AC97_ADC_CDS_SHIFT      11
    433 
    434 #define AC97_MULTI_CHANNEL_SEL  0x74
    435 
    436 /*#define AC97_VENDOR_ID1         0x7C
    437 #define AC97_VENDOR_ID2         0x7E*/
    438 
    439356/*
    440357 * ASSP control regs
     
    865782        unsigned int in_suspend;
    866783
    867 #ifdef CONFIG_PM
     784#ifdef CONFIG_PM_SLEEP
    868785        u16 *suspend_mem;
    869786#endif
     
    876793 * pci ids
    877794 */
    878 static DEFINE_PCI_DEVICE_TABLE(snd_m3_ids) = {
     795static const struct pci_device_id snd_m3_ids[] = {
    879796        {PCI_VENDOR_ID_ESS, PCI_DEVICE_ID_ESS_ALLEGRO_1, PCI_ANY_ID, PCI_ANY_ID,
    880797         PCI_CLASS_MULTIMEDIA_AUDIO << 8, 0xffff00, 0},
     
    898815MODULE_DEVICE_TABLE(pci, snd_m3_ids);
    899816
    900 static struct snd_pci_quirk m3_amp_quirk_list[] __devinitdata = {
     817static struct snd_pci_quirk m3_amp_quirk_list[] = {
    901818        SND_PCI_QUIRK(0x0E11, 0x0094, "Compaq Evo N600c", 0x0c),
    902819        SND_PCI_QUIRK(0x10f7, 0x833e, "Panasonic CF-28", 0x0d),
     
    907824};
    908825
    909 static struct snd_pci_quirk m3_irda_quirk_list[] __devinitdata = {
     826static struct snd_pci_quirk m3_irda_quirk_list[] = {
    910827        SND_PCI_QUIRK(0x1028, 0x00b0, "Dell Inspiron 4000", 1),
    911828        SND_PCI_QUIRK(0x1028, 0x00a4, "Dell Inspiron 8000", 1),
     
    915832
    916833/* hardware volume quirks */
    917 static struct snd_pci_quirk m3_hv_quirk_list[] __devinitdata = {
     834static struct snd_pci_quirk m3_hv_quirk_list[] = {
    918835        /* Allegro chips */
    919836        SND_PCI_QUIRK(0x0E11, 0x002E, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD),
     
    993910
    994911/* HP Omnibook quirks */
    995 static struct snd_pci_quirk m3_omnibook_quirk_list[] __devinitdata = {
     912static struct snd_pci_quirk m3_omnibook_quirk_list[] = {
    996913        SND_PCI_QUIRK_ID(0x103c, 0x0010), /* HP OmniBook 6000 */
    997914        SND_PCI_QUIRK_ID(0x103c, 0x0011), /* HP OmniBook 500 */
     
    14791396        s->buffer_addr = substream->runtime->dma_addr;
    14801397        if (s->buffer_addr & 0x3) {
    1481                 snd_printk(KERN_ERR "oh my, not aligned\n");
     1398                dev_err(substream->pcm->card->dev, "oh my, not aligned\n");
    14821399                s->buffer_addr = s->buffer_addr & ~0x3;
    14831400        }
     
    17571674 */
    17581675
    1759 static struct snd_pcm_hardware snd_m3_playback =
     1676static const struct snd_pcm_hardware snd_m3_playback =
    17601677{
    17611678        .info =                 (SNDRV_PCM_INFO_MMAP |
     
    17781695};
    17791696
    1780 static struct snd_pcm_hardware snd_m3_capture =
     1697static const struct snd_pcm_hardware snd_m3_capture =
    17811698{
    17821699        .info =                 (SNDRV_PCM_INFO_MMAP |
     
    19101827 */
    19111828
    1912 static struct snd_pcm_ops snd_m3_playback_ops = {
     1829static const struct snd_pcm_ops snd_m3_playback_ops = {
    19131830        .open =         snd_m3_playback_open,
    19141831        .close =        snd_m3_playback_close,
     
    19211838};
    19221839
    1923 static struct snd_pcm_ops snd_m3_capture_ops = {
     1840static const struct snd_pcm_ops snd_m3_capture_ops = {
    19241841        .open =         snd_m3_capture_open,
    19251842        .close =        snd_m3_capture_close,
     
    19321849};
    19331850
    1934 static int __devinit
     1851static int
    19351852snd_m3_pcm(struct snd_m3 * chip, int device)
    19361853{
     
    19761893        } while (i-- > 0);
    19771894
    1978         snd_printk(KERN_ERR "ac97 serial bus busy\n");
     1895        dev_err(chip->card->dev, "ac97 serial bus busy\n");
    19791896        return 1;
    19801897}
     
    20051922        snd_m3_outw(chip, val, CODEC_DATA);
    20061923        snd_m3_outb(chip, reg & 0x7f, CODEC_COMMAND);
    2007 }
    2008 
    2009 
    2010 static void snd_m3_remote_codec_config(int io, int isremote)
    2011 {
     1924        /*
     1925         * Workaround for buggy ES1988 integrated AC'97 codec. It remains silent
     1926         * until the MASTER volume or mute is touched (alsactl restore does not
     1927         * work).
     1928         */
     1929        if (ac97->id == 0x45838308 && reg == AC97_MASTER) {
     1930                snd_m3_ac97_wait(chip);
     1931                snd_m3_outw(chip, val, CODEC_DATA);
     1932                snd_m3_outb(chip, reg & 0x7f, CODEC_COMMAND);
     1933        }
     1934}
     1935
     1936
     1937static void snd_m3_remote_codec_config(struct snd_m3 *chip, int isremote)
     1938{
     1939        int io = chip->iobase;
     1940        u16 tmp;
     1941
    20121942        isremote = isremote ? 1 : 0;
    20131943
    2014         outw((inw(io + RING_BUS_CTRL_B) & ~SECOND_CODEC_ID_MASK) | isremote,
    2015              io + RING_BUS_CTRL_B);
     1944        tmp = inw(io + RING_BUS_CTRL_B) & ~SECOND_CODEC_ID_MASK;
     1945        /* enable dock on Dell Latitude C810 */
     1946        if (chip->pci->subsystem_vendor == 0x1028 &&
     1947            chip->pci->subsystem_device == 0x00e5)
     1948                tmp |= M3I_DOCK_ENABLE;
     1949        outw(tmp | isremote, io + RING_BUS_CTRL_B);
    20161950        outw((inw(io + SDO_OUT_DEST_CTRL) & ~COMMAND_ADDR_OUT) | isremote,
    20171951             io + SDO_OUT_DEST_CTRL);
     
    20651999                        dir |= 0x10; /* assuming pci bus master? */
    20662000
    2067                 snd_m3_remote_codec_config(io, 0);
     2001                snd_m3_remote_codec_config(chip, 0);
    20682002
    20692003                outw(IO_SRAM_ENABLE, io + RING_BUS_CTRL_A);
     
    20912025                delay2 += 100;
    20922026
    2093                 snd_printd("maestro3: retrying codec reset with delays of %d and %d ms\n",
     2027                dev_dbg(chip->card->dev,
     2028                        "retrying codec reset with delays of %d and %d ms\n",
    20942029                           delay1, delay2);
    20952030        }
     
    21072042}
    21082043
    2109 static int __devinit snd_m3_mixer(struct snd_m3 *chip)
     2044static int snd_m3_mixer(struct snd_m3 *chip)
    21102045{
    21112046        struct snd_ac97_bus *pbus;
     
    21612096{
    21622097        unsigned int i;
    2163         const u16 *data;
     2098        const __le16 *data;
    21642099
    21652100        /* zero kernel data */
     
    21792114
    21802115        /* write kernel into code memory.. */
    2181         data = (const u16 *)chip->assp_kernel_image->data;
     2116        data = (const __le16 *)chip->assp_kernel_image->data;
    21822117        for (i = 0 ; i * 2 < chip->assp_kernel_image->size; i++) {
    21832118                snd_m3_assp_write(chip, MEMTYPE_INTERNAL_CODE,
     
    21922127         * need vectors, so we won't bother with them..
    21932128         */
    2194         data = (const u16 *)chip->assp_minisrc_image->data;
     2129        data = (const __le16 *)chip->assp_minisrc_image->data;
    21952130        for (i = 0; i * 2 < chip->assp_minisrc_image->size; i++) {
    21962131                snd_m3_assp_write(chip, MEMTYPE_INTERNAL_CODE,
     
    22492184
    22502185
    2251 static int __devinit snd_m3_assp_client_init(struct snd_m3 *chip, struct m3_dma *s, int index)
     2186static int snd_m3_assp_client_init(struct snd_m3 *chip, struct m3_dma *s, int index)
    22522187{
    22532188        int data_bytes = 2 * ( MINISRC_TMP_BUFFER_SIZE / 2 +
     
    22702205
    22712206        if ((address + (data_bytes/2)) >= 0x1c00) {
    2272                 snd_printk(KERN_ERR "no memory for %d bytes at ind %d (addr 0x%x)\n",
     2207                dev_err(chip->card->dev,
     2208                        "no memory for %d bytes at ind %d (addr 0x%x)\n",
    22732209                           data_bytes, index, address);
    22742210                return -ENOMEM;
     
    24442380        }
    24452381
    2446 #ifdef CONFIG_PM
     2382#ifdef CONFIG_PM_SLEEP
    24472383        vfree(chip->suspend_mem);
    24482384#endif
     
    24662402 * APM support
    24672403 */
    2468 #ifdef CONFIG_PM
    2469 static int m3_suspend(struct pci_dev *pci, pm_message_t state)
    2470 {
    2471         struct snd_card *card = pci_get_drvdata(pci);
     2404#ifdef CONFIG_PM_SLEEP
     2405static int m3_suspend(struct device *dev)
     2406{
     2407        struct snd_card *card = dev_get_drvdata(dev);
    24722408        struct snd_m3 *chip = card->private_data;
    24732409        int i, dsp_index;
     
    24792415        cancel_work_sync(&chip->hwvol_work);
    24802416        snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
    2481         snd_pcm_suspend_all(chip->pcm);
    24822417        snd_ac97_suspend(chip->ac97);
    24832418
     
    24942429                chip->suspend_mem[dsp_index++] =
    24952430                        snd_m3_assp_read(chip, MEMTYPE_INTERNAL_DATA, i);
    2496 
    2497         pci_disable_device(pci);
    2498         pci_save_state(pci);
    2499         pci_set_power_state(pci, pci_choose_state(pci, state));
    25002431        return 0;
    25012432}
    25022433
    2503 static int m3_resume(struct pci_dev *pci)
    2504 {
    2505         struct snd_card *card = pci_get_drvdata(pci);
     2434static int m3_resume(struct device *dev)
     2435{
     2436        struct snd_card *card = dev_get_drvdata(dev);
    25062437        struct snd_m3 *chip = card->private_data;
    25072438        int i, dsp_index;
     
    25092440        if (chip->suspend_mem == NULL)
    25102441                return 0;
    2511 
    2512         pci_set_power_state(pci, PCI_D0);
    2513         pci_restore_state(pci);
    2514         if (pci_enable_device(pci) < 0) {
    2515                 printk(KERN_ERR "maestor3: pci_enable_device failed, "
    2516                        "disabling device\n");
    2517                 snd_card_disconnect(card);
    2518                 return -EIO;
    2519         }
    2520         pci_set_master(pci);
    25212442
    25222443        /* first lets just bring everything back. .*/
     
    25542475        return 0;
    25552476}
    2556 #endif /* CONFIG_PM */
     2477
     2478static SIMPLE_DEV_PM_OPS(m3_pm, m3_suspend, m3_resume);
     2479#define M3_PM_OPS       &m3_pm
     2480#else
     2481#define M3_PM_OPS       NULL
     2482#endif /* CONFIG_PM_SLEEP */
    25572483
    25582484#ifdef CONFIG_SND_MAESTRO3_INPUT
    2559 static int __devinit snd_m3_input_register(struct snd_m3 *chip)
     2485static int snd_m3_input_register(struct snd_m3 *chip)
    25602486{
    25612487        struct input_dev *input_dev;
     
    26012527}
    26022528
    2603 static int __devinit
     2529static int
    26042530snd_m3_create(struct snd_card *card, struct pci_dev *pci,
    26052531              int enable_amp,
     
    26202546
    26212547        /* check, if we can restrict PCI DMA transfers to 28 bits */
    2622         if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 ||
    2623             pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) {
    2624                 snd_printk(KERN_ERR "architecture does not support 28bit PCI busmaster DMA\n");
     2548        if (dma_set_mask(&pci->dev, DMA_BIT_MASK(28)) < 0 ||
     2549            dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(28)) < 0) {
     2550                dev_err(card->dev,
     2551                        "architecture does not support 28bit PCI busmaster DMA\n");
    26252552                pci_disable_device(pci);
    26262553                return -ENXIO;
     
    26562583                if (quirk) {
    26572584#ifndef TARGET_OS2
    2658                         snd_printdd(KERN_INFO "maestro3: set amp-gpio "
    2659                                     "for '%s'\n", quirk->name);
     2585                        dev_info(card->dev, "set amp-gpio for '%s'\n",
     2586                                 snd_pci_quirk_name(quirk));
    26602587#endif
    26612588                        chip->amp_gpio = quirk->value;
     
    26692596        if (quirk) {
    26702597#ifndef TARGET_OS2
    2671                 snd_printdd(KERN_INFO "maestro3: enabled irda workaround "
    2672                             "for '%s'\n", quirk->name);
     2598                dev_info(card->dev, "enabled irda workaround for '%s'\n",
     2599                         snd_pci_quirk_name(quirk));
    26732600#endif
    26742601                chip->irda_workaround = 1;
     
    26912618        err = request_firmware(&chip->assp_kernel_image,
    26922619                               "ess/maestro3_assp_kernel.fw", &pci->dev);
    2693         if (err < 0) {
    2694                 snd_m3_free(chip);
    2695                 return err;
    2696         }
     2620        if (err < 0)
     2621                goto free_chip;
    26972622
    26982623        err = request_firmware(&chip->assp_minisrc_image,
    26992624                               "ess/maestro3_assp_minisrc.fw", &pci->dev);
    2700         if (err < 0) {
    2701                 snd_m3_free(chip);
    2702                 return err;
    2703         }
    2704 
    2705         if ((err = pci_request_regions(pci, card->driver)) < 0) {
    2706                 snd_m3_free(chip);
    2707                 return err;
    2708         }
     2625        if (err < 0)
     2626                goto free_chip;
     2627
     2628        err = pci_request_regions(pci, card->driver);
     2629        if (err < 0)
     2630                goto free_chip;
     2631
    27092632        chip->iobase = pci_resource_start(pci, 0);
    27102633       
     
    27232646        if (request_irq(pci->irq, snd_m3_interrupt, IRQF_SHARED,
    27242647                        KBUILD_MODNAME, chip)) {
    2725                 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
    2726                 snd_m3_free(chip);
    2727                 return -ENOMEM;
     2648                dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
     2649                err = -ENOMEM;
     2650                goto free_chip;
    27282651        }
    27292652        chip->irq = pci->irq;
    27302653
    2731 #ifdef CONFIG_PM
     2654#ifdef CONFIG_PM_SLEEP
     2655#ifndef TARGET_OS2
     2656        chip->suspend_mem =
     2657                vmalloc(array_size(sizeof(u16),
     2658                                   REV_B_CODE_MEMORY_LENGTH +
     2659                                        REV_B_DATA_MEMORY_LENGTH));
     2660#else
    27322661        chip->suspend_mem = vmalloc(sizeof(u16) * (REV_B_CODE_MEMORY_LENGTH + REV_B_DATA_MEMORY_LENGTH));
     2662#endif
    27332663        if (chip->suspend_mem == NULL)
    2734                 snd_printk(KERN_WARNING "can't allocate apm buffer\n");
     2664                dev_warn(card->dev, "can't allocate apm buffer\n");
    27352665#endif
    27362666
    2737         if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
    2738                 snd_m3_free(chip);
    2739                 return err;
    2740         }
     2667        err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
     2668        if (err < 0)
     2669                goto free_chip;
    27412670
    27422671        if ((err = snd_m3_mixer(chip)) < 0)
     
    27562685                err = snd_m3_input_register(chip);
    27572686                if (err)
    2758                         snd_printk(KERN_WARNING "Input device registration "
    2759                                 "failed with error %i", err);
     2687                        dev_warn(card->dev,
     2688                                 "Input device registration failed with error %i",
     2689                                 err);
    27602690        }
    27612691#endif
     
    27642694        snd_m3_assp_continue(chip);
    27652695
    2766         snd_card_set_dev(card, &pci->dev);
    2767 
    27682696        *chip_ret = chip;
    27692697
    27702698        return 0;
     2699
     2700free_chip:
     2701        snd_m3_free(chip);
     2702        return err;
    27712703}
    27722704
    27732705/*
    27742706 */
    2775 static int __devinit
     2707static int
    27762708snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
    27772709{
     
    27932725        }
    27942726
    2795         err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
     2727        err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
     2728                           0, &card);
    27962729        if (err < 0)
    27972730                return err;
     
    28112744        }
    28122745
    2813         if ((err = snd_m3_create(card, pci,
    2814                                  external_amp[dev],
    2815                                  amp_gpio[dev],
    2816                                  &chip)) < 0) {
    2817                 snd_card_free(card);
    2818                 return err;
    2819         }
     2746        err = snd_m3_create(card, pci, external_amp[dev], amp_gpio[dev], &chip);
     2747        if (err < 0)
     2748                goto free_card;
     2749
    28202750        card->private_data = chip;
    28212751
     
    28242754                card->shortname, chip->iobase, chip->irq);
    28252755
    2826         if ((err = snd_card_register(card)) < 0) {
    2827                 snd_card_free(card);
    2828                 return err;
    2829         }
     2756        err = snd_card_register(card);
     2757        if (err < 0)
     2758                goto free_card;
    28302759
    28312760#if 0 /* TODO: not supported yet */
     
    28362765                                  -1, &chip->rmidi);
    28372766        if (err < 0)
    2838                 printk(KERN_WARNING "maestro3: no MIDI support.\n");
     2767                dev_warn(card->dev, "no MIDI support.\n");
    28392768#endif
    28402769
     
    28422771        dev++;
    28432772        return 0;
    2844 }
    2845 
    2846 static void __devexit snd_m3_remove(struct pci_dev *pci)
     2773
     2774free_card:
     2775        snd_card_free(card);
     2776        return err;
     2777}
     2778
     2779static void snd_m3_remove(struct pci_dev *pci)
    28472780{
    28482781        snd_card_free(pci_get_drvdata(pci));
    2849         pci_set_drvdata(pci, NULL);
    2850 }
    2851 
    2852 static struct pci_driver driver = {
     2782}
     2783
     2784static struct pci_driver m3_driver = {
    28532785        .name = KBUILD_MODNAME,
    28542786        .id_table = snd_m3_ids,
    28552787        .probe = snd_m3_probe,
    2856         .remove = __devexit_p(snd_m3_remove),
    2857 #ifdef CONFIG_PM
    2858         .suspend = m3_suspend,
    2859         .resume = m3_resume,
    2860 #endif
     2788        .remove = snd_m3_remove,
     2789        .driver = {
     2790                .pm = M3_PM_OPS,
     2791        },
    28612792};
    28622793       
    2863 static int __init alsa_card_m3_init(void)
    2864 {
    2865         return pci_register_driver(&driver);
    2866 }
    2867 
    2868 static void __exit alsa_card_m3_exit(void)
    2869 {
    2870         pci_unregister_driver(&driver);
    2871 }
    2872 
    2873 module_init(alsa_card_m3_init)
    2874 module_exit(alsa_card_m3_exit)
     2794module_pci_driver(m3_driver);
Note: See TracChangeset for help on using the changeset viewer.