aboutsummaryrefslogtreecommitdiffstats
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)
816 816
817 if (chip->pdev) 817 if (chip->pdev)
818 pci_dev_put(chip->pdev); 818 pci_dev_put(chip->pdev);
819 of_node_put(chip->node);
819 kfree(chip); 820 kfree(chip);
820 return 0; 821 return 0;
821} 822}
@@ -863,7 +864,8 @@ static void __init detect_byte_swap(struct snd_pmac *chip)
863 */ 864 */
864static int __init snd_pmac_detect(struct snd_pmac *chip) 865static int __init snd_pmac_detect(struct snd_pmac *chip)
865{ 866{
866 struct device_node *sound = NULL; 867 struct device_node *sound;
868 struct device_node *dn;
867 const unsigned int *prop; 869 const unsigned int *prop;
868 unsigned int l; 870 unsigned int l;
869 struct macio_chip* macio; 871 struct macio_chip* macio;
@@ -891,22 +893,21 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
891 else if (machine_is_compatible("PowerBook1,1") 893 else if (machine_is_compatible("PowerBook1,1")
892 || machine_is_compatible("AAPL,PowerBook1998")) 894 || machine_is_compatible("AAPL,PowerBook1998"))
893 chip->is_pbook_G3 = 1; 895 chip->is_pbook_G3 = 1;
894 chip->node = find_devices("awacs"); 896 chip->node = of_find_node_by_name(NULL, "awacs");
895 if (chip->node) 897 sound = of_node_get(chip->node);
896 sound = chip->node;
897 898
898 /* 899 /*
899 * powermac G3 models have a node called "davbus" 900 * powermac G3 models have a node called "davbus"
900 * with a child called "sound". 901 * with a child called "sound".
901 */ 902 */
902 if (!chip->node) 903 if (!chip->node)
903 chip->node = find_devices("davbus"); 904 chip->node = of_find_node_by_name(NULL, "davbus");
904 /* 905 /*
905 * if we didn't find a davbus device, try 'i2s-a' since 906 * if we didn't find a davbus device, try 'i2s-a' since
906 * this seems to be what iBooks have 907 * this seems to be what iBooks have
907 */ 908 */
908 if (! chip->node) { 909 if (! chip->node) {
909 chip->node = find_devices("i2s-a"); 910 chip->node = of_find_node_by_name(NULL, "i2s-a");
910 if (chip->node && chip->node->parent && 911 if (chip->node && chip->node->parent &&
911 chip->node->parent->parent) { 912 chip->node->parent->parent) {
912 if (device_is_compatible(chip->node->parent->parent, 913 if (device_is_compatible(chip->node->parent->parent,
@@ -918,12 +919,14 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
918 return -ENODEV; 919 return -ENODEV;
919 920
920 if (!sound) { 921 if (!sound) {
921 sound = find_devices("sound"); 922 sound = of_find_node_by_name(NULL, "sound");
922 while (sound && sound->parent != chip->node) 923 while (sound && sound->parent != chip->node)
923 sound = sound->next; 924 sound = of_find_node_by_name(sound, "sound");
924 } 925 }
925 if (! sound) 926 if (! sound) {
927 of_node_put(chip->node);
926 return -ENODEV; 928 return -ENODEV;
929 }
927 prop = of_get_property(sound, "sub-frame", NULL); 930 prop = of_get_property(sound, "sub-frame", NULL);
928 if (prop && *prop < 16) 931 if (prop && *prop < 16)
929 chip->subframe = *prop; 932 chip->subframe = *prop;
@@ -934,6 +937,7 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
934 printk(KERN_INFO "snd-powermac no longer handles any " 937 printk(KERN_INFO "snd-powermac no longer handles any "
935 "machines with a layout-id property " 938 "machines with a layout-id property "
936 "in the device-tree, use snd-aoa.\n"); 939 "in the device-tree, use snd-aoa.\n");
940 of_node_put(chip->node);
937 return -ENODEV; 941 return -ENODEV;
938 } 942 }
939 /* This should be verified on older screamers */ 943 /* This should be verified on older screamers */
@@ -971,7 +975,9 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
971 prop = of_get_property(sound, "device-id", NULL); 975 prop = of_get_property(sound, "device-id", NULL);
972 if (prop) 976 if (prop)
973 chip->device_id = *prop; 977 chip->device_id = *prop;
974 chip->has_iic = (find_devices("perch") != NULL); 978 dn = of_find_node_by_name(NULL, "perch");
979 chip->has_iic = (dn != NULL);
980 of_node_put(dn);
975 981
976 /* We need the PCI device for DMA allocations, let's use a crude method 982 /* We need the PCI device for DMA allocations, let's use a crude method
977 * for now ... 983 * for now ...
@@ -1021,6 +1027,7 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
1021 chip->freqs_ok = 1; 1027 chip->freqs_ok = 1;
1022 } 1028 }
1023 1029
1030 of_node_put(sound);
1024 return 0; 1031 return 0;
1025} 1032}
1026 1033