From patchwork Thu May 4 18:00:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 98556 Delivered-To: patch@linaro.org Received: by 10.140.89.200 with SMTP id v66csp733344qgd; Thu, 4 May 2017 11:01:43 -0700 (PDT) X-Received: by 10.84.238.9 with SMTP id u9mr58511437plk.126.1493920903115; Thu, 04 May 2017 11:01:43 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q80si2656738pfa.407.2017.05.04.11.01.42; Thu, 04 May 2017 11:01:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-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 devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753112AbdEDSBl (ORCPT + 7 others); Thu, 4 May 2017 14:01:41 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:34962 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752845AbdEDSBk (ORCPT ); Thu, 4 May 2017 14:01:40 -0400 Received: by mail-it0-f68.google.com with SMTP id 131so2586971itz.2; Thu, 04 May 2017 11:01:40 -0700 (PDT) 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; bh=f65sFVNMmTUha2y/P4f8Yx0/ZPlM1QyIhsKvK1dH1LA=; b=k6DRzMzCg4pfv9rx70GSNkXJgFl/KX0Nu7xqgFIGjAL7/bwFzTwWpU/4i4z25f9jGr BWJljVWCp4jfCSendCfdLjJRB5YhvwkMs+JTuFPSv6rCuKeYMXAw5NtKlqbZv/chKrou zYrFMZklA5cuQxfNmrYOaw/69sSUwiBwZzL4Tdc76P0gaelheK592a3KbfwwoJLis6XJ 7JQ/wwpItTVjng/CprlWFmkotgcY6HZ5pGwoDH1oK0kPaPRXKz3dPO+4Xu6p8KNRzUd9 NqTV9hU/lD7G3IV+wJlTqOPJOkgVMd7w2eN0OMGmdYBMK44a0iMXku8UXxN6vT+BVhiI HLmw== X-Gm-Message-State: AN3rC/7v6L0A0v53gxxmiSB79q6gA2VTtSQwOHj/HvS79MDN2tkxnxe1 C10kxsTMUesjoA== X-Received: by 10.202.50.193 with SMTP id y184mr14010043oiy.45.1493920899952; Thu, 04 May 2017 11:01:39 -0700 (PDT) Received: from localhost.localdomain (66-90-148-125.dyn.grandenetworks.net. [66.90.148.125]) by smtp.googlemail.com with ESMTPSA id d44sm1428684otc.6.2017.05.04.11.01.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 May 2017 11:01:38 -0700 (PDT) From: Rob Herring To: devicetree@vger.kernel.org, Frank Rowand , Mark Rutland Cc: linux-kernel@vger.kernel.org Subject: [PATCH 1/3] of: fix sparse warnings in of_find_next_cache_node Date: Thu, 4 May 2017 13:00:33 -0500 Message-Id: <20170504180035.12834-1-robh@kernel.org> X-Mailer: git-send-email 2.11.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org sparse gives a warning that 'handle' is not a __be32: ../drivers/of/base.c:2261:61: warning: incorrect type in argument 1 (different base types) ../drivers/of/base.c:2261:61: expected restricted __be32 const [usertype] *p ../drivers/of/base.c:2261:61: got unsigned int const [usertype] *[assigned] handle We could just change the type, but the code can be improved by using of_parse_phandle instead of open coding it with of_get_property and of_find_node_by_phandle. Signed-off-by: Rob Herring --- drivers/of/base.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Reviewed-by: Frank Rowand Reviewed-by: Frank Rowand diff --git a/drivers/of/base.c b/drivers/of/base.c index d7c4629a3a2d..016f9d77d64d 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -2250,15 +2250,14 @@ EXPORT_SYMBOL_GPL(of_console_check); */ struct device_node *of_find_next_cache_node(const struct device_node *np) { - struct device_node *child; - const phandle *handle; + struct device_node *child, *cache_node; - handle = of_get_property(np, "l2-cache", NULL); - if (!handle) - handle = of_get_property(np, "next-level-cache", NULL); + cache_node = of_parse_phandle(np, "l2-cache", 0); + if (!cache_node) + cache_node = of_parse_phandle(np, "next-level-cache", 0); - if (handle) - return of_find_node_by_phandle(be32_to_cpup(handle)); + if (cache_node) + return cache_node; /* OF on pmac has nodes instead of properties named "l2-cache" * beneath CPU nodes. From patchwork Thu May 4 18:00:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 98557 Delivered-To: patch@linaro.org Received: by 10.140.89.200 with SMTP id v66csp733690qgd; Thu, 4 May 2017 11:02:19 -0700 (PDT) X-Received: by 10.84.225.17 with SMTP id t17mr29429302plj.92.1493920939756; Thu, 04 May 2017 11:02:19 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f12si2804828pln.103.2017.05.04.11.02.19; Thu, 04 May 2017 11:02:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-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 devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752845AbdEDSBx (ORCPT + 7 others); Thu, 4 May 2017 14:01:53 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:36076 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753825AbdEDSBn (ORCPT ); Thu, 4 May 2017 14:01:43 -0400 Received: by mail-it0-f68.google.com with SMTP id x188so2578265itb.3; Thu, 04 May 2017 11:01:42 -0700 (PDT) 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; bh=fs+Bn/6llvRvC24nKaF1nCI42WhNOC+MgFlrxFPlfp8=; b=SzyJ5Cj6Q0BIGdv08i57kWqxTXqpRoU9+b5j2GbCfjxAbsk7CSDlIEBajggzGVQcLv tN1OOzNCdwHwJjDg1IzBXArbrWuABCIEs4zlxtbalqA0YFr/Sr4aeGl0j5L1srawaXL5 Nr7pmYchM7AfT4KEfoXHALqAKOL7xEStHEsGMHrz4+u73+OsigXGwOZcolPRByW1h6R3 CSCzMl5TIMHMIOvbUX/+c8tQwVCtfMDi4VWdx37ktI1Ptjei6VGY3gy4t77oMb6sicZ4 FOMn0+tdoTNMWgpfnD2AGrdJ3g1AzkxDwp+SlV7G0tSxTW0VJ8kFIuqviUj3txgA7u20 2qzg== X-Gm-Message-State: AN3rC/5PuGCblmkteYAQLF9Uy0DBa++NByd4YEXpYZDpN7sM8RJbUUPx KtS8R24dNen5KQ== X-Received: by 10.202.117.67 with SMTP id q64mr6816309oic.18.1493920902232; Thu, 04 May 2017 11:01:42 -0700 (PDT) Received: from localhost.localdomain (66-90-148-125.dyn.grandenetworks.net. [66.90.148.125]) by smtp.googlemail.com with ESMTPSA id d44sm1428684otc.6.2017.05.04.11.01.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 May 2017 11:01:41 -0700 (PDT) From: Rob Herring To: devicetree@vger.kernel.org, Frank Rowand , Mark Rutland Cc: linux-kernel@vger.kernel.org Subject: [PATCH 3/3] of: fix sparse warnings in fdt, irq, and resolver code Date: Thu, 4 May 2017 13:00:35 -0500 Message-Id: <20170504180035.12834-3-robh@kernel.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170504180035.12834-1-robh@kernel.org> References: <20170504180035.12834-1-robh@kernel.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org sparse generates the following warnings in drivers/of/: ../drivers/of/fdt.c:63:36: warning: cast to restricted __be32 ../drivers/of/fdt.c:68:33: warning: cast to restricted __be32 ../drivers/of/irq.c:105:88: warning: incorrect type in initializer (different base types) ../drivers/of/irq.c:105:88: expected restricted __be32 ../drivers/of/irq.c:105:88: got int ../drivers/of/irq.c:526:35: warning: incorrect type in assignment (different modifiers) ../drivers/of/irq.c:526:35: expected int ( *const [usertype] irq_init_cb )( ... ) ../drivers/of/irq.c:526:35: got void const *const data ../drivers/of/resolver.c:95:42: warning: incorrect type in assignment (different base types) ../drivers/of/resolver.c:95:42: expected unsigned int [unsigned] [usertype] ../drivers/of/resolver.c:95:42: got restricted __be32 [usertype] All these are harmless type mismatches fixed by adjusting the types. Signed-off-by: Rob Herring --- drivers/of/fdt.c | 4 ++-- drivers/of/irq.c | 2 +- drivers/of/resolver.c | 2 +- include/linux/of_irq.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Reviewed-by: Frank Rowand diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index e33f7818bc6c..a0972219ccfc 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -48,8 +48,8 @@ void of_fdt_limit_memory(int limit) const void *val; int nr_address_cells = OF_ROOT_NODE_ADDR_CELLS_DEFAULT; int nr_size_cells = OF_ROOT_NODE_SIZE_CELLS_DEFAULT; - const uint32_t *addr_prop; - const uint32_t *size_prop; + const __be32 *addr_prop; + const __be32 *size_prop; int root_offset; int cell_size; diff --git a/drivers/of/irq.c b/drivers/of/irq.c index 7c56b72d1dc6..d11437cb1187 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c @@ -102,7 +102,7 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq) struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL; __be32 initial_match_array[MAX_PHANDLE_ARGS]; const __be32 *match_array = initial_match_array; - const __be32 *tmp, *imap, *imask, dummy_imask[] = { [0 ... MAX_PHANDLE_ARGS] = ~0 }; + const __be32 *tmp, *imap, *imask, dummy_imask[] = { [0 ... MAX_PHANDLE_ARGS] = cpu_to_be32(~0) }; u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0; int imaplen, match, i, rc = -EINVAL; diff --git a/drivers/of/resolver.c b/drivers/of/resolver.c index 7ae9863cb0a4..771f4844c781 100644 --- a/drivers/of/resolver.c +++ b/drivers/of/resolver.c @@ -92,7 +92,7 @@ static void adjust_overlay_phandles(struct device_node *overlay, if (phandle == OF_PHANDLE_ILLEGAL) continue; - *(uint32_t *)prop->value = cpu_to_be32(overlay->phandle); + *(__be32 *)prop->value = cpu_to_be32(overlay->phandle); } for_each_child_of_node(overlay, child) diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h index 1e0deb8e8494..ec6b11deb773 100644 --- a/include/linux/of_irq.h +++ b/include/linux/of_irq.h @@ -8,7 +8,7 @@ #include #include -typedef int (*of_irq_init_cb_t)(struct device_node *, struct device_node *); +typedef int const (*of_irq_init_cb_t)(struct device_node *, struct device_node *); /* * Workarounds only applied to 32bit powermac machines