From patchwork Sat Sep 27 00:31:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Behan Webster X-Patchwork-Id: 38025 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f200.google.com (mail-we0-f200.google.com [74.125.82.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2BCEE202DB for ; Sat, 27 Sep 2014 00:32:25 +0000 (UTC) Received: by mail-we0-f200.google.com with SMTP id w62sf5511626wes.7 for ; Fri, 26 Sep 2014 17:32:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=MQlKUT+sZj1WHBVIZhAgLwoLiarRIhYw88jhblpRuxo=; b=lL2OLQHdULCQziqBuhywc9wlwzMUwrSToP7w4PZTLqXNFJbY7OHXkQw6TMjpWANQJd yjVWt2Zi4LmwwlOpWMi9kOTnU3vD1y89XjmtRk+h9nnUWZ8eiw89np+PqnK6PgIbP4hx vLAjMXPTSmL1dvIdjzD/Z+aPCwWWnGxgGapRfELZMdvXjR5S/RypXWmwM/vZXfs8TIux +u0EqCUyzG78OTFxsC06YjeIR8Puj5eTuFlAzr0+NP3B6iSoOU1wver7FZpo+UD3OxCa GovS6Hl5RBpwtHGxdCflCPHJjZ4EXQixfwFJwF0XZhRRsuZO7liMGjWlpgQryFAzxrLs +WNA== X-Gm-Message-State: ALoCoQk5D/lgijSOdssQgBNs7y+xJ3hxgmenzFwn80samsgAJqY9af9Gpbq3SOY9poMnUXMuwzfC X-Received: by 10.181.28.169 with SMTP id jp9mr4024911wid.6.1411777944323; Fri, 26 Sep 2014 17:32:24 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.74 with SMTP id w10ls465004laj.99.gmail; Fri, 26 Sep 2014 17:32:23 -0700 (PDT) X-Received: by 10.112.209.70 with SMTP id mk6mr22899693lbc.44.1411777943774; Fri, 26 Sep 2014 17:32:23 -0700 (PDT) Received: from mail-la0-x22a.google.com (mail-la0-x22a.google.com [2a00:1450:4010:c03::22a]) by mx.google.com with ESMTPS id ue9si9237228lac.20.2014.09.26.17.32.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 26 Sep 2014 17:32:23 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::22a as permitted sender) client-ip=2a00:1450:4010:c03::22a; Received: by mail-la0-f42.google.com with SMTP id hz20so15650742lab.29 for ; Fri, 26 Sep 2014 17:32:23 -0700 (PDT) X-Received: by 10.152.7.193 with SMTP id l1mr24022200laa.62.1411777941329; Fri, 26 Sep 2014 17:32:21 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.130.169 with SMTP id of9csp148497lbb; Fri, 26 Sep 2014 17:32:20 -0700 (PDT) X-Received: by 10.66.139.36 with SMTP id qv4mr36534494pab.53.1411777939754; Fri, 26 Sep 2014 17:32:19 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id jd8si11654989pbd.152.2014.09.26.17.32.19 for ; Fri, 26 Sep 2014 17:32:19 -0700 (PDT) Received-SPF: none (google.com: linux-omap-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756078AbaI0Ab4 (ORCPT + 5 others); Fri, 26 Sep 2014 20:31:56 -0400 Received: from mail-pd0-f172.google.com ([209.85.192.172]:43387 "EHLO mail-pd0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756020AbaI0Abz (ORCPT ); Fri, 26 Sep 2014 20:31:55 -0400 Received: by mail-pd0-f172.google.com with SMTP id g10so1932129pdj.31 for ; Fri, 26 Sep 2014 17:31:55 -0700 (PDT) X-Received: by 10.66.145.103 with SMTP id st7mr35851615pab.43.1411777915292; Fri, 26 Sep 2014 17:31:55 -0700 (PDT) Received: from galdor.websterwood.com (S0106dc9fdb80cffd.gv.shawcable.net. [96.50.97.138]) by mx.google.com with ESMTPSA id a15sm225476pbu.0.2014.09.26.17.31.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 26 Sep 2014 17:31:54 -0700 (PDT) From: Behan Webster To: mturquette@linaro.org, t-kristo@ti.com Cc: behanw@converseincode.com, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org Subject: [PATCH] clk, ti, LLVMLinux: Move __init outside of type definition Date: Fri, 26 Sep 2014 17:31:48 -0700 Message-Id: <1411777908-16016-1-git-send-email-behanw@converseincode.com> X-Mailer: git-send-email 1.9.1 Sender: linux-omap-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Original-Sender: behanw@converseincode.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::22a as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@ Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , As written, the __init for ti_clk_get_div_table is in the middle of the return type. The gcc documentation indicates that section attributes should be added to the end of the function declaration: extern void foobar (void) __attribute__ ((section ("bar"))); However gcc seems to be very permissive with where attributes can be placed. clang on the other hand isn't so permissive, and fails if you put the section definition in the middle of the return type: drivers/clk/ti/divider.c:298:28: error: expected ';' after struct static struct clk_div_table ^ ; drivers/clk/ti/divider.c:298:1: warning: 'static' ignored on this declaration [-Wmissing-declarations] static struct clk_div_table ^ drivers/clk/ti/divider.c:299:9: error: type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int] __init *ti_clk_get_div_table(struct device_node *node) ~~~~~~ ^ drivers/clk/ti/divider.c:345:9: warning: incompatible pointer types returning 'struct clk_div_table *' from a function with result type 'int *' [-Wincompatible-pointer-types] return table; ^~~~~ drivers/clk/ti/divider.c:419:9: warning: incompatible pointer types assigning to 'const struct clk_div_table *' from 'int *' [-Wincompatible-pointer-types] *table = ti_clk_get_div_table(node); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 warnings and 2 errors generated. By convention, most of the kernel code puts section attributes between the return type and function name. In the case where the return type is a pointer, it's important to place the '*' on left of the __init. This updated code works for both gcc and clang. Signed-off-by: Behan Webster Reviewed-by: Mark Charlebois Reviewed-by: Felipe Balbi --- drivers/clk/ti/divider.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/clk/ti/divider.c b/drivers/clk/ti/divider.c index a837f70..bff2b5b 100644 --- a/drivers/clk/ti/divider.c +++ b/drivers/clk/ti/divider.c @@ -300,8 +300,8 @@ static struct clk *_register_divider(struct device *dev, const char *name, return clk; } -static struct clk_div_table -__init *ti_clk_get_div_table(struct device_node *node) +static struct clk_div_table * +__init ti_clk_get_div_table(struct device_node *node) { struct clk_div_table *table; const __be32 *divspec;