diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2007-04-23 23:53:04 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-04-24 08:09:02 -0400 |
commit | 30686ba6d56858657829d3eb524ed73e5dc98d2b (patch) | |
tree | 42bf3cea4dc7028fec30377560b367cd8274825e /sound/ppc/tumbler.c | |
parent | 1658ab66781d918f604c6069c5cf9a94b6f52f84 (diff) |
[POWERPC] Remove old interface find_devices
Replace uses with of_find_node_by_name and for_each_node_by_name.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'sound/ppc/tumbler.c')
-rw-r--r-- | sound/ppc/tumbler.c | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c index 8e01b558131d..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 */ |
1032 | static struct device_node *find_audio_device(const char *name) | 1032 | static 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; |
1042 | np = of_get_next_child(gpiop, np)) { | ||
1040 | const char *property = of_get_property(np, "audio-gpio", NULL); | 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 */ |
1048 | static struct device_node *find_compatible_audio_device(const char *name) | 1052 | static 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); |
@@ -1083,6 +1092,7 @@ static long tumbler_find_device(const char *device, const char *platform, | |||
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; |
@@ -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 */ |
@@ -1342,9 +1354,9 @@ 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 | ||
@@ -1355,6 +1367,7 @@ int __init snd_pmac_tumbler_init(struct snd_pmac *chip) | |||
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 | ||