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/atiixp.c

    r598 r679  
     1// SPDX-License-Identifier: GPL-2.0-or-later
    12/*
    23 *   ALSA driver for ATI IXP 150/200/250/300 AC97 controllers
    34 *
    45 *      Copyright (c) 2004 Takashi Iwai <tiwai@suse.de>
    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  *
    20  */
    21 
    22 #include <asm/io.h>
     6 */
     7
     8#include <linux/io.h>
    239#include <linux/delay.h>
    2410#include <linux/interrupt.h>
     
    2612#include <linux/pci.h>
    2713#include <linux/slab.h>
    28 #include <linux/moduleparam.h>
     14#include <linux/module.h>
    2915#include <linux/mutex.h>
    3016#include <sound/core.h>
     
    3521#include <sound/initval.h>
    3622
     23#ifdef TARGET_OS2
     24#define KBUILD_MODNAME "atiixp"
     25#endif
     26
    3727MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>");
    3828MODULE_DESCRIPTION("ATI IXP AC97 controller");
     
    4434static int ac97_clock = 48000;
    4535static char *ac97_quirk;
    46 static int spdif_aclink = 1;
     36static bool spdif_aclink = 1;
    4737static int ac97_codec = -1;
    4838
     
    6151
    6252/* just for backward compatibility */
    63 //static int enable;
     53//static bool enable;
    6454module_param(enable, bool, 0444);
    6555
     
    208198
    209199struct atiixp_dma_desc {
    210         u32 addr;       /* DMA buffer address */
     200        __le32 addr;    /* DMA buffer address */
    211201        u16 status;     /* status bits */
    212202        u16 size;       /* size of the packet in dwords */
    213         u32 next;       /* address of the next packet descriptor */
     203        __le32 next;    /* address of the next packet descriptor */
    214204};
    215205
     
    287277/*
    288278 */
    289 static DEFINE_PCI_DEVICE_TABLE(snd_atiixp_ids) = {
     279static const struct pci_device_id snd_atiixp_ids[] = {
    290280        { PCI_VDEVICE(ATI, 0x4341), 0 }, /* SB200 */
    291281        { PCI_VDEVICE(ATI, 0x4361), 0 }, /* SB300 */
     
    297287MODULE_DEVICE_TABLE(pci, snd_atiixp_ids);
    298288
    299 static struct snd_pci_quirk atiixp_quirks[] __devinitdata = {
     289static const struct snd_pci_quirk atiixp_quirks[] = {
    300290        SND_PCI_QUIRK(0x105b, 0x0c81, "Foxconn RC4107MA-RS2", 0),
    301291        SND_PCI_QUIRK(0x15bd, 0x3100, "DFI RS482", 0),
     
    352342 * a static RING of buffer descriptors is used.
    353343 *
    354  * the ring is built in this function, and is set up to the hardware.
     344 * the ring is built in this function, and is set up to the hardware. 
    355345 */
    356346static int atiixp_build_dma_packets(struct atiixp *chip, struct atiixp_dma *dma,
     
    368358        if (dma->desc_buf.area == NULL) {
    369359                if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV,
    370                                         snd_dma_pci_data(chip->pci),
     360                                        &chip->pci->dev,
    371361                                        ATI_DESC_LIST_SIZE,
    372362                                        &dma->desc_buf) < 0)
     
    436426        while (atiixp_read(chip, PHYS_OUT_ADDR) & ATI_REG_PHYS_OUT_ADDR_EN) {
    437427                if (! timeout--) {
    438                         snd_printk(KERN_WARNING "atiixp: codec acquire timeout\n");
     428                        dev_warn(chip->card->dev, "codec acquire timeout\n");
    439429                        return -EBUSY;
    440430                }
     
    467457        /* time out may happen during reset */
    468458        if (reg < 0x7c)
    469                 snd_printk(KERN_WARNING "atiixp: codec read timeout (reg %x)\n", reg);
     459                dev_warn(chip->card->dev, "codec read timeout (reg %x)\n", reg);
    470460        return 0xffff;
    471461}
     
    476466{
    477467        unsigned int data;
    478 
     468   
    479469        if (snd_atiixp_acquire_codec(chip) < 0)
    480470                return;
     
    491481        struct atiixp *chip = ac97->private_data;
    492482        return snd_atiixp_codec_read(chip, ac97->num, reg);
    493 
     483 
    494484}
    495485
     
    518508        udelay(10);
    519509        atiixp_update(chip, CMD, ATI_REG_CMD_AC_SOFT_RESET, 0);
    520 
     510   
    521511        timeout = 10;
    522512        while (! (atiixp_read(chip, CMD) & ATI_REG_CMD_ACLINK_ACTIVE)) {
     
    527517                mdelay(1);
    528518                atiixp_update(chip, CMD, ATI_REG_CMD_AC_RESET, ATI_REG_CMD_AC_RESET);
    529                 if (--timeout) {
    530                         snd_printk(KERN_ERR "atiixp: codec reset timeout\n");
     519                if (!--timeout) {
     520                        dev_err(chip->card->dev, "codec reset timeout\n");
    531521                        break;
    532522                }
     
    541531}
    542532
    543 #ifdef CONFIG_PM
     533#ifdef CONFIG_PM_SLEEP
    544534static int snd_atiixp_aclink_down(struct atiixp *chip)
    545535{
     
    567557#define CODEC_CHECK_BITS (ALL_CODEC_NOT_READY|ATI_REG_ISR_NEW_FRAME)
    568558
    569 static int __devinit ac97_probing_bugs(struct pci_dev *pci)
     559static int ac97_probing_bugs(struct pci_dev *pci)
    570560{
    571561        const struct snd_pci_quirk *q;
     
    573563        q = snd_pci_quirk_lookup(pci, atiixp_quirks);
    574564        if (q) {
    575 #ifndef TARGET_OS2
    576                 snd_printdd(KERN_INFO "Atiixp quirk for %s.  "
    577                             "Forcing codec %d\n", q->name, q->value);
    578 #endif
     565                dev_dbg(&pci->dev, "atiixp quirk for %s.  Forcing codec %d\n",
     566                        snd_pci_quirk_name(q), q->value);
     567
    579568                return q->value;
    580569        }
     
    583572}
    584573
    585 static int __devinit snd_atiixp_codec_detect(struct atiixp *chip)
     574static int snd_atiixp_codec_detect(struct atiixp *chip)
    586575{
    587576        int timeout;
     
    607596
    608597        if ((chip->codec_not_ready_bits & ALL_CODEC_NOT_READY) == ALL_CODEC_NOT_READY) {
    609                 snd_printk(KERN_ERR "atiixp: no codec detected!\n");
     598                dev_err(chip->card->dev, "no codec detected!\n");
    610599                return -ENXIO;
    611600        }
     
    683672                return bytes_to_frames(runtime, curptr);
    684673        }
    685         snd_printd("atiixp: invalid DMA pointer read 0x%x (buf=%x)\n",
     674        dev_dbg(chip->card->dev, "invalid DMA pointer read 0x%x (buf=%x)\n",
    686675                   readl(chip->remap_addr + dma->ops->dt_cur), dma->buf_addr);
    687676        return 0;
     
    695684        if (! dma->substream || ! dma->running)
    696685                return;
    697         snd_printdd("atiixp: XRUN detected (DMA %d)\n", dma->ops->type);
    698         snd_pcm_stop(dma->substream, SNDRV_PCM_STATE_XRUN);
     686        dev_dbg(chip->card->dev, "XRUN detected (DMA %d)\n", dma->ops->type);
     687        snd_pcm_stop_xrun(dma->substream);
    699688}
    700689
     
    741730        case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
    742731        case SNDRV_PCM_TRIGGER_RESUME:
     732                if (dma->running && dma->suspended &&
     733                    cmd == SNDRV_PCM_TRIGGER_RESUME)
     734                        writel(dma->saved_curptr, chip->remap_addr +
     735                               dma->ops->dt_cur);
    743736                dma->ops->enable_transfer(chip, 1);
    744737                dma->running = 1;
     
    748741        case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
    749742        case SNDRV_PCM_TRIGGER_SUSPEND:
     743                dma->suspended = cmd == SNDRV_PCM_TRIGGER_SUSPEND;
     744                if (dma->running && dma->suspended)
     745                        dma->saved_curptr = readl(chip->remap_addr +
     746                                                  dma->ops->dt_cur);
    750747                dma->ops->enable_transfer(chip, 0);
    751748                dma->running = 0;
    752                 dma->suspended = cmd == SNDRV_PCM_TRIGGER_SUSPEND;
    753749                break;
    754750        default:
     
    911907                data |= ATI_REG_OUT_DMA_SLOT_BIT(10) |
    912908                        ATI_REG_OUT_DMA_SLOT_BIT(11);
    913                 /* fallthru */
     909                fallthrough;
    914910        case 6:
    915911                data |= ATI_REG_OUT_DMA_SLOT_BIT(7) |
    916912                        ATI_REG_OUT_DMA_SLOT_BIT(8);
    917                 /* fallthru */
     913                fallthrough;
    918914        case 4:
    919915                data |= ATI_REG_OUT_DMA_SLOT_BIT(6) |
    920916                        ATI_REG_OUT_DMA_SLOT_BIT(9);
    921                 /* fallthru */
     917                fallthrough;
    922918        default:
    923919                data |= ATI_REG_OUT_DMA_SLOT_BIT(3) |
     
    939935        atiixp_update(chip, 6CH_REORDER, ATI_REG_6CH_REORDER_EN,
    940936                      substream->runtime->channels >= 6 ? ATI_REG_6CH_REORDER_EN: 0);
    941 
     937   
    942938        spin_unlock_irq(&chip->reg_lock);
    943939        return 0;
     
    967963        int err;
    968964
    969         err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
    970         if (err < 0)
    971                 return err;
    972965        dma->buf_addr = substream->runtime->dma_addr;
    973966        dma->buf_bytes = params_buffer_bytes(hw_params);
     
    10091002        }
    10101003        atiixp_clear_dma_packets(chip, dma, substream);
    1011         snd_pcm_lib_free_pages(substream);
    10121004        return 0;
    10131005}
     
    10171009 * pcm hardware definition, identical for all DMA types
    10181010 */
    1019 static struct snd_pcm_hardware snd_atiixp_pcm_hw =
     1011static const struct snd_pcm_hardware snd_atiixp_pcm_hw =
    10201012{
    10211013        .info =                 (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
     
    11561148
    11571149/* AC97 playback */
    1158 static struct snd_pcm_ops snd_atiixp_playback_ops = {
     1150static const struct snd_pcm_ops snd_atiixp_playback_ops = {
    11591151        .open =         snd_atiixp_playback_open,
    11601152        .close =        snd_atiixp_playback_close,
    1161         .ioctl =        snd_pcm_lib_ioctl,
    11621153        .hw_params =    snd_atiixp_pcm_hw_params,
    11631154        .hw_free =      snd_atiixp_pcm_hw_free,
     
    11681159
    11691160/* AC97 capture */
    1170 static struct snd_pcm_ops snd_atiixp_capture_ops = {
     1161static const struct snd_pcm_ops snd_atiixp_capture_ops = {
    11711162        .open =         snd_atiixp_capture_open,
    11721163        .close =        snd_atiixp_capture_close,
    1173         .ioctl =        snd_pcm_lib_ioctl,
    11741164        .hw_params =    snd_atiixp_pcm_hw_params,
    11751165        .hw_free =      snd_atiixp_pcm_hw_free,
     
    11801170
    11811171/* SPDIF playback */
    1182 static struct snd_pcm_ops snd_atiixp_spdif_ops = {
     1172static const struct snd_pcm_ops snd_atiixp_spdif_ops = {
    11831173        .open =         snd_atiixp_spdif_open,
    11841174        .close =        snd_atiixp_spdif_close,
    1185         .ioctl =        snd_pcm_lib_ioctl,
    11861175        .hw_params =    snd_atiixp_pcm_hw_params,
    11871176        .hw_free =      snd_atiixp_pcm_hw_free,
     
    11911180};
    11921181
    1193 static struct ac97_pcm atiixp_pcm_defs[] __devinitdata = {
     1182static const struct ac97_pcm atiixp_pcm_defs[] = {
    11941183        /* front PCM */
    11951184        {
     
    12271216};
    12281217
    1229 static struct atiixp_dma_ops snd_atiixp_playback_dma_ops = {
     1218static const struct atiixp_dma_ops snd_atiixp_playback_dma_ops = {
    12301219        .type = ATI_DMA_PLAYBACK,
    12311220        .llp_offset = ATI_REG_OUT_DMA_LINKPTR,
     
    12361225};
    12371226       
    1238 static struct atiixp_dma_ops snd_atiixp_capture_dma_ops = {
     1227static const struct atiixp_dma_ops snd_atiixp_capture_dma_ops = {
    12391228        .type = ATI_DMA_CAPTURE,
    12401229        .llp_offset = ATI_REG_IN_DMA_LINKPTR,
     
    12451234};
    12461235       
    1247 static struct atiixp_dma_ops snd_atiixp_spdif_dma_ops = {
     1236static const struct atiixp_dma_ops snd_atiixp_spdif_dma_ops = {
    12481237        .type = ATI_DMA_SPDIF,
    12491238        .llp_offset = ATI_REG_SPDF_DMA_LINKPTR,
     
    12551244       
    12561245
    1257 static int __devinit snd_atiixp_pcm_new(struct atiixp *chip)
     1246static int snd_atiixp_pcm_new(struct atiixp *chip)
    12581247{
    12591248        struct snd_pcm *pcm;
     1249        struct snd_pcm_chmap *chmap;
    12601250        struct snd_ac97_bus *pbus = chip->ac97_bus;
    12611251        int err, i, num_pcms;
     
    12971287        chip->pcmdevs[ATI_PCMDEV_ANALOG] = pcm;
    12981288
    1299         snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
    1300                                               snd_dma_pci_data(chip->pci),
    1301                                               64*1024, 128*1024);
     1289        snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
     1290                                       &chip->pci->dev, 64*1024, 128*1024);
     1291
     1292        err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK,
     1293                                     snd_pcm_alt_chmaps, chip->max_channels, 0,
     1294                                     &chmap);
     1295        if (err < 0)
     1296                return err;
     1297        chmap->channel_mask = SND_PCM_CHMAP_MASK_2468;
     1298        chip->ac97[0]->chmaps[SNDRV_PCM_STREAM_PLAYBACK] = chmap;
    13021299
    13031300        /* no SPDIF support on codec? */
     
    13221319        chip->pcmdevs[ATI_PCMDEV_DIGITAL] = pcm;
    13231320
    1324         snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
    1325                                               snd_dma_pci_data(chip->pci),
    1326                                               64*1024, 128*1024);
     1321        snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
     1322                                       &chip->pci->dev, 64*1024, 128*1024);
    13271323
    13281324        /* pre-select AC97 SPDIF slots 10/11 */
     
    13891385 */
    13901386
    1391 static struct ac97_quirk ac97_quirks[] __devinitdata = {
     1387static const struct ac97_quirk ac97_quirks[] = {
    13921388        {
    13931389                .subvendor = 0x103c,
     
    14111407};
    14121408
    1413 static int __devinit snd_atiixp_mixer_new(struct atiixp *chip, int clock,
    1414                                           const char *quirk_override)
     1409static int snd_atiixp_mixer_new(struct atiixp *chip, int clock,
     1410                                const char *quirk_override)
    14151411{
    14161412        struct snd_ac97_bus *pbus;
     
    14181414        int i, err;
    14191415        int codec_count;
    1420         static struct snd_ac97_bus_ops ops = {
     1416        static const struct snd_ac97_bus_ops ops = {
    14211417                .write = snd_atiixp_ac97_write,
    14221418                .read = snd_atiixp_ac97_read,
    14231419        };
    1424         static unsigned int codec_skip[NUM_ATI_CODECS] = {
     1420        static const unsigned int codec_skip[NUM_ATI_CODECS] = {
    14251421                ATI_REG_ISR_CODEC0_NOT_READY,
    14261422                ATI_REG_ISR_CODEC1_NOT_READY,
     
    14491445                if ((err = snd_ac97_mixer(pbus, &ac97, &chip->ac97[i])) < 0) {
    14501446                        chip->ac97[i] = NULL; /* to be sure */
    1451                         snd_printdd("atiixp: codec %d not available for audio\n", i);
     1447                        dev_dbg(chip->card->dev,
     1448                                "codec %d not available for audio\n", i);
    14521449                        continue;
    14531450                }
     
    14561453
    14571454        if (! codec_count) {
    1458                 snd_printk(KERN_ERR "atiixp: no codec available\n");
     1455                dev_err(chip->card->dev, "no codec available\n");
    14591456                return -ENODEV;
    14601457        }
     
    14661463
    14671464
    1468 #ifdef CONFIG_PM
     1465#ifdef CONFIG_PM_SLEEP
    14691466/*
    14701467 * power management
    14711468 */
    1472 static int snd_atiixp_suspend(struct pci_dev *pci, pm_message_t state)
    1473 {
    1474         struct snd_card *card = pci_get_drvdata(pci);
     1469static int snd_atiixp_suspend(struct device *dev)
     1470{
     1471        struct snd_card *card = dev_get_drvdata(dev);
    14751472        struct atiixp *chip = card->private_data;
    14761473        int i;
    14771474
    14781475        snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
    1479         for (i = 0; i < NUM_ATI_PCMDEVS; i++)
    1480                 if (chip->pcmdevs[i]) {
    1481                         struct atiixp_dma *dma = &chip->dmas[i];
    1482                         if (dma->substream && dma->running)
    1483                                 dma->saved_curptr = readl(chip->remap_addr +
    1484                                                           dma->ops->dt_cur);
    1485                         snd_pcm_suspend_all(chip->pcmdevs[i]);
    1486                 }
    14871476        for (i = 0; i < NUM_ATI_CODECS; i++)
    14881477                snd_ac97_suspend(chip->ac97[i]);
    14891478        snd_atiixp_aclink_down(chip);
    14901479        snd_atiixp_chip_stop(chip);
    1491 
    1492         pci_disable_device(pci);
    1493         pci_save_state(pci);
    1494         pci_set_power_state(pci, pci_choose_state(pci, state));
    1495         return 0;
    1496 }
    1497 
    1498 static int snd_atiixp_resume(struct pci_dev *pci)
    1499 {
    1500         struct snd_card *card = pci_get_drvdata(pci);
     1480        return 0;
     1481}
     1482
     1483static int snd_atiixp_resume(struct device *dev)
     1484{
     1485        struct snd_card *card = dev_get_drvdata(dev);
    15011486        struct atiixp *chip = card->private_data;
    15021487        int i;
    1503 
    1504         pci_set_power_state(pci, PCI_D0);
    1505         pci_restore_state(pci);
    1506         if (pci_enable_device(pci) < 0) {
    1507                 printk(KERN_ERR "atiixp: pci_enable_device failed, "
    1508                        "disabling device\n");
    1509                 snd_card_disconnect(card);
    1510                 return -EIO;
    1511         }
    1512         pci_set_master(pci);
    15131488
    15141489        snd_atiixp_aclink_reset(chip);
     
    15261501                                writel((u32)dma->desc_buf.addr | ATI_REG_LINKPTR_EN,
    15271502                                       chip->remap_addr + dma->ops->llp_offset);
    1528                                 writel(dma->saved_curptr, chip->remap_addr +
    1529                                        dma->ops->dt_cur);
    15301503                        }
    15311504                }
     
    15341507        return 0;
    15351508}
    1536 #endif /* CONFIG_PM */
    1537 
    1538 
    1539 #ifdef CONFIG_PROC_FS
     1509
     1510static SIMPLE_DEV_PM_OPS(snd_atiixp_pm, snd_atiixp_suspend, snd_atiixp_resume);
     1511#define SND_ATIIXP_PM_OPS       &snd_atiixp_pm
     1512#else
     1513#define SND_ATIIXP_PM_OPS       NULL
     1514#endif /* CONFIG_PM_SLEEP */
     1515
     1516
    15401517/*
    15411518 * proc interface for register dump
     
    15521529}
    15531530
    1554 static void __devinit snd_atiixp_proc_init(struct atiixp *chip)
    1555 {
    1556         struct snd_info_entry *entry;
    1557 
    1558         if (! snd_card_proc_new(chip->card, "atiixp", &entry))
    1559                 snd_info_set_text_ops(entry, chip, snd_atiixp_proc_read);
    1560 }
    1561 #else /* !CONFIG_PROC_FS */
    1562 #define snd_atiixp_proc_init(chip)
    1563 #endif
     1531static void snd_atiixp_proc_init(struct atiixp *chip)
     1532{
     1533        snd_card_ro_proc_new(chip->card, "atiixp", chip, snd_atiixp_proc_read);
     1534}
    15641535
    15651536
     
    15771548        if (chip->irq >= 0)
    15781549                free_irq(chip->irq, chip);
    1579         if (chip->remap_addr)
    1580                 iounmap(chip->remap_addr);
     1550        iounmap(chip->remap_addr);
    15811551        pci_release_regions(chip->pci);
    15821552        pci_disable_device(chip->pci);
     
    15941564 * constructor for chip instance
    15951565 */
    1596 static int __devinit snd_atiixp_create(struct snd_card *card,
    1597                                       struct pci_dev *pci,
    1598                                       struct atiixp **r_chip)
    1599 {
    1600         static struct snd_device_ops ops = {
     1566static int snd_atiixp_create(struct snd_card *card,
     1567                             struct pci_dev *pci,
     1568                             struct atiixp **r_chip)
     1569{
     1570        static const struct snd_device_ops ops = {
    16011571                .dev_free =     snd_atiixp_dev_free,
    16021572        };
     
    16261596        chip->remap_addr = pci_ioremap_bar(pci, 0);
    16271597        if (chip->remap_addr == NULL) {
    1628                 snd_printk(KERN_ERR "AC'97 space ioremap problem\n");
     1598                dev_err(card->dev, "AC'97 space ioremap problem\n");
    16291599                snd_atiixp_free(chip);
    16301600                return -EIO;
     
    16321602
    16331603        if (request_irq(pci->irq, snd_atiixp_interrupt, IRQF_SHARED,
    1634                         card->shortname, chip)) {
    1635                 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
     1604                        KBUILD_MODNAME, chip)) {
     1605                dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
    16361606                snd_atiixp_free(chip);
    16371607                return -EBUSY;
    16381608        }
    16391609        chip->irq = pci->irq;
     1610        card->sync_irq = chip->irq;
    16401611        pci_set_master(pci);
    1641         synchronize_irq(chip->irq);
    16421612
    16431613        if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
     
    16461616        }
    16471617
    1648         snd_card_set_dev(card, &pci->dev);
    1649 
    16501618        *r_chip = chip;
    16511619        return 0;
     
    16531621
    16541622
    1655 static int __devinit snd_atiixp_probe(struct pci_dev *pci,
    1656                                      const struct pci_device_id *pci_id)
     1623static int snd_atiixp_probe(struct pci_dev *pci,
     1624                            const struct pci_device_id *pci_id)
    16571625{
    16581626        struct snd_card *card;
     
    16601628        int err;
    16611629
    1662         err = snd_card_create(index, id, THIS_MODULE, 0, &card);
     1630        err = snd_card_new(&pci->dev, index, id, THIS_MODULE, 0, &card);
    16631631        if (err < 0)
    16641632                return err;
     
    17061674}
    17071675
    1708 static void __devexit snd_atiixp_remove(struct pci_dev *pci)
     1676static void snd_atiixp_remove(struct pci_dev *pci)
    17091677{
    17101678        snd_card_free(pci_get_drvdata(pci));
    1711         pci_set_drvdata(pci, NULL);
    1712 }
    1713 
    1714 static struct pci_driver driver = {
    1715         .name = "ATI IXP AC97 controller",
     1679}
     1680
     1681static struct pci_driver atiixp_driver = {
     1682        .name = KBUILD_MODNAME,
    17161683        .id_table = snd_atiixp_ids,
    17171684        .probe = snd_atiixp_probe,
    1718         .remove = __devexit_p(snd_atiixp_remove),
    1719 #ifdef CONFIG_PM
    1720         .suspend = snd_atiixp_suspend,
    1721         .resume = snd_atiixp_resume,
    1722 #endif
     1685        .remove = snd_atiixp_remove,
     1686        .driver = {
     1687                .pm = SND_ATIIXP_PM_OPS,
     1688        },
    17231689};
    17241690
    1725 
    1726 static int __init alsa_card_atiixp_init(void)
    1727 {
    1728         return pci_register_driver(&driver);
    1729 }
    1730 
    1731 static void __exit alsa_card_atiixp_exit(void)
    1732 {
    1733         pci_unregister_driver(&driver);
    1734 }
    1735 
    1736 module_init(alsa_card_atiixp_init)
    1737 module_exit(alsa_card_atiixp_exit)
     1691module_pci_driver(atiixp_driver);
Note: See TracChangeset for help on using the changeset viewer.