From patchwork Wed Nov 7 22:31:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 150455 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp93178ljp; Wed, 7 Nov 2018 14:32:04 -0800 (PST) X-Google-Smtp-Source: AJdET5e6aXcxDPNBdMmAut7rbeA0/Q6l9U5u5odGQTcRVJYE8KO4QFxjwUR4WA7rzuYbWBnqednT X-Received: by 2002:a62:1c1:: with SMTP id 184-v6mr2151530pfb.242.1541629924107; Wed, 07 Nov 2018 14:32:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541629924; cv=none; d=google.com; s=arc-20160816; b=luq2kR5zCJk2gpJKtkcDFZnbumj3vXLFjIDlfIYkkyXQG6vZtbSrP0jxULZ9aMOwd7 XzrtwJb0f2sOv2CO5N1+T08hmg69ZBwRvpiljrsgy6FA/dF7NjHewxPCH5B3C5GGLrvS aRqkpK+ao4U7+JUdy0E6XZsg8Z9UT4+MsxXKFaZxDVp4QqX6+s0OsHOvDhbavdD8HWbk KH+YkRawP+dLdVRzHu8OmGwzag/OCoENdVgI1f2ITRa6MLSwdqt+jw3DjoWbLXylr80D wHYFioBPNlGD+ge+JYPhN/L/Z95Mi0XxbjQ6Vdxd8/9+c75a0ITGgCJMDtlSQy7QU9o8 +T6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Vbn4w3Psg8cV69QaXnkF86KfcYB0GciUjDPGNvuO0j8=; b=fmjvMr6ecnhe8RZ3WBnzceH9pLp56Ua81u5wqPF+47oRtVgBEVXXQij5RNSFnWdEmN M3I/Wf+B9TTyo/8gt3pRkTI3gjEY3SjZnKHGnEG8uWGcB87O5iQlzMQ1nRllVnrdbAwe tkV9JCFh+7mPE5ykFj8+uAAATtwXQ7P1D/RvVkc3s0tiPAnjKvDVJAl2kAw6IAj8G/hE PMgDf8ffNHMSyT/LgCjvVId+kQ0312u7ma/bx6rRfIk83jLICJdP2+pOc0Maq4vx8rfv fkX9abjJ9DNmiRvSIHWRlgOyBvD/VfKEATz4fmcAjWqoWCNenfjRWcS32tA0s1115IRt cJhg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 62-v6si1988889ply.423.2018.11.07.14.32.03; Wed, 07 Nov 2018 14:32:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728293AbeKHIE2 (ORCPT + 32 others); Thu, 8 Nov 2018 03:04:28 -0500 Received: from mail-oi1-f194.google.com ([209.85.167.194]:34788 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728184AbeKHIE1 (ORCPT ); Thu, 8 Nov 2018 03:04:27 -0500 Received: by mail-oi1-f194.google.com with SMTP id i138-v6so12291496oib.1; Wed, 07 Nov 2018 14:32:00 -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:in-reply-to :references:mime-version:content-transfer-encoding; bh=Vbn4w3Psg8cV69QaXnkF86KfcYB0GciUjDPGNvuO0j8=; b=gR3DopgJnJ7ef9NuK/4CgJH9S49ypr97xHF6shlppV8mgpEMDGB13YbYXXeen50O6h +0CpbiXsdg11Y2tkDBbxolJys3Usmuc71qrp18b6FuMVAP2M2zJ7mfilNYiNlOR4pfg5 6Y1V+hXZ8v8RjN6WDyOpOOGbPVN4P7ZQwdpQP8dtghQOGz5Rw9PNWTcMWNTi/wCvP0Qi r5KEwLCeNre+cEcJ6V491KSuW5q/9JBbZZ1xlN7Ua2O+y7xxsLYHqwU1GFFsIg+4XvDY bIl0Or6l2mRtiLXGXaQylqkUdzZkZTXoPjqSbnOjlwKAFhuCgdFDmhpIHmc6h/R2l8Mx WxoQ== X-Gm-Message-State: AGRZ1gJcxuqHpjerjhXZ8DJ/zPuwLYiYdyVxh2jhoCZvgJwBnvflgjyj JqZVAs8EXwEfDJ6F8/+nuxwdizE= X-Received: by 2002:aca:6c4c:: with SMTP id h73-v6mr1280771oic.156.1541629920001; Wed, 07 Nov 2018 14:32:00 -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 f9sm750959oth.17.2018.11.07.14.31.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Nov 2018 14:31:59 -0800 (PST) From: Rob Herring To: "David S. Miller" Cc: Frank Rowand , linux-kernel@vger.kernel.org, sparclinux@vger.kernel.org Subject: [PATCH 6/8] sparc: Use of_node_name_eq for node name comparisons Date: Wed, 7 Nov 2018 16:31:49 -0600 Message-Id: <20181107223151.14991-7-robh@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181107223151.14991-1-robh@kernel.org> References: <20181107223151.14991-1-robh@kernel.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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. Cc: "David S. Miller" Cc: sparclinux@vger.kernel.org Signed-off-by: Rob Herring --- arch/sparc/kernel/auxio_64.c | 4 ++-- arch/sparc/kernel/central.c | 2 +- arch/sparc/kernel/irq_64.c | 2 +- arch/sparc/kernel/of_device_32.c | 8 ++++---- arch/sparc/kernel/of_device_64.c | 20 ++++++++++---------- arch/sparc/kernel/of_device_common.c | 4 ++-- arch/sparc/kernel/pci.c | 4 ++-- arch/sparc/kernel/pci_sabre.c | 2 +- arch/sparc/kernel/prom_64.c | 4 ++-- arch/sparc/kernel/prom_irqtrans.c | 18 +++++++++--------- arch/sparc/kernel/sun4d_irq.c | 6 +++--- arch/sparc/kernel/time_64.c | 4 ++-- 12 files changed, 39 insertions(+), 39 deletions(-) -- 2.19.1 diff --git a/arch/sparc/kernel/auxio_64.c b/arch/sparc/kernel/auxio_64.c index e1b10f88ffb4..4843f48bfe85 100644 --- a/arch/sparc/kernel/auxio_64.c +++ b/arch/sparc/kernel/auxio_64.c @@ -108,10 +108,10 @@ static int auxio_probe(struct platform_device *dev) struct device_node *dp = dev->dev.of_node; unsigned long size; - if (!strcmp(dp->parent->name, "ebus")) { + if (of_node_name_eq(dp->parent, "ebus")) { auxio_devtype = AUXIO_TYPE_EBUS; size = sizeof(u32); - } else if (!strcmp(dp->parent->name, "sbus")) { + } else if (of_node_name_eq(dp->parent, "sbus")) { auxio_devtype = AUXIO_TYPE_SBUS; size = 1; } else { diff --git a/arch/sparc/kernel/central.c b/arch/sparc/kernel/central.c index 38ae4fdc9eb4..bfae98ab8638 100644 --- a/arch/sparc/kernel/central.c +++ b/arch/sparc/kernel/central.c @@ -168,7 +168,7 @@ static int fhc_probe(struct platform_device *op) goto out; } - if (!strcmp(op->dev.of_node->parent->name, "central")) + if (of_node_name_eq(op->dev.of_node->parent, "central")) p->central = true; p->pregs = of_ioremap(&op->resource[0], 0, diff --git a/arch/sparc/kernel/irq_64.c b/arch/sparc/kernel/irq_64.c index 713670e6d13d..3ec9f1402aad 100644 --- a/arch/sparc/kernel/irq_64.c +++ b/arch/sparc/kernel/irq_64.c @@ -915,7 +915,7 @@ static void map_prom_timers(void) dp = of_find_node_by_path("/"); dp = dp->child; while (dp) { - if (!strcmp(dp->name, "counter-timer")) + if (of_node_name_eq(dp, "counter-timer")) break; dp = dp->sibling; } diff --git a/arch/sparc/kernel/of_device_32.c b/arch/sparc/kernel/of_device_32.c index ab133e2753ab..dc5b1b0ec659 100644 --- a/arch/sparc/kernel/of_device_32.c +++ b/arch/sparc/kernel/of_device_32.c @@ -232,10 +232,10 @@ static int __init use_1to1_mapping(struct device_node *pp) * But, we should still pass the translation work up * to the SBUS itself. */ - if (!strcmp(pp->name, "dma") || - !strcmp(pp->name, "espdma") || - !strcmp(pp->name, "ledma") || - !strcmp(pp->name, "lebuffer")) + if (of_node_name_eq(pp, "dma") || + of_node_name_eq(pp, "espdma") || + of_node_name_eq(pp, "ledma") || + of_node_name_eq(pp, "lebuffer")) return 0; return 1; diff --git a/arch/sparc/kernel/of_device_64.c b/arch/sparc/kernel/of_device_64.c index 2353cb7bc40f..4b5eabb20ac8 100644 --- a/arch/sparc/kernel/of_device_64.c +++ b/arch/sparc/kernel/of_device_64.c @@ -46,7 +46,7 @@ EXPORT_SYMBOL(of_iounmap); static int of_bus_pci_match(struct device_node *np) { - if (!strcmp(np->name, "pci")) { + if (of_node_name_eq(np, "pci")) { const char *model = of_get_property(np, "model", NULL); if (model && !strcmp(model, "SUNW,simba")) @@ -77,7 +77,7 @@ static int of_bus_simba_match(struct device_node *np) /* Treat PCI busses lacking ranges property just like * simba. */ - if (!strcmp(np->name, "pci")) { + if (of_node_name_eq(np, "pci")) { if (!of_find_property(np, "ranges", NULL)) return 1; } @@ -170,8 +170,8 @@ static unsigned long of_bus_pci_get_flags(const u32 *addr, unsigned long flags) */ static int of_bus_fhc_match(struct device_node *np) { - return !strcmp(np->name, "fhc") || - !strcmp(np->name, "central"); + return of_node_name_eq(np, "fhc") || + of_node_name_eq(np, "central"); } #define of_bus_fhc_count_cells of_bus_sbus_count_cells @@ -295,17 +295,17 @@ static int __init use_1to1_mapping(struct device_node *pp) * But, we should still pass the translation work up * to the SBUS itself. */ - if (!strcmp(pp->name, "dma") || - !strcmp(pp->name, "espdma") || - !strcmp(pp->name, "ledma") || - !strcmp(pp->name, "lebuffer")) + if (of_node_name_eq(pp, "dma") || + of_node_name_eq(pp, "espdma") || + of_node_name_eq(pp, "ledma") || + of_node_name_eq(pp, "lebuffer")) return 0; /* Similarly for all PCI bridges, if we get this far * it lacks a ranges property, and this will include * cases like Simba. */ - if (!strcmp(pp->name, "pci")) + if (of_node_name_eq(pp, "pci")) return 0; return 1; @@ -591,7 +591,7 @@ static unsigned int __init build_one_device_irq(struct platform_device *op, break; } } else { - if (!strcmp(pp->name, "pci")) { + if (of_node_name_eq(pp, "pci")) { unsigned int this_orig_irq = irq; irq = pci_irq_swizzle(dp, pp, irq); diff --git a/arch/sparc/kernel/of_device_common.c b/arch/sparc/kernel/of_device_common.c index de0ee3971f00..b186b7f0f6c4 100644 --- a/arch/sparc/kernel/of_device_common.c +++ b/arch/sparc/kernel/of_device_common.c @@ -151,8 +151,8 @@ int of_bus_sbus_match(struct device_node *np) struct device_node *dp = np; while (dp) { - if (!strcmp(dp->name, "sbus") || - !strcmp(dp->name, "sbi")) + if (of_node_name_eq(dp, "sbus") || + of_node_name_eq(dp, "sbi")) return 1; /* Have a look at use_1to1_mapping(). We're trying diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c index 45ba2757a1b9..377113ae9a6a 100644 --- a/arch/sparc/kernel/pci.c +++ b/arch/sparc/kernel/pci.c @@ -283,7 +283,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm, sd->stc = &pbm->stc; sd->numa_node = pbm->numa_node; - if (!strcmp(node->name, "ebus")) + if (of_node_name_eq(node, "ebus")) of_propagate_archdata(op); type = of_get_property(node, "device_type", NULL); @@ -336,7 +336,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm, dev->error_state = pci_channel_io_normal; dev->dma_mask = 0xffffffff; - if (!strcmp(node->name, "pci")) { + if (of_node_name_eq(node, "pci")) { /* a PCI-PCI bridge */ dev->hdr_type = PCI_HEADER_TYPE_BRIDGE; dev->rom_base_reg = PCI_ROM_ADDRESS1; diff --git a/arch/sparc/kernel/pci_sabre.c b/arch/sparc/kernel/pci_sabre.c index 8107286be9ab..3c38ca40a22b 100644 --- a/arch/sparc/kernel/pci_sabre.c +++ b/arch/sparc/kernel/pci_sabre.c @@ -475,7 +475,7 @@ static int sabre_probe(struct platform_device *op) * different ways, inconsistently. */ for_each_node_by_type(cpu_dp, "cpu") { - if (!strcmp(cpu_dp->name, "SUNW,UltraSPARC-IIe")) + if (of_node_name_eq(cpu_dp, "SUNW,UltraSPARC-IIe")) hummingbird_p = 1; } } diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c index 1667df573f6f..17860d6ed1bd 100644 --- a/arch/sparc/kernel/prom_64.c +++ b/arch/sparc/kernel/prom_64.c @@ -335,8 +335,8 @@ static void __init __build_path_component(struct device_node *dp, char *tmp_buf) ebus_path_component(dp, tmp_buf); return; } - if (!strcmp(parent->name, "usb") || - !strcmp(parent->name, "hub")) { + if (of_node_name_eq(parent, "usb") || + of_node_name_eq(parent, "hub")) { usb_path_component(dp, tmp_buf); return; } diff --git a/arch/sparc/kernel/prom_irqtrans.c b/arch/sparc/kernel/prom_irqtrans.c index f3fecac7facb..f76b4ae697f5 100644 --- a/arch/sparc/kernel/prom_irqtrans.c +++ b/arch/sparc/kernel/prom_irqtrans.c @@ -725,11 +725,11 @@ static unsigned int central_build_irq(struct device_node *dp, unsigned long imap, iclr; u32 tmp; - if (!strcmp(dp->name, "eeprom")) { + if (of_node_name_eq(dp, "eeprom")) { res = ¢ral_op->resource[5]; - } else if (!strcmp(dp->name, "zs")) { + } else if (of_node_name_eq(dp, "zs")) { res = ¢ral_op->resource[4]; - } else if (!strcmp(dp->name, "clock-board")) { + } else if (of_node_name_eq(dp, "clock-board")) { res = ¢ral_op->resource[3]; } else { return ino; @@ -824,19 +824,19 @@ void __init irq_trans_init(struct device_node *dp) } #endif #ifdef CONFIG_SBUS - if (!strcmp(dp->name, "sbus") || - !strcmp(dp->name, "sbi")) { + if (of_node_name_eq(dp, "sbus") || + of_node_name_eq(dp, "sbi")) { sbus_irq_trans_init(dp); return; } #endif - if (!strcmp(dp->name, "fhc") && - !strcmp(dp->parent->name, "central")) { + if (of_node_name_eq(dp, "fhc") && + of_node_name_eq(dp->parent, "central")) { central_irq_trans_init(dp); return; } - if (!strcmp(dp->name, "virtual-devices") || - !strcmp(dp->name, "niu")) { + if (of_node_name_eq(dp, "virtual-devices") || + of_node_name_eq(dp, "niu")) { sun4v_vdev_irq_trans_init(dp); return; } diff --git a/arch/sparc/kernel/sun4d_irq.c b/arch/sparc/kernel/sun4d_irq.c index 6d266d7dd2b6..9a137c70e8d1 100644 --- a/arch/sparc/kernel/sun4d_irq.c +++ b/arch/sparc/kernel/sun4d_irq.c @@ -335,12 +335,12 @@ static unsigned int sun4d_build_device_irq(struct platform_device *op, irq = real_irq; while (bus) { - if (!strcmp(bus->name, "sbi")) { + if (of_node_name_eq(bus, "sbi")) { bus_connection = "io-unit"; break; } - if (!strcmp(bus->name, "bootbus")) { + if (of_node_name_eq(bus, "bootbus")) { bus_connection = "cpu-unit"; break; } @@ -360,7 +360,7 @@ static unsigned int sun4d_build_device_irq(struct platform_device *op, * If Bus nodes parent is not io-unit/cpu-unit or the io-unit/cpu-unit * lacks a "board#" property, something is very wrong. */ - if (!bus->parent || strcmp(bus->parent->name, bus_connection)) { + if (!of_node_name_eq(bus->parent, bus_connection)) { printk(KERN_ERR "%pOF: Error, parent is not %s.\n", bus, bus_connection); goto err_out; diff --git a/arch/sparc/kernel/time_64.c b/arch/sparc/kernel/time_64.c index 68a80f9baea7..3eb77943ce12 100644 --- a/arch/sparc/kernel/time_64.c +++ b/arch/sparc/kernel/time_64.c @@ -561,8 +561,8 @@ static int mostek_probe(struct platform_device *op) /* On an Enterprise system there can be multiple mostek clocks. * We should only match the one that is on the central FHC bus. */ - if (!strcmp(dp->parent->name, "fhc") && - strcmp(dp->parent->parent->name, "central") != 0) + if (of_node_name_eq(dp->parent, "fhc") && + !of_node_name_eq(dp->parent->parent, "central")) return -ENODEV; printk(KERN_INFO "%pOF: Mostek regs at 0x%llx\n",