summaryrefslogtreecommitdiff
path: root/sound/ppc/pmac.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/ppc/pmac.c')
-rw-r--r--sound/ppc/pmac.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c
index 5e829683d1ad..2bae9c1a2b54 100644
--- a/sound/ppc/pmac.c
+++ b/sound/ppc/pmac.c
@@ -816,6 +816,7 @@ static int snd_pmac_free(struct snd_pmac *chip)
if (chip->pdev)
pci_dev_put(chip->pdev);
+ of_node_put(chip->node);
kfree(chip);
return 0;
}
@@ -863,7 +864,8 @@ static void __init detect_byte_swap(struct snd_pmac *chip)
*/
static int __init snd_pmac_detect(struct snd_pmac *chip)
{
- struct device_node *sound = NULL;
+ struct device_node *sound;
+ struct device_node *dn;
const unsigned int *prop;
unsigned int l;
struct macio_chip* macio;
@@ -891,22 +893,21 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
else if (machine_is_compatible("PowerBook1,1")
|| machine_is_compatible("AAPL,PowerBook1998"))
chip->is_pbook_G3 = 1;
- chip->node = find_devices("awacs");
- if (chip->node)
- sound = chip->node;
+ chip->node = of_find_node_by_name(NULL, "awacs");
+ sound = of_node_get(chip->node);
/*
* powermac G3 models have a node called "davbus"
* with a child called "sound".
*/
if (!chip->node)
- chip->node = find_devices("davbus");
+ chip->node = of_find_node_by_name(NULL, "davbus");
/*
* if we didn't find a davbus device, try 'i2s-a' since
* this seems to be what iBooks have
*/
if (! chip->node) {
- chip->node = find_devices("i2s-a");
+ 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,
@@ -918,12 +919,14 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
return -ENODEV;
if (!sound) {
- sound = find_devices("sound");
+ sound = of_find_node_by_name(NULL, "sound");
while (sound && sound->parent != chip->node)
- sound = sound->next;
+ sound = of_find_node_by_name(sound, "sound");
}
- if (! sound)
+ if (! sound) {
+ of_node_put(chip->node);
return -ENODEV;
+ }
prop = of_get_property(sound, "sub-frame", NULL);
if (prop && *prop < 16)
chip->subframe = *prop;
@@ -934,6 +937,7 @@ 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(chip->node);
return -ENODEV;
}
/* This should be verified on older screamers */
@@ -971,7 +975,9 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
prop = of_get_property(sound, "device-id", NULL);
if (prop)
chip->device_id = *prop;
- chip->has_iic = (find_devices("perch") != NULL);
+ dn = of_find_node_by_name(NULL, "perch");
+ chip->has_iic = (dn != NULL);
+ of_node_put(dn);
/* We need the PCI device for DMA allocations, let's use a crude method
* for now ...
@@ -1021,6 +1027,7 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
chip->freqs_ok = 1;
}
+ of_node_put(sound);
return 0;
}