From patchwork Wed Dec 5 19:50:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring \(Arm\)" X-Patchwork-Id: 152954 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp9695541ljp; Wed, 5 Dec 2018 11:51:33 -0800 (PST) X-Google-Smtp-Source: AFSGD/U6y1bOUqqj8CXK5pLTANXxLJdp+PkvtCVaiHSWJawo6QIaN+TuSv8+b9m2IazBMkyabhZh X-Received: by 2002:a7b:cb18:: with SMTP id u24mr7096744wmj.138.1544039493439; Wed, 05 Dec 2018 11:51:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544039493; cv=none; d=google.com; s=arc-20160816; b=vLBLNA2c8nwO1cQUCYRRavJmfyqem+VwHhiEy6aSr1G8/aEa7wI80Swvl4B58iS5Vn vjYALpVomATxnSnuUqTBT8bzMaZUCW47tsxHAEAtT/usDG8biYjrAgPpjcuC8wCAr4VM VAPORpjzRa9sdvwEqRzi7y18IPhV2Y7TmV7zfQxKJE9oQpMYc9MtfprhrAglx4TPDLEx AOZsKtcX7WsLQatVQxqW268YUoiLqi2CgkLLNP3asoi6SoELCkqyt0LWirtLZWPHgI7E OSkn4Hjm5VD36Fr61I1vCBxPKuI+G4/kDkTc47V55qr2h8FWu8j5YumZDGSon9bSYnOu nAlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :cc:mime-version:message-id:date:to:from:delivered-to; bh=3PaMGgoQ9aSphPCRV2G16FEIkBdQJZSsJJt9qaJOx1o=; b=AWDgIW/JdMJZeu1M+PTp5hX+cgB7QugqW/+IVJGDicZcKVa12xzuWtUxqKMIJ1pzL7 6ZURONI+Un0SK/DV9Ss8G6QQnXZFvOi2TK+ZBgRAKs5iQkKOf/oGttnPBTzpN/bJlZdW WUCYNUOzbIvIBu1DmT24RD9ehXMX09QO0tVbptACLGsGZ372kZsSz3RdAj8NQu2ezhjs q8Z/h5q/MM+Nv0jlmn7y8+Dj1scCRlNXFBIE1HDsayTQ2X8g1qxUEk+eO9CzQqzOLTez QREyzAAEz/EDw43LEAlOr1JhdOffWewj1VgCAhXUdwroi4I5M6OuLxhMr2J2qpiQBcmc ZiyQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id x16si16159889wrv.22.2018.12.05.11.51.33; Wed, 05 Dec 2018 11:51:33 -0800 (PST) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 865DB267C3B; Wed, 5 Dec 2018 20:51:31 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 2D2E6267BA5; Wed, 5 Dec 2018 20:51:29 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS autolearn=disabled version=3.4.0 Received: from mail-oi1-f194.google.com (mail-oi1-f194.google.com [209.85.167.194]) by alsa0.perex.cz (Postfix) with ESMTP id 235FE267BA5 for ; Wed, 5 Dec 2018 20:51:25 +0100 (CET) Received: by mail-oi1-f194.google.com with SMTP id u18so18624460oie.10 for ; Wed, 05 Dec 2018 11:51:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=qMVKbQQ2IkPQlwBHD7jq1zN5axWgXmiq34kQVyq7TYw=; b=N8jIJpmSG6IommgQERexXRpNFZZAuJFvVcYWjZrYs7DRwcgl7+JgeoH/upEEp+rq+O WN5SQdGcty6y8asxdVM3CpnGKOsgvBKP1NryRLk/GDlMlx23B72jPz/udNY8l8bNPwBj JrQhpVbwdeUUDpv/6Vuo/9y/Le7pzGNYbPU2NE2M4BqqwBiopgUX/Y7mps7lHlQzKkCc 3Zn1ZpF1V1eQ1ROl2hjKL9U+QMegQSZQD7hbBS+xrGsMEq0xuvBtmM45RaCqvwOnPjcs J1Fxk3E2xYlTZpCfQ6dHNGYjh3bsRMM3p8O+VQGOYZ9U69OvZPXPch6Rz9CeE5sLwJq4 3eGQ== X-Gm-Message-State: AA+aEWbWcqhGuK6y2XK++QLdC3/HqU20wnkB62znOyJp4jxIi2Dzts7r tj7nRY6jRBXakY0RD71YjXS2IHFRBQ== X-Received: by 2002:aca:b642:: with SMTP id g63mr14811654oif.195.1544039485103; Wed, 05 Dec 2018 11:51:25 -0800 (PST) Received: from xps15.herring.priv (24-155-109-49.dyn.grandenetworks.net. [24.155.109.49]) by smtp.googlemail.com with ESMTPSA id k13sm25759879otj.19.2018.12.05.11.51.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 11:51:24 -0800 (PST) From: Rob Herring To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Date: Wed, 5 Dec 2018 13:50:46 -0600 Message-Id: <20181205195050.4759-30-robh@kernel.org> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Michael Ellerman , Takashi Iwai , Paul Mackerras , Benjamin Herrenschmidt , Johannes Berg , linuxppc-dev@lists.ozlabs.org Subject: [alsa-devel] [PATCH] ALSA: Use of_node_name_eq for node name comparisons X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org 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. Cc: Johannes Berg Cc: Jaroslav Kysela Cc: Takashi Iwai Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: linuxppc-dev@lists.ozlabs.org Cc: alsa-devel@alsa-project.org Signed-off-by: Rob Herring --- sound/aoa/fabrics/layout.c | 2 +- sound/aoa/soundbus/i2sbus/core.c | 6 +++--- sound/ppc/pmac.c | 4 ++-- sound/ppc/tumbler.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) -- 2.19.1 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/aoa/fabrics/layout.c b/sound/aoa/fabrics/layout.c index 3a23fd032611..8797d42e2b76 100644 --- a/sound/aoa/fabrics/layout.c +++ b/sound/aoa/fabrics/layout.c @@ -776,7 +776,7 @@ static int check_codec(struct aoa_codec *codec, struct codec_connection *cc; /* 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), "platform-%s-codec-ref", codec->name); ref = of_get_property(ldev->sound, propname, NULL); diff --git a/sound/aoa/soundbus/i2sbus/core.c b/sound/aoa/soundbus/i2sbus/core.c index bd7c5029fc59..c3f57a3fb1a5 100644 --- a/sound/aoa/soundbus/i2sbus/core.c +++ b/sound/aoa/soundbus/i2sbus/core.c @@ -154,7 +154,7 @@ static int i2sbus_add_dev(struct macio_dev *macio, struct device_node *np) { struct i2sbus_dev *dev; - struct device_node *child = NULL, *sound = NULL; + struct device_node *child, *sound = NULL; struct resource *r; int i, layout = 0, rlen, ok = force; char node_name[6]; @@ -177,8 +177,8 @@ static int i2sbus_add_dev(struct macio_dev *macio, return 0; i = 0; - while ((child = of_get_next_child(np, child))) { - if (strcmp(child->name, "sound") == 0) { + for_each_child_of_node(np, child) { + if (of_node_name_eq(child, "sound")) { i++; sound = child; } diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c index 48dd44f8e914..d692e4070167 100644 --- a/sound/ppc/pmac.c +++ b/sound/ppc/pmac.c @@ -908,7 +908,7 @@ static void detect_byte_swap(struct snd_pmac *chip) /* if seems that Keylargo can't byte-swap */ 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")) chip->can_byte_swap = 0; break; @@ -1313,7 +1313,7 @@ int snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return) } else if (chip->is_pbook_G3) { struct device_node* mio; 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; if (of_address_to_resource(mio, 0, &r) == 0) chip->macio_base = diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c index 0779a2912237..6d7ffffcce95 100644 --- a/sound/ppc/tumbler.c +++ b/sound/ppc/tumbler.c @@ -1365,8 +1365,8 @@ int snd_pmac_tumbler_init(struct snd_pmac *chip) mix->anded_reset = 0; mix->reset_on_sleep = 1; - for (np = chip->node->child; np; np = np->sibling) { - if (!strcmp(np->name, "sound")) { + for_each_child_of_node(chip->node, np) { + if (of_node_name_eq(np, "sound")) { if (of_get_property(np, "has-anded-reset", NULL)) mix->anded_reset = 1; if (of_get_property(np, "layout-id", NULL))