aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/aoa/codecs/snd-aoa-codec-onyx.c4
-rw-r--r--sound/aoa/codecs/snd-aoa-codec-tas.c9
-rw-r--r--sound/aoa/core/snd-aoa-gpio-feature.c8
-rw-r--r--sound/aoa/fabrics/snd-aoa-fabric-layout.c8
-rw-r--r--sound/aoa/soundbus/core.c82
-rw-r--r--sound/aoa/soundbus/i2sbus/i2sbus-core.c8
-rw-r--r--sound/core/init.c1
-rw-r--r--sound/oss/au1550_ac97.c1
-rw-r--r--sound/oss/dmasound/dmasound_awacs.c121
-rw-r--r--sound/oss/dmasound/tas_common.c9
-rw-r--r--sound/oss/dmasound/tas_ioctl.h1
-rw-r--r--sound/oss/soundcard.c1
-rw-r--r--sound/pci/ca0106/ca0106_mixer.c2
-rw-r--r--sound/pci/ca0106/ca0106_proc.c2
-rw-r--r--sound/pci/cs46xx/dsp_spos.c1
-rw-r--r--sound/pci/cs46xx/dsp_spos_scb_lib.c1
-rw-r--r--sound/pci/hda/hda_generic.c1
-rw-r--r--sound/pci/hda/hda_proc.c1
-rw-r--r--sound/pci/hda/patch_atihdmi.c1
-rw-r--r--sound/pci/hda/patch_si3054.c1
-rw-r--r--sound/pci/hda/patch_via.c1
-rw-r--r--sound/ppc/pmac.c41
-rw-r--r--sound/ppc/tumbler.c55
-rw-r--r--sound/sparc/amd7930.c4
-rw-r--r--sound/sparc/cs4231.c2
25 files changed, 195 insertions, 171 deletions
diff --git a/sound/aoa/codecs/snd-aoa-codec-onyx.c b/sound/aoa/codecs/snd-aoa-codec-onyx.c
index b00fc4842c93..7f980be5d060 100644
--- a/sound/aoa/codecs/snd-aoa-codec-onyx.c
+++ b/sound/aoa/codecs/snd-aoa-codec-onyx.c
@@ -1062,9 +1062,9 @@ static int onyx_i2c_attach(struct i2c_adapter *adapter)
1062 1062
1063 while ((dev = of_get_next_child(busnode, dev)) != NULL) { 1063 while ((dev = of_get_next_child(busnode, dev)) != NULL) {
1064 if (device_is_compatible(dev, "pcm3052")) { 1064 if (device_is_compatible(dev, "pcm3052")) {
1065 u32 *addr; 1065 const u32 *addr;
1066 printk(KERN_DEBUG PFX "found pcm3052\n"); 1066 printk(KERN_DEBUG PFX "found pcm3052\n");
1067 addr = (u32 *) get_property(dev, "reg", NULL); 1067 addr = of_get_property(dev, "reg", NULL);
1068 if (!addr) 1068 if (!addr)
1069 return -ENODEV; 1069 return -ENODEV;
1070 return onyx_create(adapter, dev, (*addr)>>1); 1070 return onyx_create(adapter, dev, (*addr)>>1);
diff --git a/sound/aoa/codecs/snd-aoa-codec-tas.c b/sound/aoa/codecs/snd-aoa-codec-tas.c
index 2cd81fa07ce1..ceca38486eae 100644
--- a/sound/aoa/codecs/snd-aoa-codec-tas.c
+++ b/sound/aoa/codecs/snd-aoa-codec-tas.c
@@ -939,9 +939,9 @@ static int tas_i2c_attach(struct i2c_adapter *adapter)
939 939
940 while ((dev = of_get_next_child(busnode, dev)) != NULL) { 940 while ((dev = of_get_next_child(busnode, dev)) != NULL) {
941 if (device_is_compatible(dev, "tas3004")) { 941 if (device_is_compatible(dev, "tas3004")) {
942 u32 *addr; 942 const u32 *addr;
943 printk(KERN_DEBUG PFX "found tas3004\n"); 943 printk(KERN_DEBUG PFX "found tas3004\n");
944 addr = (u32 *) get_property(dev, "reg", NULL); 944 addr = of_get_property(dev, "reg", NULL);
945 if (!addr) 945 if (!addr)
946 continue; 946 continue;
947 return tas_create(adapter, dev, ((*addr) >> 1) & 0x7f); 947 return tas_create(adapter, dev, ((*addr) >> 1) & 0x7f);
@@ -950,9 +950,10 @@ static int tas_i2c_attach(struct i2c_adapter *adapter)
950 * property that says 'tas3004', they just have a 'deq' 950 * property that says 'tas3004', they just have a 'deq'
951 * node without any such property... */ 951 * node without any such property... */
952 if (strcmp(dev->name, "deq") == 0) { 952 if (strcmp(dev->name, "deq") == 0) {
953 u32 *_addr, addr; 953 const u32 *_addr;
954 u32 addr;
954 printk(KERN_DEBUG PFX "found 'deq' node\n"); 955 printk(KERN_DEBUG PFX "found 'deq' node\n");
955 _addr = (u32 *) get_property(dev, "i2c-address", NULL); 956 _addr = of_get_property(dev, "i2c-address", NULL);
956 if (!_addr) 957 if (!_addr)
957 continue; 958 continue;
958 addr = ((*_addr) >> 1) & 0x7f; 959 addr = ((*_addr) >> 1) & 0x7f;
diff --git a/sound/aoa/core/snd-aoa-gpio-feature.c b/sound/aoa/core/snd-aoa-gpio-feature.c
index 2b03bc798bcb..805dcbff2257 100644
--- a/sound/aoa/core/snd-aoa-gpio-feature.c
+++ b/sound/aoa/core/snd-aoa-gpio-feature.c
@@ -55,7 +55,7 @@ static struct device_node *get_gpio(char *name,
55 int *gpioactiveptr) 55 int *gpioactiveptr)
56{ 56{
57 struct device_node *np, *gpio; 57 struct device_node *np, *gpio;
58 u32 *reg; 58 const u32 *reg;
59 const char *audio_gpio; 59 const char *audio_gpio;
60 60
61 *gpioptr = -1; 61 *gpioptr = -1;
@@ -71,7 +71,7 @@ static struct device_node *get_gpio(char *name,
71 if (!gpio) 71 if (!gpio)
72 return NULL; 72 return NULL;
73 while ((np = of_get_next_child(gpio, np))) { 73 while ((np = of_get_next_child(gpio, np))) {
74 audio_gpio = get_property(np, "audio-gpio", NULL); 74 audio_gpio = of_get_property(np, "audio-gpio", NULL);
75 if (!audio_gpio) 75 if (!audio_gpio)
76 continue; 76 continue;
77 if (strcmp(audio_gpio, name) == 0) 77 if (strcmp(audio_gpio, name) == 0)
@@ -84,7 +84,7 @@ static struct device_node *get_gpio(char *name,
84 return NULL; 84 return NULL;
85 } 85 }
86 86
87 reg = (u32 *)get_property(np, "reg", NULL); 87 reg = of_get_property(np, "reg", NULL);
88 if (!reg) 88 if (!reg)
89 return NULL; 89 return NULL;
90 90
@@ -96,7 +96,7 @@ static struct device_node *get_gpio(char *name,
96 if (*gpioptr < 0x50) 96 if (*gpioptr < 0x50)
97 *gpioptr += 0x50; 97 *gpioptr += 0x50;
98 98
99 reg = (u32 *)get_property(np, "audio-gpio-active-state", NULL); 99 reg = of_get_property(np, "audio-gpio-active-state", NULL);
100 if (!reg) 100 if (!reg)
101 /* Apple seems to default to 1, but 101 /* Apple seems to default to 1, but
102 * that doesn't seem right at least on most 102 * that doesn't seem right at least on most
diff --git a/sound/aoa/fabrics/snd-aoa-fabric-layout.c b/sound/aoa/fabrics/snd-aoa-fabric-layout.c
index 1b94ba6dd279..98806283d1b2 100644
--- a/sound/aoa/fabrics/snd-aoa-fabric-layout.c
+++ b/sound/aoa/fabrics/snd-aoa-fabric-layout.c
@@ -724,7 +724,7 @@ static int check_codec(struct aoa_codec *codec,
724 struct layout_dev *ldev, 724 struct layout_dev *ldev,
725 struct codec_connect_info *cci) 725 struct codec_connect_info *cci)
726{ 726{
727 u32 *ref; 727 const u32 *ref;
728 char propname[32]; 728 char propname[32];
729 struct codec_connection *cc; 729 struct codec_connection *cc;
730 730
@@ -732,7 +732,7 @@ static int check_codec(struct aoa_codec *codec,
732 if (codec->node && (strcmp(codec->node->name, "codec") == 0)) { 732 if (codec->node && (strcmp(codec->node->name, "codec") == 0)) {
733 snprintf(propname, sizeof(propname), 733 snprintf(propname, sizeof(propname),
734 "platform-%s-codec-ref", codec->name); 734 "platform-%s-codec-ref", codec->name);
735 ref = (u32*)get_property(ldev->sound, propname, NULL); 735 ref = of_get_property(ldev->sound, propname, NULL);
736 if (!ref) { 736 if (!ref) {
737 printk(KERN_INFO "snd-aoa-fabric-layout: " 737 printk(KERN_INFO "snd-aoa-fabric-layout: "
738 "required property %s not present\n", propname); 738 "required property %s not present\n", propname);
@@ -946,7 +946,7 @@ static struct aoa_fabric layout_fabric = {
946static int aoa_fabric_layout_probe(struct soundbus_dev *sdev) 946static int aoa_fabric_layout_probe(struct soundbus_dev *sdev)
947{ 947{
948 struct device_node *sound = NULL; 948 struct device_node *sound = NULL;
949 unsigned int *layout_id; 949 const unsigned int *layout_id;
950 struct layout *layout; 950 struct layout *layout;
951 struct layout_dev *ldev = NULL; 951 struct layout_dev *ldev = NULL;
952 int err; 952 int err;
@@ -962,7 +962,7 @@ static int aoa_fabric_layout_probe(struct soundbus_dev *sdev)
962 } 962 }
963 if (!sound) return -ENODEV; 963 if (!sound) return -ENODEV;
964 964
965 layout_id = (unsigned int *) get_property(sound, "layout-id", NULL); 965 layout_id = of_get_property(sound, "layout-id", NULL);
966 if (!layout_id) 966 if (!layout_id)
967 goto outnodev; 967 goto outnodev;
968 printk(KERN_INFO "snd-aoa-fabric-layout: found bus with layout %d\n", 968 printk(KERN_INFO "snd-aoa-fabric-layout: found bus with layout %d\n",
diff --git a/sound/aoa/soundbus/core.c b/sound/aoa/soundbus/core.c
index 47b3e3768df0..8b2e9b905cda 100644
--- a/sound/aoa/soundbus/core.c
+++ b/sound/aoa/soundbus/core.c
@@ -61,9 +61,9 @@ static int soundbus_uevent(struct device *dev, char **envp, int num_envp,
61{ 61{
62 struct soundbus_dev * soundbus_dev; 62 struct soundbus_dev * soundbus_dev;
63 struct of_device * of; 63 struct of_device * of;
64 char *scratch, *compat, *compat2; 64 const char *compat;
65 int i = 0; 65 int retval = 0, i = 0, length = 0;
66 int length, cplen, cplen2, seen = 0; 66 int cplen, seen = 0;
67 67
68 if (!dev) 68 if (!dev)
69 return -ENODEV; 69 return -ENODEV;
@@ -75,63 +75,47 @@ static int soundbus_uevent(struct device *dev, char **envp, int num_envp,
75 of = &soundbus_dev->ofdev; 75 of = &soundbus_dev->ofdev;
76 76
77 /* stuff we want to pass to /sbin/hotplug */ 77 /* stuff we want to pass to /sbin/hotplug */
78 envp[i++] = scratch = buffer; 78 retval = add_uevent_var(envp, num_envp, &i,
79 length = scnprintf (scratch, buffer_size, "OF_NAME=%s", of->node->name); 79 buffer, buffer_size, &length,
80 ++length; 80 "OF_NAME=%s", of->node->name);
81 buffer_size -= length; 81 if (retval)
82 if ((buffer_size <= 0) || (i >= num_envp)) 82 return retval;
83 return -ENOMEM; 83
84 scratch += length; 84 retval = add_uevent_var(envp, num_envp, &i,
85 85 buffer, buffer_size, &length,
86 envp[i++] = scratch; 86 "OF_TYPE=%s", of->node->type);
87 length = scnprintf (scratch, buffer_size, "OF_TYPE=%s", of->node->type); 87 if (retval)
88 ++length; 88 return retval;
89 buffer_size -= length;
90 if ((buffer_size <= 0) || (i >= num_envp))
91 return -ENOMEM;
92 scratch += length;
93 89
94 /* Since the compatible field can contain pretty much anything 90 /* Since the compatible field can contain pretty much anything
95 * it's not really legal to split it out with commas. We split it 91 * it's not really legal to split it out with commas. We split it
96 * up using a number of environment variables instead. */ 92 * up using a number of environment variables instead. */
97 93
98 compat = (char *) get_property(of->node, "compatible", &cplen); 94 compat = of_get_property(of->node, "compatible", &cplen);
99 compat2 = compat;
100 cplen2= cplen;
101 while (compat && cplen > 0) { 95 while (compat && cplen > 0) {
102 envp[i++] = scratch; 96 int tmp = length;
103 length = scnprintf (scratch, buffer_size, 97 retval = add_uevent_var(envp, num_envp, &i,
104 "OF_COMPATIBLE_%d=%s", seen, compat); 98 buffer, buffer_size, &length,
105 ++length; 99 "OF_COMPATIBLE_%d=%s", seen, compat);
106 buffer_size -= length; 100 if (retval)
107 if ((buffer_size <= 0) || (i >= num_envp)) 101 return retval;
108 return -ENOMEM; 102 compat += length - tmp;
109 scratch += length; 103 cplen -= length - tmp;
110 length = strlen (compat) + 1; 104 seen += 1;
111 compat += length;
112 cplen -= length;
113 seen++;
114 } 105 }
115 106
116 envp[i++] = scratch; 107 retval = add_uevent_var(envp, num_envp, &i,
117 length = scnprintf (scratch, buffer_size, "OF_COMPATIBLE_N=%d", seen); 108 buffer, buffer_size, &length,
118 ++length; 109 "OF_COMPATIBLE_N=%d", seen);
119 buffer_size -= length; 110 if (retval)
120 if ((buffer_size <= 0) || (i >= num_envp)) 111 return retval;
121 return -ENOMEM; 112 retval = add_uevent_var(envp, num_envp, &i,
122 scratch += length; 113 buffer, buffer_size, &length,
123 114 "MODALIAS=%s", soundbus_dev->modalias);
124 envp[i++] = scratch;
125 length = scnprintf (scratch, buffer_size, "MODALIAS=%s",
126 soundbus_dev->modalias);
127
128 buffer_size -= length;
129 if ((buffer_size <= 0) || (i >= num_envp))
130 return -ENOMEM;
131 115
132 envp[i] = NULL; 116 envp[i] = NULL;
133 117
134 return 0; 118 return retval;
135} 119}
136 120
137static int soundbus_device_remove(struct device *dev) 121static int soundbus_device_remove(struct device *dev)
diff --git a/sound/aoa/soundbus/i2sbus/i2sbus-core.c b/sound/aoa/soundbus/i2sbus/i2sbus-core.c
index e36f6aa448d4..79fc4bc09e5e 100644
--- a/sound/aoa/soundbus/i2sbus/i2sbus-core.c
+++ b/sound/aoa/soundbus/i2sbus/i2sbus-core.c
@@ -122,7 +122,7 @@ static int i2sbus_get_and_fixup_rsrc(struct device_node *np, int index,
122{ 122{
123 struct device_node *parent; 123 struct device_node *parent;
124 int pindex, rc = -ENXIO; 124 int pindex, rc = -ENXIO;
125 u32 *reg; 125 const u32 *reg;
126 126
127 /* Machines with layout 76 and 36 (K2 based) have a weird device 127 /* Machines with layout 76 and 36 (K2 based) have a weird device
128 * tree what we need to special case. 128 * tree what we need to special case.
@@ -141,7 +141,7 @@ static int i2sbus_get_and_fixup_rsrc(struct device_node *np, int index,
141 rc = of_address_to_resource(parent, pindex, res); 141 rc = of_address_to_resource(parent, pindex, res);
142 if (rc) 142 if (rc)
143 goto bail; 143 goto bail;
144 reg = (u32 *)get_property(np, "reg", NULL); 144 reg = of_get_property(np, "reg", NULL);
145 if (reg == NULL) { 145 if (reg == NULL) {
146 rc = -ENXIO; 146 rc = -ENXIO;
147 goto bail; 147 goto bail;
@@ -188,8 +188,8 @@ static int i2sbus_add_dev(struct macio_dev *macio,
188 } 188 }
189 } 189 }
190 if (i == 1) { 190 if (i == 1) {
191 u32 *layout_id; 191 const u32 *layout_id =
192 layout_id = (u32*) get_property(sound, "layout-id", NULL); 192 of_get_property(sound, "layout-id", NULL);
193 if (layout_id) { 193 if (layout_id) {
194 layout = *layout_id; 194 layout = *layout_id;
195 snprintf(dev->sound.modalias, 32, 195 snprintf(dev->sound.modalias, 32,
diff --git a/sound/core/init.c b/sound/core/init.c
index 4a431e3ea3a2..f2fe35737186 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -26,7 +26,6 @@
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/time.h> 27#include <linux/time.h>
28#include <linux/ctype.h> 28#include <linux/ctype.h>
29#include <linux/pci.h>
30#include <linux/pm.h> 29#include <linux/pm.h>
31 30
32#include <sound/core.h> 31#include <sound/core.h>
diff --git a/sound/oss/au1550_ac97.c b/sound/oss/au1550_ac97.c
index a339f0c0d512..23018a7c063a 100644
--- a/sound/oss/au1550_ac97.c
+++ b/sound/oss/au1550_ac97.c
@@ -47,7 +47,6 @@
47#include <linux/interrupt.h> 47#include <linux/interrupt.h>
48#include <linux/kernel.h> 48#include <linux/kernel.h>
49#include <linux/poll.h> 49#include <linux/poll.h>
50#include <linux/pci.h>
51#include <linux/bitops.h> 50#include <linux/bitops.h>
52#include <linux/spinlock.h> 51#include <linux/spinlock.h>
53#include <linux/smp_lock.h> 52#include <linux/smp_lock.h>
diff --git a/sound/oss/dmasound/dmasound_awacs.c b/sound/oss/dmasound/dmasound_awacs.c
index 37773b1deea5..730fa1d001a5 100644
--- a/sound/oss/dmasound/dmasound_awacs.c
+++ b/sound/oss/dmasound/dmasound_awacs.c
@@ -257,7 +257,7 @@ static volatile struct dbdma_cmd *emergency_dbdma_cmd;
257/* 257/*
258 * Stuff for restoring after a sleep. 258 * Stuff for restoring after a sleep.
259 */ 259 */
260static int awacs_sleep_notify(struct pmu_sleep_notifier *self, int when); 260static void awacs_sleep_notify(struct pmu_sleep_notifier *self, int when);
261struct pmu_sleep_notifier awacs_sleep_notifier = { 261struct pmu_sleep_notifier awacs_sleep_notifier = {
262 awacs_sleep_notify, SLEEP_LEVEL_SOUND, 262 awacs_sleep_notify, SLEEP_LEVEL_SOUND,
263}; 263};
@@ -346,36 +346,42 @@ int gpio_headphone_irq;
346int 346int
347setup_audio_gpio(const char *name, const char* compatible, int *gpio_addr, int* gpio_pol) 347setup_audio_gpio(const char *name, const char* compatible, int *gpio_addr, int* gpio_pol)
348{ 348{
349 struct device_node *gpiop;
349 struct device_node *np; 350 struct device_node *np;
350 const u32* pp; 351 const u32* pp;
352 int ret = -ENODEV;
351 353
352 np = find_devices("gpio"); 354 gpiop = of_find_node_by_name(NULL, "gpio");
353 if (!np) 355 if (!gpiop)
354 return -ENODEV; 356 goto done;
355 357
356 np = np->child; 358 np = of_get_next_child(gpiop, NULL);
357 while(np != 0) { 359 while(np != 0) {
358 if (name) { 360 if (name) {
359 const char *property = 361 const char *property =
360 get_property(np,"audio-gpio",NULL); 362 of_get_property(np,"audio-gpio",NULL);
361 if (property != 0 && strcmp(property,name) == 0) 363 if (property != 0 && strcmp(property,name) == 0)
362 break; 364 break;
363 } else if (compatible && device_is_compatible(np, compatible)) 365 } else if (compatible && device_is_compatible(np, compatible))
364 break; 366 break;
365 np = np->sibling; 367 np = of_get_next_child(gpiop, np);
366 } 368 }
367 if (!np) 369 if (!np)
368 return -ENODEV; 370 goto done;
369 pp = get_property(np, "AAPL,address", NULL); 371 pp = of_get_property(np, "AAPL,address", NULL);
370 if (!pp) 372 if (!pp)
371 return -ENODEV; 373 goto done;
372 *gpio_addr = (*pp) & 0x0000ffff; 374 *gpio_addr = (*pp) & 0x0000ffff;
373 pp = get_property(np, "audio-gpio-active-state", NULL); 375 pp = of_get_property(np, "audio-gpio-active-state", NULL);
374 if (pp) 376 if (pp)
375 *gpio_pol = *pp; 377 *gpio_pol = *pp;
376 else 378 else
377 *gpio_pol = 1; 379 *gpio_pol = 1;
378 return irq_of_parse_and_map(np, 0); 380 ret = irq_of_parse_and_map(np, 0);
381done:
382 of_node_put(np);
383 of_node_put(gpiop);
384 return ret;
379} 385}
380 386
381static inline void 387static inline void
@@ -578,7 +584,7 @@ tas_mixer_ioctl(u_int cmd, u_long arg)
578} 584}
579 585
580static void __init 586static void __init
581tas_init_frame_rates(unsigned int *prop, unsigned int l) 587tas_init_frame_rates(const unsigned int *prop, unsigned int l)
582{ 588{
583 int i ; 589 int i ;
584 if (prop) { 590 if (prop) {
@@ -1419,7 +1425,7 @@ load_awacs(void)
1419 * Save state when going to sleep, restore it afterwards. 1425 * Save state when going to sleep, restore it afterwards.
1420 */ 1426 */
1421/* FIXME: sort out disabling/re-enabling of read stuff as well */ 1427/* FIXME: sort out disabling/re-enabling of read stuff as well */
1422static int awacs_sleep_notify(struct pmu_sleep_notifier *self, int when) 1428static void awacs_sleep_notify(struct pmu_sleep_notifier *self, int when)
1423{ 1429{
1424 unsigned long flags; 1430 unsigned long flags;
1425 1431
@@ -1548,7 +1554,6 @@ static int awacs_sleep_notify(struct pmu_sleep_notifier *self, int when)
1548 spin_unlock_irqrestore(&dmasound.lock, flags); 1554 spin_unlock_irqrestore(&dmasound.lock, flags);
1549 UNLOCK(); 1555 UNLOCK();
1550 } 1556 }
1551 return PBOOK_SLEEP_OK;
1552} 1557}
1553#endif /* CONFIG_PM */ 1558#endif /* CONFIG_PM */
1554 1559
@@ -2553,32 +2558,33 @@ set_model(void)
2553static struct device_node* __init 2558static struct device_node* __init
2554get_snd_io_node(void) 2559get_snd_io_node(void)
2555{ 2560{
2556 struct device_node *np = NULL; 2561 struct device_node *np;
2557 2562
2558 /* set up awacs_node for early OF which doesn't have a full set of 2563 /* set up awacs_node for early OF which doesn't have a full set of
2559 * properties on davbus 2564 * properties on davbus
2560 */ 2565 */
2561 2566 awacs_node = of_find_node_by_name(NULL, "awacs");
2562 awacs_node = find_devices("awacs");
2563 if (awacs_node) 2567 if (awacs_node)
2564 awacs_revision = AWACS_AWACS; 2568 awacs_revision = AWACS_AWACS;
2565 2569
2566 /* powermac models after 9500 (other than those which use DACA or 2570 /* powermac models after 9500 (other than those which use DACA or
2567 * Tumbler) have a node called "davbus". 2571 * Tumbler) have a node called "davbus".
2568 */ 2572 */
2569 np = find_devices("davbus"); 2573 np = of_find_node_by_name(NULL, "davbus");
2570 /* 2574 /*
2571 * if we didn't find a davbus device, try 'i2s-a' since 2575 * if we didn't find a davbus device, try 'i2s-a' since
2572 * this seems to be what iBooks (& Tumbler) have. 2576 * this seems to be what iBooks (& Tumbler) have.
2573 */ 2577 */
2574 if (np == NULL) 2578 if (np == NULL) {
2575 np = i2s_node = find_devices("i2s-a"); 2579 i2s_node = of_find_node_by_name(NULL, "i2s-a");
2580 np = of_node_get(i2s_node);
2581 }
2576 2582
2577 /* if we didn't find this - perhaps we are on an early model 2583 /* if we didn't find this - perhaps we are on an early model
2578 * which _only_ has an 'awacs' node 2584 * which _only_ has an 'awacs' node
2579 */ 2585 */
2580 if (np == NULL && awacs_node) 2586 if (np == NULL && awacs_node)
2581 np = awacs_node ; 2587 np = of_node_get(awacs_node);
2582 2588
2583 /* if we failed all these return null - this will cause the 2589 /* if we failed all these return null - this will cause the
2584 * driver to give up... 2590 * driver to give up...
@@ -2597,9 +2603,9 @@ get_snd_info_node(struct device_node *io)
2597{ 2603{
2598 struct device_node *info; 2604 struct device_node *info;
2599 2605
2600 info = find_devices("sound"); 2606 for_each_node_by_name(info, "sound")
2601 while (info && info->parent != io) 2607 if (info->parent == io)
2602 info = info->next; 2608 break;
2603 return info; 2609 return info;
2604} 2610}
2605 2611
@@ -2635,11 +2641,17 @@ get_codec_type(struct device_node *info)
2635static void __init 2641static void __init
2636get_expansion_type(void) 2642get_expansion_type(void)
2637{ 2643{
2638 if (find_devices("perch") != NULL) 2644 struct device_node *dn;
2645
2646 dn = of_find_node_by_name(NULL, "perch");
2647 if (dn != NULL)
2639 has_perch = 1; 2648 has_perch = 1;
2649 of_node_put(dn);
2640 2650
2641 if (find_devices("pb-ziva-pc") != NULL) 2651 dn = of_find_node_by_name(NULL, "pb-ziva-pc");
2652 if (dn != NULL)
2642 has_ziva = 1; 2653 has_ziva = 1;
2654 of_node_put(dn);
2643 /* need to work out how we deal with iMac SRS module */ 2655 /* need to work out how we deal with iMac SRS module */
2644} 2656}
2645 2657
@@ -2652,7 +2664,7 @@ get_expansion_type(void)
2652*/ 2664*/
2653 2665
2654static void __init 2666static void __init
2655awacs_init_frame_rates(unsigned int *prop, unsigned int l) 2667awacs_init_frame_rates(const unsigned int *prop, unsigned int l)
2656{ 2668{
2657 int i ; 2669 int i ;
2658 if (prop) { 2670 if (prop) {
@@ -2675,7 +2687,7 @@ awacs_init_frame_rates(unsigned int *prop, unsigned int l)
2675} 2687}
2676 2688
2677static void __init 2689static void __init
2678burgundy_init_frame_rates(unsigned int *prop, unsigned int l) 2690burgundy_init_frame_rates(const unsigned int *prop, unsigned int l)
2679{ 2691{
2680 int temp[9] ; 2692 int temp[9] ;
2681 int i = 0 ; 2693 int i = 0 ;
@@ -2701,7 +2713,7 @@ if (i > 1){
2701} 2713}
2702 2714
2703static void __init 2715static void __init
2704daca_init_frame_rates(unsigned int *prop, unsigned int l) 2716daca_init_frame_rates(const unsigned int *prop, unsigned int l)
2705{ 2717{
2706 int temp[9] ; 2718 int temp[9] ;
2707 int i = 0 ; 2719 int i = 0 ;
@@ -2728,7 +2740,7 @@ if (i > 1){
2728} 2740}
2729 2741
2730static void __init 2742static void __init
2731init_frame_rates(unsigned int *prop, unsigned int l) 2743init_frame_rates(const unsigned int *prop, unsigned int l)
2732{ 2744{
2733 switch (awacs_revision) { 2745 switch (awacs_revision) {
2734 case AWACS_TUMBLER: 2746 case AWACS_TUMBLER:
@@ -2828,7 +2840,7 @@ int __init dmasound_awacs_init(void)
2828#ifdef DEBUG_DMASOUND 2840#ifdef DEBUG_DMASOUND
2829printk("dmasound_pmac: couldn't find sound io OF node\n"); 2841printk("dmasound_pmac: couldn't find sound io OF node\n");
2830#endif 2842#endif
2831 return -ENODEV ; 2843 goto no_device;
2832 } 2844 }
2833 2845
2834 /* find the OF node that tells us about the sound sub-system 2846 /* find the OF node that tells us about the sound sub-system
@@ -2840,7 +2852,7 @@ printk("dmasound_pmac: couldn't find sound io OF node\n");
2840#ifdef DEBUG_DMASOUND 2852#ifdef DEBUG_DMASOUND
2841printk("dmasound_pmac: couldn't find 'sound' OF node\n"); 2853printk("dmasound_pmac: couldn't find 'sound' OF node\n");
2842#endif 2854#endif
2843 return -ENODEV ; 2855 goto no_device;
2844 } 2856 }
2845 } 2857 }
2846 2858
@@ -2849,7 +2861,7 @@ printk("dmasound_pmac: couldn't find 'sound' OF node\n");
2849#ifdef DEBUG_DMASOUND 2861#ifdef DEBUG_DMASOUND
2850printk("dmasound_pmac: couldn't find a Codec we can handle\n"); 2862printk("dmasound_pmac: couldn't find a Codec we can handle\n");
2851#endif 2863#endif
2852 return -ENODEV ; /* we don't know this type of h/w */ 2864 goto no_device; /* we don't know this type of h/w */
2853 } 2865 }
2854 2866
2855 /* set up perch, ziva, SRS or whatever else we have as sound 2867 /* set up perch, ziva, SRS or whatever else we have as sound
@@ -2867,11 +2879,12 @@ printk("dmasound_pmac: couldn't find a Codec we can handle\n");
2867 * machines). 2879 * machines).
2868 */ 2880 */
2869 if (awacs_node) { 2881 if (awacs_node) {
2870 io = awacs_node ; 2882 of_node_put(io);
2883 io = of_node_get(awacs_node);
2871 if (of_get_address(io, 2, NULL, NULL) == NULL) { 2884 if (of_get_address(io, 2, NULL, NULL) == NULL) {
2872 printk("dmasound_pmac: can't use %s\n", 2885 printk("dmasound_pmac: can't use %s\n",
2873 io->full_name); 2886 io->full_name);
2874 return -ENODEV; 2887 goto no_device;
2875 } 2888 }
2876 } else 2889 } else
2877 printk("dmasound_pmac: can't use %s\n", io->full_name); 2890 printk("dmasound_pmac: can't use %s\n", io->full_name);
@@ -2882,7 +2895,7 @@ printk("dmasound_pmac: couldn't find a Codec we can handle\n");
2882 awacs_rsrc[0].end - awacs_rsrc[0].start + 1, 2895 awacs_rsrc[0].end - awacs_rsrc[0].start + 1,
2883 " (IO)") == NULL) { 2896 " (IO)") == NULL) {
2884 printk(KERN_ERR "dmasound: can't request IO resource !\n"); 2897 printk(KERN_ERR "dmasound: can't request IO resource !\n");
2885 return -ENODEV; 2898 goto no_device;
2886 } 2899 }
2887 if (of_address_to_resource(io, 1, &awacs_rsrc[1]) || 2900 if (of_address_to_resource(io, 1, &awacs_rsrc[1]) ||
2888 request_mem_region(awacs_rsrc[1].start, 2901 request_mem_region(awacs_rsrc[1].start,
@@ -2891,7 +2904,7 @@ printk("dmasound_pmac: couldn't find a Codec we can handle\n");
2891 release_mem_region(awacs_rsrc[0].start, 2904 release_mem_region(awacs_rsrc[0].start,
2892 awacs_rsrc[0].end - awacs_rsrc[0].start + 1); 2905 awacs_rsrc[0].end - awacs_rsrc[0].start + 1);
2893 printk(KERN_ERR "dmasound: can't request Tx DMA resource !\n"); 2906 printk(KERN_ERR "dmasound: can't request Tx DMA resource !\n");
2894 return -ENODEV; 2907 goto no_device;
2895 } 2908 }
2896 if (of_address_to_resource(io, 2, &awacs_rsrc[2]) || 2909 if (of_address_to_resource(io, 2, &awacs_rsrc[2]) ||
2897 request_mem_region(awacs_rsrc[2].start, 2910 request_mem_region(awacs_rsrc[2].start,
@@ -2902,7 +2915,7 @@ printk("dmasound_pmac: couldn't find a Codec we can handle\n");
2902 release_mem_region(awacs_rsrc[1].start, 2915 release_mem_region(awacs_rsrc[1].start,
2903 awacs_rsrc[1].end - awacs_rsrc[1].start + 1); 2916 awacs_rsrc[1].end - awacs_rsrc[1].start + 1);
2904 printk(KERN_ERR "dmasound: can't request Rx DMA resource !\n"); 2917 printk(KERN_ERR "dmasound: can't request Rx DMA resource !\n");
2905 return -ENODEV; 2918 goto no_device;
2906 } 2919 }
2907 2920
2908 awacs_beep_dev = input_allocate_device(); 2921 awacs_beep_dev = input_allocate_device();
@@ -2914,7 +2927,7 @@ printk("dmasound_pmac: couldn't find a Codec we can handle\n");
2914 release_mem_region(awacs_rsrc[2].start, 2927 release_mem_region(awacs_rsrc[2].start,
2915 awacs_rsrc[2].end - awacs_rsrc[2].start + 1); 2928 awacs_rsrc[2].end - awacs_rsrc[2].start + 1);
2916 printk(KERN_ERR "dmasound: can't allocate input device !\n"); 2929 printk(KERN_ERR "dmasound: can't allocate input device !\n");
2917 return -ENOMEM; 2930 goto no_device;
2918 } 2931 }
2919 2932
2920 awacs_beep_dev->name = "dmasound beeper"; 2933 awacs_beep_dev->name = "dmasound beeper";
@@ -2942,7 +2955,8 @@ printk("dmasound_pmac: couldn't find a Codec we can handle\n");
2942 awacs_rx_irq = irq_of_parse_and_map(io, 2); 2955 awacs_rx_irq = irq_of_parse_and_map(io, 2);
2943 2956
2944 /* Hack for legacy crap that will be killed someday */ 2957 /* Hack for legacy crap that will be killed someday */
2945 awacs_node = io; 2958 of_node_put(awacs_node);
2959 awacs_node = of_node_get(io);
2946 2960
2947 /* if we have an awacs or screamer - probe the chip to make 2961 /* if we have an awacs or screamer - probe the chip to make
2948 * sure we have the right revision. 2962 * sure we have the right revision.
@@ -2973,24 +2987,26 @@ printk("dmasound_pmac: Awacs/Screamer Codec Mfct: %d Rev %d\n", mfg, rev);
2973 */ 2987 */
2974 2988
2975 if (info) { 2989 if (info) {
2976 unsigned int *prop, l; 2990 const unsigned int *prop;
2991 unsigned int l;
2977 2992
2978 sound_device_id = 0; 2993 sound_device_id = 0;
2979 /* device ID appears post g3 b&w */ 2994 /* device ID appears post g3 b&w */
2980 prop = (unsigned int *)get_property(info, "device-id", NULL); 2995 prop = of_get_property(info, "device-id", NULL);
2981 if (prop != 0) 2996 if (prop != 0)
2982 sound_device_id = *prop; 2997 sound_device_id = *prop;
2983 2998
2984 /* look for a property saying what sample rates 2999 /* look for a property saying what sample rates
2985 are available */ 3000 are available */
2986 3001
2987 prop = (unsigned int *)get_property(info, "sample-rates", &l); 3002 prop = of_get_property(info, "sample-rates", &l);
2988 if (prop == 0) 3003 if (prop == 0)
2989 prop = (unsigned int *) get_property 3004 prop = of_get_property(info, "output-frame-rates", &l);
2990 (info, "output-frame-rates", &l);
2991 3005
2992 /* if it's there use it to set up frame rates */ 3006 /* if it's there use it to set up frame rates */
2993 init_frame_rates(prop, l) ; 3007 init_frame_rates(prop, l) ;
3008 of_node_put(info);
3009 info = NULL;
2994 } 3010 }
2995 3011
2996 if (awacs) 3012 if (awacs)
@@ -3160,7 +3176,16 @@ printk("dmasound_pmac: Awacs/Screamer Codec Mfct: %d Rev %d\n", mfg, rev);
3160 */ 3176 */
3161 input_register_device(awacs_beep_dev); 3177 input_register_device(awacs_beep_dev);
3162 3178
3179 of_node_put(io);
3180
3163 return dmasound_init(); 3181 return dmasound_init();
3182
3183no_device:
3184 of_node_put(info);
3185 of_node_put(awacs_node);
3186 of_node_put(i2s_node);
3187 of_node_put(io);
3188 return -ENODEV ;
3164} 3189}
3165 3190
3166static void __exit dmasound_awacs_cleanup(void) 3191static void __exit dmasound_awacs_cleanup(void)
@@ -3179,6 +3204,8 @@ static void __exit dmasound_awacs_cleanup(void)
3179 } 3204 }
3180 dmasound_deinit(); 3205 dmasound_deinit();
3181 3206
3207 of_node_put(awacs_node);
3208 of_node_put(i2s_node);
3182} 3209}
3183 3210
3184MODULE_DESCRIPTION("PowerMac built-in audio driver."); 3211MODULE_DESCRIPTION("PowerMac built-in audio driver.");
diff --git a/sound/oss/dmasound/tas_common.c b/sound/oss/dmasound/tas_common.c
index 665e85b5562b..b295ef682192 100644
--- a/sound/oss/dmasound/tas_common.c
+++ b/sound/oss/dmasound/tas_common.c
@@ -41,7 +41,6 @@
41 41
42static u8 tas_i2c_address = 0x34; 42static u8 tas_i2c_address = 0x34;
43static struct i2c_client *tas_client; 43static struct i2c_client *tas_client;
44static struct device_node* tas_node;
45 44
46static int tas_attach_adapter(struct i2c_adapter *); 45static int tas_attach_adapter(struct i2c_adapter *);
47static int tas_detach_client(struct i2c_client *); 46static int tas_detach_client(struct i2c_client *);
@@ -190,17 +189,18 @@ tas_cleanup(void)
190int __init 189int __init
191tas_init(int driver_id, const char *driver_name) 190tas_init(int driver_id, const char *driver_name)
192{ 191{
193 u32* paddr; 192 const u32* paddr;
193 struct device_node *tas_node;
194 194
195 printk(KERN_INFO "tas driver [%s])\n", driver_name); 195 printk(KERN_INFO "tas driver [%s])\n", driver_name);
196 196
197#ifndef CONFIG_I2C_POWERMAC 197#ifndef CONFIG_I2C_POWERMAC
198 request_module("i2c-powermac"); 198 request_module("i2c-powermac");
199#endif 199#endif
200 tas_node = find_devices("deq"); 200 tas_node = of_find_node_by_name("deq");
201 if (tas_node == NULL) 201 if (tas_node == NULL)
202 return -ENODEV; 202 return -ENODEV;
203 paddr = (u32 *)get_property(tas_node, "i2c-address", NULL); 203 paddr = of_get_property(tas_node, "i2c-address", NULL);
204 if (paddr) { 204 if (paddr) {
205 tas_i2c_address = (*paddr) >> 1; 205 tas_i2c_address = (*paddr) >> 1;
206 printk(KERN_INFO "using i2c address: 0x%x from device-tree\n", 206 printk(KERN_INFO "using i2c address: 0x%x from device-tree\n",
@@ -208,6 +208,7 @@ tas_init(int driver_id, const char *driver_name)
208 } else 208 } else
209 printk(KERN_INFO "using i2c address: 0x%x (default)\n", 209 printk(KERN_INFO "using i2c address: 0x%x (default)\n",
210 tas_i2c_address); 210 tas_i2c_address);
211 of_node_put(tas_node);
211 212
212 return i2c_add_driver(&tas_driver); 213 return i2c_add_driver(&tas_driver);
213} 214}
diff --git a/sound/oss/dmasound/tas_ioctl.h b/sound/oss/dmasound/tas_ioctl.h
index dccae3a40e01..9d12b373b4a9 100644
--- a/sound/oss/dmasound/tas_ioctl.h
+++ b/sound/oss/dmasound/tas_ioctl.h
@@ -1,7 +1,6 @@
1#ifndef _TAS_IOCTL_H_ 1#ifndef _TAS_IOCTL_H_
2#define _TAS_IOCTL_H_ 2#define _TAS_IOCTL_H_
3 3
4#include <linux/i2c.h>
5#include <linux/soundcard.h> 4#include <linux/soundcard.h>
6 5
7 6
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c
index dcd8d6d2f56f..a9c23b2502ad 100644
--- a/sound/oss/soundcard.c
+++ b/sound/oss/soundcard.c
@@ -44,6 +44,7 @@
44#include <linux/smp_lock.h> 44#include <linux/smp_lock.h>
45#include <linux/module.h> 45#include <linux/module.h>
46#include <linux/mm.h> 46#include <linux/mm.h>
47#include <linux/device.h>
47 48
48/* 49/*
49 * This ought to be moved into include/asm/dma.h 50 * This ought to be moved into include/asm/dma.h
diff --git a/sound/pci/ca0106/ca0106_mixer.c b/sound/pci/ca0106/ca0106_mixer.c
index b913a1fb8c21..9c3a9c8d1dc2 100644
--- a/sound/pci/ca0106/ca0106_mixer.c
+++ b/sound/pci/ca0106/ca0106_mixer.c
@@ -62,7 +62,6 @@
62#include <linux/delay.h> 62#include <linux/delay.h>
63#include <linux/init.h> 63#include <linux/init.h>
64#include <linux/interrupt.h> 64#include <linux/interrupt.h>
65#include <linux/pci.h>
66#include <linux/slab.h> 65#include <linux/slab.h>
67#include <linux/moduleparam.h> 66#include <linux/moduleparam.h>
68#include <sound/core.h> 67#include <sound/core.h>
@@ -71,6 +70,7 @@
71#include <sound/ac97_codec.h> 70#include <sound/ac97_codec.h>
72#include <sound/info.h> 71#include <sound/info.h>
73#include <sound/tlv.h> 72#include <sound/tlv.h>
73#include <asm/io.h>
74 74
75#include "ca0106.h" 75#include "ca0106.h"
76 76
diff --git a/sound/pci/ca0106/ca0106_proc.c b/sound/pci/ca0106/ca0106_proc.c
index 75ca421eb3a1..ae80f51d8c4f 100644
--- a/sound/pci/ca0106/ca0106_proc.c
+++ b/sound/pci/ca0106/ca0106_proc.c
@@ -64,7 +64,6 @@
64#include <linux/delay.h> 64#include <linux/delay.h>
65#include <linux/init.h> 65#include <linux/init.h>
66#include <linux/interrupt.h> 66#include <linux/interrupt.h>
67#include <linux/pci.h>
68#include <linux/slab.h> 67#include <linux/slab.h>
69#include <linux/moduleparam.h> 68#include <linux/moduleparam.h>
70#include <sound/core.h> 69#include <sound/core.h>
@@ -73,6 +72,7 @@
73#include <sound/ac97_codec.h> 72#include <sound/ac97_codec.h>
74#include <sound/info.h> 73#include <sound/info.h>
75#include <sound/asoundef.h> 74#include <sound/asoundef.h>
75#include <asm/io.h>
76 76
77#include "ca0106.h" 77#include "ca0106.h"
78 78
diff --git a/sound/pci/cs46xx/dsp_spos.c b/sound/pci/cs46xx/dsp_spos.c
index 89c402770a1d..336e77e2600c 100644
--- a/sound/pci/cs46xx/dsp_spos.c
+++ b/sound/pci/cs46xx/dsp_spos.c
@@ -23,7 +23,6 @@
23#include <sound/driver.h> 23#include <sound/driver.h>
24#include <asm/io.h> 24#include <asm/io.h>
25#include <linux/delay.h> 25#include <linux/delay.h>
26#include <linux/pci.h>
27#include <linux/pm.h> 26#include <linux/pm.h>
28#include <linux/init.h> 27#include <linux/init.h>
29#include <linux/slab.h> 28#include <linux/slab.h>
diff --git a/sound/pci/cs46xx/dsp_spos_scb_lib.c b/sound/pci/cs46xx/dsp_spos_scb_lib.c
index 343f51d5311b..57e357de1500 100644
--- a/sound/pci/cs46xx/dsp_spos_scb_lib.c
+++ b/sound/pci/cs46xx/dsp_spos_scb_lib.c
@@ -24,7 +24,6 @@
24#include <sound/driver.h> 24#include <sound/driver.h>
25#include <asm/io.h> 25#include <asm/io.h>
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/pci.h>
28#include <linux/pm.h> 27#include <linux/pm.h>
29#include <linux/init.h> 28#include <linux/init.h>
30#include <linux/slab.h> 29#include <linux/slab.h>
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index 1589d2f2917f..1e5ff0cd3709 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -23,7 +23,6 @@
23#include <sound/driver.h> 23#include <sound/driver.h>
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/pci.h>
27#include <sound/core.h> 26#include <sound/core.h>
28#include "hda_codec.h" 27#include "hda_codec.h"
29#include "hda_local.h" 28#include "hda_local.h"
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c
index 17df4d0fe135..e313e685f161 100644
--- a/sound/pci/hda/hda_proc.c
+++ b/sound/pci/hda/hda_proc.c
@@ -23,7 +23,6 @@
23 23
24#include <sound/driver.h> 24#include <sound/driver.h>
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/pci.h>
27#include <sound/core.h> 26#include <sound/core.h>
28#include "hda_codec.h" 27#include "hda_codec.h"
29#include "hda_local.h" 28#include "hda_local.h"
diff --git a/sound/pci/hda/patch_atihdmi.c b/sound/pci/hda/patch_atihdmi.c
index 7333f275decd..831469d3a923 100644
--- a/sound/pci/hda/patch_atihdmi.c
+++ b/sound/pci/hda/patch_atihdmi.c
@@ -25,7 +25,6 @@
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/pci.h>
29#include <sound/core.h> 28#include <sound/core.h>
30#include "hda_codec.h" 29#include "hda_codec.h"
31#include "hda_local.h" 30#include "hda_local.h"
diff --git a/sound/pci/hda/patch_si3054.c b/sound/pci/hda/patch_si3054.c
index ed5e45e35963..6fcda9bcf0cf 100644
--- a/sound/pci/hda/patch_si3054.c
+++ b/sound/pci/hda/patch_si3054.c
@@ -26,7 +26,6 @@
26#include <linux/init.h> 26#include <linux/init.h>
27#include <linux/delay.h> 27#include <linux/delay.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/pci.h>
30#include <sound/core.h> 29#include <sound/core.h>
31#include "hda_codec.h" 30#include "hda_codec.h"
32#include "hda_local.h" 31#include "hda_local.h"
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index 4c839b031729..2b11ac8689b9 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -35,7 +35,6 @@
35#include <linux/init.h> 35#include <linux/init.h>
36#include <linux/delay.h> 36#include <linux/delay.h>
37#include <linux/slab.h> 37#include <linux/slab.h>
38#include <linux/pci.h>
39#include <sound/core.h> 38#include <sound/core.h>
40#include "hda_codec.h" 39#include "hda_codec.h"
41#include "hda_local.h" 40#include "hda_local.h"
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c
index c64af55865d4..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,8 +864,10 @@ 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;
867 unsigned int *prop, l; 868 struct device_node *dn;
869 const unsigned int *prop;
870 unsigned int l;
868 struct macio_chip* macio; 871 struct macio_chip* macio;
869 872
870 if (!machine_is(powermac)) 873 if (!machine_is(powermac))
@@ -890,22 +893,21 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
890 else if (machine_is_compatible("PowerBook1,1") 893 else if (machine_is_compatible("PowerBook1,1")
891 || machine_is_compatible("AAPL,PowerBook1998")) 894 || machine_is_compatible("AAPL,PowerBook1998"))
892 chip->is_pbook_G3 = 1; 895 chip->is_pbook_G3 = 1;
893 chip->node = find_devices("awacs"); 896 chip->node = of_find_node_by_name(NULL, "awacs");
894 if (chip->node) 897 sound = of_node_get(chip->node);
895 sound = chip->node;
896 898
897 /* 899 /*
898 * powermac G3 models have a node called "davbus" 900 * powermac G3 models have a node called "davbus"
899 * with a child called "sound". 901 * with a child called "sound".
900 */ 902 */
901 if (!chip->node) 903 if (!chip->node)
902 chip->node = find_devices("davbus"); 904 chip->node = of_find_node_by_name(NULL, "davbus");
903 /* 905 /*
904 * 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
905 * this seems to be what iBooks have 907 * this seems to be what iBooks have
906 */ 908 */
907 if (! chip->node) { 909 if (! chip->node) {
908 chip->node = find_devices("i2s-a"); 910 chip->node = of_find_node_by_name(NULL, "i2s-a");
909 if (chip->node && chip->node->parent && 911 if (chip->node && chip->node->parent &&
910 chip->node->parent->parent) { 912 chip->node->parent->parent) {
911 if (device_is_compatible(chip->node->parent->parent, 913 if (device_is_compatible(chip->node->parent->parent,
@@ -917,22 +919,25 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
917 return -ENODEV; 919 return -ENODEV;
918 920
919 if (!sound) { 921 if (!sound) {
920 sound = find_devices("sound"); 922 sound = of_find_node_by_name(NULL, "sound");
921 while (sound && sound->parent != chip->node) 923 while (sound && sound->parent != chip->node)
922 sound = sound->next; 924 sound = of_find_node_by_name(sound, "sound");
923 } 925 }
924 if (! sound) 926 if (! sound) {
927 of_node_put(chip->node);
925 return -ENODEV; 928 return -ENODEV;
926 prop = (unsigned int *) get_property(sound, "sub-frame", NULL); 929 }
930 prop = of_get_property(sound, "sub-frame", NULL);
927 if (prop && *prop < 16) 931 if (prop && *prop < 16)
928 chip->subframe = *prop; 932 chip->subframe = *prop;
929 prop = (unsigned int *) get_property(sound, "layout-id", NULL); 933 prop = of_get_property(sound, "layout-id", NULL);
930 if (prop) { 934 if (prop) {
931 /* partly deprecate snd-powermac, for those machines 935 /* partly deprecate snd-powermac, for those machines
932 * that have a layout-id property for now */ 936 * that have a layout-id property for now */
933 printk(KERN_INFO "snd-powermac no longer handles any " 937 printk(KERN_INFO "snd-powermac no longer handles any "
934 "machines with a layout-id property " 938 "machines with a layout-id property "
935 "in the device-tree, use snd-aoa.\n"); 939 "in the device-tree, use snd-aoa.\n");
940 of_node_put(chip->node);
936 return -ENODEV; 941 return -ENODEV;
937 } 942 }
938 /* This should be verified on older screamers */ 943 /* This should be verified on older screamers */
@@ -967,10 +972,12 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
967 chip->freq_table = tumbler_freqs; 972 chip->freq_table = tumbler_freqs;
968 chip->control_mask = MASK_IEPC | 0x11; /* disable IEE */ 973 chip->control_mask = MASK_IEPC | 0x11; /* disable IEE */
969 } 974 }
970 prop = (unsigned int *)get_property(sound, "device-id", NULL); 975 prop = of_get_property(sound, "device-id", NULL);
971 if (prop) 976 if (prop)
972 chip->device_id = *prop; 977 chip->device_id = *prop;
973 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);
974 981
975 /* 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
976 * for now ... 983 * for now ...
@@ -997,10 +1004,9 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
997 1004
998 /* look for a property saying what sample rates 1005 /* look for a property saying what sample rates
999 are available */ 1006 are available */
1000 prop = (unsigned int *) get_property(sound, "sample-rates", &l); 1007 prop = of_get_property(sound, "sample-rates", &l);
1001 if (! prop) 1008 if (! prop)
1002 prop = (unsigned int *) get_property(sound, 1009 prop = of_get_property(sound, "output-frame-rates", &l);
1003 "output-frame-rates", &l);
1004 if (prop) { 1010 if (prop) {
1005 int i; 1011 int i;
1006 chip->freqs_ok = 0; 1012 chip->freqs_ok = 0;
@@ -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
diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c
index 8f074c7936e6..54e333fbb1d0 100644
--- a/sound/ppc/tumbler.c
+++ b/sound/ppc/tumbler.c
@@ -1031,32 +1031,40 @@ static irqreturn_t headphone_intr(int irq, void *devid)
1031/* look for audio-gpio device */ 1031/* look for audio-gpio device */
1032static struct device_node *find_audio_device(const char *name) 1032static struct device_node *find_audio_device(const char *name)
1033{ 1033{
1034 struct device_node *gpiop;
1034 struct device_node *np; 1035 struct device_node *np;
1035 1036
1036 if (! (np = find_devices("gpio"))) 1037 gpiop = of_find_node_by_name(NULL, "gpio");
1038 if (! gpiop)
1037 return NULL; 1039 return NULL;
1038 1040
1039 for (np = np->child; np; np = np->sibling) { 1041 for (np = of_get_next_child(gpiop, NULL); np;
1040 const char *property = get_property(np, "audio-gpio", NULL); 1042 np = of_get_next_child(gpiop, np)) {
1043 const char *property = of_get_property(np, "audio-gpio", NULL);
1041 if (property && strcmp(property, name) == 0) 1044 if (property && strcmp(property, name) == 0)
1042 return np; 1045 break;
1043 } 1046 }
1044 return NULL; 1047 of_node_put(gpiop);
1048 return np;
1045} 1049}
1046 1050
1047/* look for audio-gpio device */ 1051/* look for audio-gpio device */
1048static struct device_node *find_compatible_audio_device(const char *name) 1052static struct device_node *find_compatible_audio_device(const char *name)
1049{ 1053{
1054 struct device_node *gpiop;
1050 struct device_node *np; 1055 struct device_node *np;
1051 1056
1052 if (! (np = find_devices("gpio"))) 1057 gpiop = of_find_node_by_name(NULL, "gpio");
1058 if (!gpiop)
1053 return NULL; 1059 return NULL;
1054 1060
1055 for (np = np->child; np; np = np->sibling) { 1061 for (np = of_get_next_child(gpiop, NULL); np;
1062 np = of_get_next_child(gpiop, np)) {
1056 if (device_is_compatible(np, name)) 1063 if (device_is_compatible(np, name))
1057 return np; 1064 break;
1058 } 1065 }
1059 return NULL; 1066 of_node_put(gpiop);
1067 return np;
1060} 1068}
1061 1069
1062/* find an audio device and get its address */ 1070/* find an audio device and get its address */
@@ -1066,6 +1074,7 @@ static long tumbler_find_device(const char *device, const char *platform,
1066 struct device_node *node; 1074 struct device_node *node;
1067 const u32 *base; 1075 const u32 *base;
1068 u32 addr; 1076 u32 addr;
1077 long ret;
1069 1078
1070 if (is_compatible) 1079 if (is_compatible)
1071 node = find_compatible_audio_device(device); 1080 node = find_compatible_audio_device(device);
@@ -1077,12 +1086,13 @@ static long tumbler_find_device(const char *device, const char *platform,
1077 return -ENODEV; 1086 return -ENODEV;
1078 } 1087 }
1079 1088
1080 base = get_property(node, "AAPL,address", NULL); 1089 base = of_get_property(node, "AAPL,address", NULL);
1081 if (! base) { 1090 if (! base) {
1082 base = get_property(node, "reg", NULL); 1091 base = of_get_property(node, "reg", NULL);
1083 if (!base) { 1092 if (!base) {
1084 DBG("(E) cannot find address for device %s !\n", device); 1093 DBG("(E) cannot find address for device %s !\n", device);
1085 snd_printd("cannot find address for device %s\n", device); 1094 snd_printd("cannot find address for device %s\n", device);
1095 of_node_put(node);
1086 return -ENODEV; 1096 return -ENODEV;
1087 } 1097 }
1088 addr = *base; 1098 addr = *base;
@@ -1093,7 +1103,7 @@ static long tumbler_find_device(const char *device, const char *platform,
1093 1103
1094 gp->addr = addr & 0x0000ffff; 1104 gp->addr = addr & 0x0000ffff;
1095 /* Try to find the active state, default to 0 ! */ 1105 /* Try to find the active state, default to 0 ! */
1096 base = get_property(node, "audio-gpio-active-state", NULL); 1106 base = of_get_property(node, "audio-gpio-active-state", NULL);
1097 if (base) { 1107 if (base) {
1098 gp->active_state = *base; 1108 gp->active_state = *base;
1099 gp->active_val = (*base) ? 0x5 : 0x4; 1109 gp->active_val = (*base) ? 0x5 : 0x4;
@@ -1108,7 +1118,7 @@ static long tumbler_find_device(const char *device, const char *platform,
1108 * as we don't yet have an interpreter for these things 1118 * as we don't yet have an interpreter for these things
1109 */ 1119 */
1110 if (platform) 1120 if (platform)
1111 prop = get_property(node, platform, NULL); 1121 prop = of_get_property(node, platform, NULL);
1112 if (prop) { 1122 if (prop) {
1113 if (prop[3] == 0x9 && prop[4] == 0x9) { 1123 if (prop[3] == 0x9 && prop[4] == 0x9) {
1114 gp->active_val = 0xd; 1124 gp->active_val = 0xd;
@@ -1124,7 +1134,9 @@ static long tumbler_find_device(const char *device, const char *platform,
1124 DBG("(I) GPIO device %s found, offset: %x, active state: %d !\n", 1134 DBG("(I) GPIO device %s found, offset: %x, active state: %d !\n",
1125 device, gp->addr, gp->active_state); 1135 device, gp->addr, gp->active_state);
1126 1136
1127 return irq_of_parse_and_map(node, 0); 1137 ret = irq_of_parse_and_map(node, 0);
1138 of_node_put(node);
1139 return ret;
1128} 1140}
1129 1141
1130/* reset audio */ 1142/* reset audio */
@@ -1310,7 +1322,7 @@ int __init snd_pmac_tumbler_init(struct snd_pmac *chip)
1310{ 1322{
1311 int i, err; 1323 int i, err;
1312 struct pmac_tumbler *mix; 1324 struct pmac_tumbler *mix;
1313 u32 *paddr; 1325 const u32 *paddr;
1314 struct device_node *tas_node, *np; 1326 struct device_node *tas_node, *np;
1315 char *chipname; 1327 char *chipname;
1316 1328
@@ -1331,9 +1343,9 @@ int __init snd_pmac_tumbler_init(struct snd_pmac *chip)
1331 1343
1332 for (np = chip->node->child; np; np = np->sibling) { 1344 for (np = chip->node->child; np; np = np->sibling) {
1333 if (!strcmp(np->name, "sound")) { 1345 if (!strcmp(np->name, "sound")) {
1334 if (get_property(np, "has-anded-reset", NULL)) 1346 if (of_get_property(np, "has-anded-reset", NULL))
1335 mix->anded_reset = 1; 1347 mix->anded_reset = 1;
1336 if (get_property(np, "layout-id", NULL)) 1348 if (of_get_property(np, "layout-id", NULL))
1337 mix->reset_on_sleep = 0; 1349 mix->reset_on_sleep = 0;
1338 break; 1350 break;
1339 } 1351 }
@@ -1342,19 +1354,20 @@ int __init snd_pmac_tumbler_init(struct snd_pmac *chip)
1342 return err; 1354 return err;
1343 1355
1344 /* set up TAS */ 1356 /* set up TAS */
1345 tas_node = find_devices("deq"); 1357 tas_node = of_find_node_by_name(NULL, "deq");
1346 if (tas_node == NULL) 1358 if (tas_node == NULL)
1347 tas_node = find_devices("codec"); 1359 tas_node = of_find_node_by_name(NULL, "codec");
1348 if (tas_node == NULL) 1360 if (tas_node == NULL)
1349 return -ENODEV; 1361 return -ENODEV;
1350 1362
1351 paddr = (u32 *)get_property(tas_node, "i2c-address", NULL); 1363 paddr = of_get_property(tas_node, "i2c-address", NULL);
1352 if (paddr == NULL) 1364 if (paddr == NULL)
1353 paddr = (u32 *)get_property(tas_node, "reg", NULL); 1365 paddr = of_get_property(tas_node, "reg", NULL);
1354 if (paddr) 1366 if (paddr)
1355 mix->i2c.addr = (*paddr) >> 1; 1367 mix->i2c.addr = (*paddr) >> 1;
1356 else 1368 else
1357 mix->i2c.addr = TAS_I2C_ADDR; 1369 mix->i2c.addr = TAS_I2C_ADDR;
1370 of_node_put(tas_node);
1358 1371
1359 DBG("(I) TAS i2c address is: %x\n", mix->i2c.addr); 1372 DBG("(I) TAS i2c address is: %x\n", mix->i2c.addr);
1360 1373
diff --git a/sound/sparc/amd7930.c b/sound/sparc/amd7930.c
index c899786f30f5..07962a35f241 100644
--- a/sound/sparc/amd7930.c
+++ b/sound/sparc/amd7930.c
@@ -1067,8 +1067,8 @@ out_err:
1067 1067
1068static int __devinit amd7930_obio_attach(struct device_node *dp) 1068static int __devinit amd7930_obio_attach(struct device_node *dp)
1069{ 1069{
1070 struct linux_prom_registers *regs; 1070 const struct linux_prom_registers *regs;
1071 struct linux_prom_irqs *irqp; 1071 const struct linux_prom_irqs *irqp;
1072 struct resource res, *rp; 1072 struct resource res, *rp;
1073 int len; 1073 int len;
1074 1074
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c
index f5956d557f70..900a00de35fd 100644
--- a/sound/sparc/cs4231.c
+++ b/sound/sparc/cs4231.c
@@ -2284,7 +2284,7 @@ static int __init cs4231_init(void)
2284 if (!strcmp(edev->prom_node->name, "SUNW,CS4231")) { 2284 if (!strcmp(edev->prom_node->name, "SUNW,CS4231")) {
2285 match = 1; 2285 match = 1;
2286 } else if (!strcmp(edev->prom_node->name, "audio")) { 2286 } else if (!strcmp(edev->prom_node->name, "audio")) {
2287 char *compat; 2287 const char *compat;
2288 2288
2289 compat = of_get_property(edev->prom_node, 2289 compat = of_get_property(edev->prom_node,
2290 "compatible", NULL); 2290 "compatible", NULL);