From patchwork Wed Dec 5 19:50:26 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: 152942 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp9695140ljp; Wed, 5 Dec 2018 11:51:07 -0800 (PST) X-Google-Smtp-Source: AFSGD/UDbOr3osYfm3K9qJzsKvhUit4Vb8H4LGWi/mQUaV0zfczajRlWdHbk2WHh1mFPQbpF+sGk X-Received: by 2002:a62:1d8f:: with SMTP id d137mr25364610pfd.11.1544039467139; Wed, 05 Dec 2018 11:51:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544039467; cv=none; d=google.com; s=arc-20160816; b=HIT7s9PlW9B2PfrBcgEtcO+Xtw4d2VZV6t1jpMKLIV+7mRFochQlD9SarbW7mQ2AJN tkWC7Jefw/KjRkM8wnYWScOmrt5QL52pGBjdolF8LGR1GzyQLa+yXS4nWAkpxbaKrNAa jQRl1qU26MTdzC0UVlVcN9PqXTQkXfHPrV0WZDodNkiVciyQ6bC5W+XdW80KxRikszZ0 vgJAOaM41ltm7JOMRYXZ53j80GzwUf3XzfdbuFMw4oyA38fmrRi+pF/xtp9qfJS3+Dwx omnKHiDlIK3ztOKXGMArjUksaffAYEIoTvD8yrgkL2r0CBqEr+gYvad9aAGPuOL6SrOD 3DBg== 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 :message-id:date:subject:to:from; bh=1YaWklIJnfN3jgLPotdewoR9rQO3OXEUYSjAKzJB9tk=; b=vgap6iSzp7DR6iDt7I2Y/CT2p/PtzbyHnMV/0+c/kudP7O9qqYCMNZPigIh/xgVLe6 YYlur45eY+ldWVEH6eRqkTpMxkKoo9PQCiDpn1HsZGX/lY/NZE/4yZ2MDl3ejX81tQrT RLnDYRKDC9UNGXxyiuA4XoqbQPSDHaodmis658fF/F1zzkMDGO1ugpJzPhh4gIUHSvNQ Zj1N13wbHdM+WHFcc10A2DdVlGYzTVCIer/EEvOE0brg/Q3l0+wf9XAbL5tzzYQpE5XJ xMdsF/5iC8IXYU/Dr+mnl4gelL0qKd/8QwmN5Cweu5xwQfVw0+V5jQ5d2sFo9UdDyIFo 3bvQ== 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 b14si21670526pfc.156.2018.12.05.11.51.06; Wed, 05 Dec 2018 11:51:07 -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 S1728705AbeLETvF (ORCPT + 31 others); Wed, 5 Dec 2018 14:51:05 -0500 Received: from mail-oi1-f196.google.com ([209.85.167.196]:35871 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728683AbeLETvD (ORCPT ); Wed, 5 Dec 2018 14:51:03 -0500 Received: by mail-oi1-f196.google.com with SMTP id x23so18635397oix.3; Wed, 05 Dec 2018 11:51:02 -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:subject:date:message-id:mime-version :content-transfer-encoding; bh=1YaWklIJnfN3jgLPotdewoR9rQO3OXEUYSjAKzJB9tk=; b=cIRVgyErFdKqPEahB3GZ3PlfWmHd7Dkm8kw7aQaJ+wE+AOWtDscve/Myz1J6hu6Odg J/7uDixw/EW2XnnnQKLpHWzMZgo4uYiZT96ccNKuwgJD39pFrgWokfS0eOf6CpN/+GRu RQt/CHVpD02dRhQ/MYtw5hSdo+y4wJ0rEyVPauTZDmZZeznA2bf4EkOt13YilQIu800q VsNLkh1166vfgeFkVAHnUDNTb2yf9Ipfj2p/5rDULdktRxHfVEzq2UZJw+5eVCk6bhfp wqzcwKF86AqHf/rVVXhfYNzp0VKOaDwiyYrYnEuMP4gVlIwT4mfvEtnOxot5XlSgO11V N5WA== X-Gm-Message-State: AA+aEWbUddMJ+vQZlZpCMfKJ6oZcH+n4QpNTt5/mwdIojszc3SS4AaUG KdcGJpbECQfB9HmIH8N+uUg1Rm0= X-Received: by 2002:aca:aad8:: with SMTP id t207mr14705099oie.90.1544039461975; Wed, 05 Dec 2018 11:51:01 -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.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 11:51:01 -0800 (PST) From: Rob Herring To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] Input: i8042 - Rework DT node name comparisons Date: Wed, 5 Dec 2018 13:50:26 -0600 Message-Id: <20181205195050.4759-10-robh@kernel.org> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Rob Herring --- drivers/input/serio/i8042-sparcio.h | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) -- 2.19.1 diff --git a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h index 796289846204..fce76812843b 100644 --- a/drivers/input/serio/i8042-sparcio.h +++ b/drivers/input/serio/i8042-sparcio.h @@ -53,12 +53,11 @@ static struct resource *kbd_res; static int sparc_i8042_probe(struct platform_device *op) { - struct device_node *dp = op->dev.of_node; + struct device_node *dp; - dp = dp->child; - while (dp) { - if (!strcmp(dp->name, OBP_PS2KBD_NAME1) || - !strcmp(dp->name, OBP_PS2KBD_NAME2)) { + for_each_child_of_node(op->dev.of_node, dp) { + if (of_node_name_eq(dp, OBP_PS2KBD_NAME1) || + of_node_name_eq(dp, OBP_PS2KBD_NAME2)) { struct platform_device *kbd = of_find_device_by_node(dp); unsigned int irq = kbd->archdata.irqs[0]; if (irq == 0xffffffff) @@ -67,16 +66,14 @@ static int sparc_i8042_probe(struct platform_device *op) kbd_iobase = of_ioremap(&kbd->resource[0], 0, 8, "kbd"); kbd_res = &kbd->resource[0]; - } else if (!strcmp(dp->name, OBP_PS2MS_NAME1) || - !strcmp(dp->name, OBP_PS2MS_NAME2)) { + } else if (of_node_name_eq(dp, OBP_PS2MS_NAME1) || + of_node_name_eq(dp, OBP_PS2MS_NAME2)) { struct platform_device *ms = of_find_device_by_node(dp); unsigned int irq = ms->archdata.irqs[0]; if (irq == 0xffffffff) irq = op->archdata.irqs[0]; i8042_aux_irq = irq; } - - dp = dp->sibling; } return 0; @@ -109,8 +106,9 @@ static struct platform_driver sparc_i8042_driver = { static int __init i8042_platform_init(void) { struct device_node *root = of_find_node_by_path("/"); + const char *name = of_get_property(root, "name", NULL); - if (!strcmp(root->name, "SUNW,JavaStation-1")) { + if (name && !strcmp(name, "SUNW,JavaStation-1")) { /* Hardcoded values for MrCoffee. */ i8042_kbd_irq = i8042_aux_irq = 13 | 0x20; kbd_iobase = ioremap(0x71300060, 8); @@ -139,8 +137,9 @@ static int __init i8042_platform_init(void) static inline void i8042_platform_exit(void) { struct device_node *root = of_find_node_by_path("/"); + const char *name = of_get_property(root, "name", NULL); - if (strcmp(root->name, "SUNW,JavaStation-1")) + if (!name || strcmp(name, "SUNW,JavaStation-1")) platform_driver_unregister(&sparc_i8042_driver); }