Commit 157ab88e authored by Rob Herring's avatar Rob Herring Committed by Takashi Iwai

ALSA: aoa: Use of_node_name_eq for node name comparisons

Convert string compares of DT node names to use of_node_name_eq helper
instead. This removes direct access to the node name pointer.

A couple of open coded iterating thru the child node names are converted
to use for_each_child_of_node() instead.
Signed-off-by: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 192a7122
...@@ -776,7 +776,7 @@ static int check_codec(struct aoa_codec *codec, ...@@ -776,7 +776,7 @@ static int check_codec(struct aoa_codec *codec,
struct codec_connection *cc; struct codec_connection *cc;
/* if the codec has a 'codec' node, we require a reference */ /* if the codec has a 'codec' node, we require a reference */
if (codec->node && (strcmp(codec->node->name, "codec") == 0)) { if (of_node_name_eq(codec->node, "codec")) {
snprintf(propname, sizeof(propname), snprintf(propname, sizeof(propname),
"platform-%s-codec-ref", codec->name); "platform-%s-codec-ref", codec->name);
ref = of_get_property(ldev->sound, propname, NULL); ref = of_get_property(ldev->sound, propname, NULL);
......
...@@ -154,7 +154,7 @@ static int i2sbus_add_dev(struct macio_dev *macio, ...@@ -154,7 +154,7 @@ static int i2sbus_add_dev(struct macio_dev *macio,
struct device_node *np) struct device_node *np)
{ {
struct i2sbus_dev *dev; struct i2sbus_dev *dev;
struct device_node *child = NULL, *sound = NULL; struct device_node *child, *sound = NULL;
struct resource *r; struct resource *r;
int i, layout = 0, rlen, ok = force; int i, layout = 0, rlen, ok = force;
char node_name[6]; char node_name[6];
...@@ -177,8 +177,8 @@ static int i2sbus_add_dev(struct macio_dev *macio, ...@@ -177,8 +177,8 @@ static int i2sbus_add_dev(struct macio_dev *macio,
return 0; return 0;
i = 0; i = 0;
while ((child = of_get_next_child(np, child))) { for_each_child_of_node(np, child) {
if (strcmp(child->name, "sound") == 0) { if (of_node_name_eq(child, "sound")) {
i++; i++;
sound = child; sound = child;
} }
......
...@@ -908,7 +908,7 @@ static void detect_byte_swap(struct snd_pmac *chip) ...@@ -908,7 +908,7 @@ static void detect_byte_swap(struct snd_pmac *chip)
/* if seems that Keylargo can't byte-swap */ /* if seems that Keylargo can't byte-swap */
for (mio = chip->node->parent; mio; mio = mio->parent) { for (mio = chip->node->parent; mio; mio = mio->parent) {
if (strcmp(mio->name, "mac-io") == 0) { if (of_node_name_eq(mio, "mac-io")) {
if (of_device_is_compatible(mio, "Keylargo")) if (of_device_is_compatible(mio, "Keylargo"))
chip->can_byte_swap = 0; chip->can_byte_swap = 0;
break; break;
...@@ -1313,7 +1313,7 @@ int snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return) ...@@ -1313,7 +1313,7 @@ int snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return)
} else if (chip->is_pbook_G3) { } else if (chip->is_pbook_G3) {
struct device_node* mio; struct device_node* mio;
for (mio = chip->node->parent; mio; mio = mio->parent) { for (mio = chip->node->parent; mio; mio = mio->parent) {
if (strcmp(mio->name, "mac-io") == 0) { if (of_node_name_eq(mio, "mac-io")) {
struct resource r; struct resource r;
if (of_address_to_resource(mio, 0, &r) == 0) if (of_address_to_resource(mio, 0, &r) == 0)
chip->macio_base = chip->macio_base =
......
...@@ -1365,8 +1365,8 @@ int snd_pmac_tumbler_init(struct snd_pmac *chip) ...@@ -1365,8 +1365,8 @@ int snd_pmac_tumbler_init(struct snd_pmac *chip)
mix->anded_reset = 0; mix->anded_reset = 0;
mix->reset_on_sleep = 1; mix->reset_on_sleep = 1;
for (np = chip->node->child; np; np = np->sibling) { for_each_child_of_node(chip->node, np) {
if (!strcmp(np->name, "sound")) { if (of_node_name_eq(np, "sound")) {
if (of_get_property(np, "has-anded-reset", NULL)) if (of_get_property(np, "has-anded-reset", NULL))
mix->anded_reset = 1; mix->anded_reset = 1;
if (of_get_property(np, "layout-id", NULL)) if (of_get_property(np, "layout-id", NULL))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment