Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[sfrench/cifs-2.6.git] / sound / ppc / pmac.c
index 2bae9c1a2b54b9daa134a9765a99d8eec035bb87..7a22f0f3784ab5e1f1c90401bdd8281d795cd2a5 100644 (file)
@@ -775,7 +775,8 @@ static int snd_pmac_free(struct snd_pmac *chip)
                out_le32(&chip->awacs->control, in_le32(&chip->awacs->control) & 0xfff);
        }
 
-       snd_pmac_sound_feature(chip, 0);
+       if (chip->node)
+               snd_pmac_sound_feature(chip, 0);
 
        /* clean up mixer if any */
        if (chip->mixer_free)
@@ -843,7 +844,7 @@ static void __init detect_byte_swap(struct snd_pmac *chip)
        /* if seems that Keylargo can't byte-swap  */
        for (mio = chip->node->parent; mio; mio = mio->parent) {
                if (strcmp(mio->name, "mac-io") == 0) {
-                       if (device_is_compatible(mio, "Keylargo"))
+                       if (of_device_is_compatible(mio, "Keylargo"))
                                chip->can_byte_swap = 0;
                        break;
                }
@@ -910,7 +911,7 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
                chip->node = of_find_node_by_name(NULL, "i2s-a");
                if (chip->node && chip->node->parent &&
                    chip->node->parent->parent) {
-                       if (device_is_compatible(chip->node->parent->parent,
+                       if (of_device_is_compatible(chip->node->parent->parent,
                                                 "K2-Keylargo"))
                                chip->is_k2 = 1;
                }
@@ -925,6 +926,7 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
        }
        if (! sound) {
                of_node_put(chip->node);
+               chip->node = NULL;
                return -ENODEV;
        }
        prop = of_get_property(sound, "sub-frame", NULL);
@@ -937,26 +939,28 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
                printk(KERN_INFO "snd-powermac no longer handles any "
                                 "machines with a layout-id property "
                                 "in the device-tree, use snd-aoa.\n");
+               of_node_put(sound);
                of_node_put(chip->node);
+               chip->node = NULL;
                return -ENODEV;
        }
        /* This should be verified on older screamers */
-       if (device_is_compatible(sound, "screamer")) {
+       if (of_device_is_compatible(sound, "screamer")) {
                chip->model = PMAC_SCREAMER;
                // chip->can_byte_swap = 0; /* FIXME: check this */
        }
-       if (device_is_compatible(sound, "burgundy")) {
+       if (of_device_is_compatible(sound, "burgundy")) {
                chip->model = PMAC_BURGUNDY;
                chip->control_mask = MASK_IEPC | 0x11; /* disable IEE */
        }
-       if (device_is_compatible(sound, "daca")) {
+       if (of_device_is_compatible(sound, "daca")) {
                chip->model = PMAC_DACA;
                chip->can_capture = 0;  /* no capture */
                chip->can_duplex = 0;
                // chip->can_byte_swap = 0; /* FIXME: check this */
                chip->control_mask = MASK_IEPC | 0x11; /* disable IEE */
        }
-       if (device_is_compatible(sound, "tumbler")) {
+       if (of_device_is_compatible(sound, "tumbler")) {
                chip->model = PMAC_TUMBLER;
                chip->can_capture = 0;  /* no capture */
                chip->can_duplex = 0;
@@ -965,7 +969,7 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
                chip->freq_table = tumbler_freqs;
                chip->control_mask = MASK_IEPC | 0x11; /* disable IEE */
        }
-       if (device_is_compatible(sound, "snapper")) {
+       if (of_device_is_compatible(sound, "snapper")) {
                chip->model = PMAC_SNAPPER;
                // chip->can_byte_swap = 0; /* FIXME: check this */
                chip->num_freqs = ARRAY_SIZE(tumbler_freqs);
@@ -1297,8 +1301,6 @@ int __init snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return)
        return 0;
 
  __error:
-       if (chip->pdev)
-               pci_dev_put(chip->pdev);
        snd_pmac_free(chip);
        return err;
 }