]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge branches 'topic/fix/hda' and 'topic/fix/misc' into for-linus
authorTakashi Iwai <tiwai@suse.de>
Wed, 29 Oct 2008 15:40:00 +0000 (16:40 +0100)
committerTakashi Iwai <tiwai@suse.de>
Wed, 29 Oct 2008 15:40:00 +0000 (16:40 +0100)
1  2  3 
sound/pci/hda/hda_intel.c

index f080f8ce0ecb6a6bb56d3f2515ebaa0960b90d39,c04ac38e2b2e469ff404c4d1e4d094fb86f369b1,9f316c1b2790851d6b6f83bcdd9a1e980ea2315b..35722ec920cb0ed556cee27e19ad44929d34bc61
   #include <linux/slab.h>
   #include <linux/pci.h>
   #include <linux/mutex.h>
+ +#include <linux/reboot.h>
   #include <sound/core.h>
   #include <sound/initval.h>
   #include "hda_codec.h"
@@@@ -397,6 -398,9 -397,6 +398,9 @@@@ struct azx 
   
        /* for pending irqs */
        struct work_struct irq_pending_work;
+ +
+ +     /* reboot notifier (for mysterious hangup problem at power-down) */
+ +     struct notifier_block reboot_notifier;
   };
   
   /* driver types */
@@@@ -1978,6 -1982,28 -1978,6 +1982,28 @@@@ static int azx_resume(struct pci_dev *p
   #endif /* CONFIG_PM */
   
   
+ +/*
+ + * reboot notifier for hang-up problem at power-down
+ + */
+ +static int azx_halt(struct notifier_block *nb, unsigned long event, void *buf)
+ +{
+ +     struct azx *chip = container_of(nb, struct azx, reboot_notifier);
+ +     azx_stop_chip(chip);
+ +     return NOTIFY_OK;
+ +}
+ +
+ +static void azx_notifier_register(struct azx *chip)
+ +{
+ +     chip->reboot_notifier.notifier_call = azx_halt;
+ +     register_reboot_notifier(&chip->reboot_notifier);
+ +}
+ +
+ +static void azx_notifier_unregister(struct azx *chip)
+ +{
+ +     if (chip->reboot_notifier.notifier_call)
+ +             unregister_reboot_notifier(&chip->reboot_notifier);
+ +}
+ +
   /*
    * destructor
    */
@@@@ -1985,6 -2011,8 -1985,6 +2011,8 @@@@ static int azx_free(struct azx *chip
   {
        int i;
   
+ +     azx_notifier_unregister(chip);
+ +
        if (chip->initialized) {
                azx_clear_irq_pending(chip);
                for (i = 0; i < chip->num_streams; i++)
@@@@ -2158,7 -2186,7 -2158,7 +2186,7 @@@@ static int __devinit azx_create(struct 
        }
   
        chip->addr = pci_resource_start(pci, 0);
 --     chip->remap_addr = ioremap_nocache(chip->addr, pci_resource_len(pci,0));
 ++     chip->remap_addr = pci_ioremap_bar(pci, 0);
        if (chip->remap_addr == NULL) {
                snd_printk(KERN_ERR SFX "ioremap error\n");
                err = -ENXIO;
@@@@ -2348,6 -2376,7 -2348,6 +2376,7 @@@@ static int __devinit azx_probe(struct p
        pci_set_drvdata(pci, card);
        chip->running = 1;
        power_down_all_codecs(chip);
+ +     azx_notifier_register(chip);
   
        dev++;
        return err;