Update of /cvsroot/alsa/alsa-kernel/pci/ali5451 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25446/ali5451
Modified Files: ali5451.c Log Message: Clean up of power-management codes. - moved commonly used codes to the core layer. - using the unified suspend/resume callbacks for PCI and ISA - added snd_card_set_pm_callbacks() and snd_card_set_isa_pm_callbacks() as the registration functions. Index: ali5451.c =================================================================== RCS file: /cvsroot/alsa/alsa-kernel/pci/ali5451/ali5451.c,v retrieving revision 1.45 retrieving revision 1.46 diff -u -r1.45 -r1.46 --- ali5451.c 8 Apr 2004 16:35:00 -0000 1.45 +++ ali5451.c 8 Apr 2004 17:04:21 -0000 1.46 @@ -1905,14 +1905,15 @@ } #ifdef CONFIG_PM -static void ali_suspend(ali_t *chip) +static int ali_suspend(snd_card_t *card, unsigned int state) { + ali_t *chip = snd_magic_cast(ali_t, card->pm_private_data, return -EINVAL); ali_image_t *im; int i, j; im = chip->image; if (! im) - return; + return 0; spin_lock_irq(&chip->reg_lock); @@ -1939,16 +1940,18 @@ outl(0xffffffff, ALI_REG(chip, ALI_STOP)); spin_unlock_irq(&chip->reg_lock); + return 0; } -static void ali_resume(ali_t *chip) +static int ali_resume(snd_card_t *card, unsigned int state) { + ali_t *chip = snd_magic_cast(ali_t, card->pm_private_data, return -EINVAL); ali_image_t *im; int i, j; im = chip->image; if (! im) - return; + return 0; pci_enable_device(chip->pci); @@ -1974,19 +1977,6 @@ outl(im->regs[ALI_MISCINT >> 2], ALI_REG(chip, ALI_MISCINT)); spin_unlock_irq(&chip->reg_lock); - return; -} - -static int snd_ali_suspend(struct pci_dev *dev, u32 state) -{ - ali_t *chip = snd_magic_cast(ali_t, pci_get_drvdata(dev), return -ENXIO); - ali_suspend(chip); - return 0; -} -static int snd_ali_resume(struct pci_dev *dev) -{ - ali_t *chip = snd_magic_cast(ali_t, pci_get_drvdata(dev), return -ENXIO); - ali_resume(chip); return 0; } #endif /* CONFIG_PM */ @@ -2202,7 +2192,9 @@ #ifdef CONFIG_PM codec->image = kmalloc(sizeof(*codec->image), GFP_KERNEL); if (! codec->image) - snd_printk("can't allocate apm buffer\n"); + snd_printk(KERN_WARNING "can't allocate apm buffer\n"); + else + snd_card_set_pm_callback(card, ali_suspend, ali_resume, codec); #endif snd_ali_enable_address_interrupt(codec); @@ -2278,10 +2270,7 @@ .id_table = snd_ali_ids, .probe = snd_ali_probe, .remove = __devexit_p(snd_ali_remove), -#ifdef CONFIG_PM - .suspend = snd_ali_suspend, - .resume = snd_ali_resume, -#endif + SND_PCI_PM_CALLBACKS }; static int __init alsa_card_ali_init(void) ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ Alsa-cvslog mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/alsa-cvslog