From patchwork Mon Jun 6 09:45:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 69401 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp1393191qgf; Mon, 6 Jun 2016 02:45:05 -0700 (PDT) X-Received: by 10.36.22.130 with SMTP id a124mr14131319ita.58.1465206305170; Mon, 06 Jun 2016 02:45:05 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q2si27511765pfq.114.2016.06.06.02.45.04; Mon, 06 Jun 2016 02:45:05 -0700 (PDT) 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; dkim=pass header.i=@nifty.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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751879AbcFFJpA (ORCPT + 31 others); Mon, 6 Jun 2016 05:45:00 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:16502 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750933AbcFFJo7 (ORCPT ); Mon, 6 Jun 2016 05:44:59 -0400 Received: from beagle.diag.org (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-10.nifty.com with ESMTP id u569i4J2016948; Mon, 6 Jun 2016 18:44:05 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com u569i4J2016948 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1465206246; bh=L8DvqCGMt6TbUW9rfNWT4gFUNwMDc8YwJIYynUx9ELE=; h=From:To:Cc:Subject:Date:From; b=mn14pkWR8rNwwTVedp3aDei5U4/CpO8uW4ot0gYs+vK9iM+NyK+pawiZh0cTExxIq R6M9UVQaSM/7+Lx6I7asmc94Kx37rDfAuIz8RMjOYuOldGyJUvzOt+qtI9h2b//TeR JBSYvAMcVhGLSkXUXa9KcUECNqh1LRK+uJgXlxJ8YoNTWlx+z70X4AIhAp5y4id+si DXFt//BSSXUm6R05kZFZi3vTIEk6xlH13CgAImLdwQT609/dEfuEibugKdu9uvz+Qa edqPzHe50ZoDiHgm5PfvrHYc6seOz6MU/eX3J94ala4ztNe8wa7ckfrShaY+6OoIUz L3C6oOavicJCg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: devicetree@vger.kernel.org Cc: Arnd Bergmann , Rob Herring , Masahiro Yamada , Frank Rowand , Rob Herring , linux-kernel@vger.kernel.org, Grant Likely Subject: [PATCH] of: factor __used / __unused out of _OF_DECLARE() Date: Mon, 6 Jun 2016 18:45:17 +0900 Message-Id: <1465206317-4231-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The difference between the "#if" and "#else" is __used / __unused, so factor it out to avoid code duplication. Signed-off-by: Masahiro Yamada --- include/linux/of.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) -- 1.9.1 diff --git a/include/linux/of.h b/include/linux/of.h index c7292e8..9b33e2e 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -995,18 +995,17 @@ static inline int of_get_available_child_count(const struct device_node *np) } #if defined(CONFIG_OF) && !defined(MODULE) -#define _OF_DECLARE(table, name, compat, fn, fn_type) \ - static const struct of_device_id __of_table_##name \ - __used __section(__##table##_of_table) \ - = { .compatible = compat, \ - .data = (fn == (fn_type)NULL) ? fn : fn } +#define OF_DECLARE_USED_OR_UNUSED __used #else +#define OF_DECLARE_USED_OR_UNUSED __maybe_unused +#endif + #define _OF_DECLARE(table, name, compat, fn, fn_type) \ static const struct of_device_id __of_table_##name \ - __attribute__((unused)) \ + OF_DECLARE_USED_OR_UNUSED \ + __section(__##table##_of_table) \ = { .compatible = compat, \ .data = (fn == (fn_type)NULL) ? fn : fn } -#endif typedef int (*of_init_fn_2)(struct device_node *, struct device_node *); typedef void (*of_init_fn_1)(struct device_node *);