Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp465692pxx; Mon, 26 Oct 2020 12:34:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBO8Hmx+tnlNgbCWELNz0bnWOexGQHmuUf91oDYlFvHqGTddBZAF0kKrBcf29a8+7ne4wh X-Received: by 2002:a17:906:55d2:: with SMTP id z18mr17748928ejp.125.1603740874277; Mon, 26 Oct 2020 12:34:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603740874; cv=none; d=google.com; s=arc-20160816; b=DsDKTjDMDkKvB/bVJX/+RaB0HEP/MgJEsIcJZdBtY0uMy5+yisluVNxbTwDci9r6MB H/Wug+QA7ubm+qzGCyELIzcW7aq+T1jUonfmcoMlmtT2Zb6Z+4oYu/fdJGf+zVkq5FJW jG5z2ax+LteRm+2+TBZfSV73TWMWvQ8r5aloMQmKHQmGSclNbbBUNJ5r2foLJuIAK7pq +6jAv600MIEfreMxTeo8Z2TDU7bilmR7fhQsVtNrRH8NATdEHUW5zTVjchu2eHkv44IK K8/kxrWRnlh9BtMFUtHl5Wl00GouXHdZ3y0yNwsSd8UmDPPOf73MN2vSn2KWUi4aNVVf QTzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ur9HwmNBeO3iQvG5gm/1+5MU4d5BdWrXZG7jKvkOtZI=; b=mLNLoyY9tgbJmQYbyn33IbAPPvbmQy7sajVmJnm3gt0gOO70/2Jg6sVRmPNa92okNH K05CI/KU6T42P8e/eX+rDKnSyzjfz7g03vzcwOokQ5dDJwQhI+jflz051IEh060hXD5b KS+7mrGZisfbtHveUt+e70lCi+dwv/tSgcMvxPL0LAXCsgJH6nJP+UcnqJwmHCcKiLF+ 6oNHLuOOYE4JTKxWVhANMyoCEibOqzuEfeyPEb9ktBiRLQ7aFbaYkbZk//9mBhNH4dIR RtxIKvRiizvu41t5nhO4GM8QmivjnwsivimHBvP6n9CWyZuVF67j3don+6PEcThlmHtm lFRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dJ6Zob69; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mj11si5960146ejb.345.2020.10.26.12.34.11; Mon, 26 Oct 2020 12:34:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dJ6Zob69; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1774781AbgJZQOV (ORCPT + 99 others); Mon, 26 Oct 2020 12:14:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:58660 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1774171AbgJZQOU (ORCPT ); Mon, 26 Oct 2020 12:14:20 -0400 Received: from localhost.localdomain (unknown [192.30.34.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D5F462085B; Mon, 26 Oct 2020 16:14:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603728859; bh=bUpCBioorowGbrQ/fVCAdi1u2Xy+hKlP2gtMWRIPUWg=; h=From:To:Cc:Subject:Date:From; b=dJ6Zob691AmODEKOGoDqDZeFgi9koU3ieIucOk5+l7f5r8bqVOhGneRhKdkYuD+Z8 D4G07KviSW9kFoFObqYKUaXsc0TnPgZ8NM/tnkFaXQtMRY9XHfAR/+07ODe2q1CwnX rEeZZCNUG5BFAlIQUxzQDLjrgwv2O+AAhwqqSSko= From: Arnd Bergmann To: Neil Armstrong , Jerome Brunet , Michael Turquette , Stephen Boyd , Kevin Hilman , Andy Gross , Bjorn Andersson , Mike Turquette Cc: Arnd Bergmann , Stephen Boyd , Martin Blumenstingl , linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH] clk: define to_clk_regmap() as inline function Date: Mon, 26 Oct 2020 17:13:57 +0100 Message-Id: <20201026161411.3708639-1-arnd@kernel.org> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann Nesting container_of() causes warnings with W=2, which is annoying if it happens in headers and fills the build log like: In file included from drivers/clk/qcom/clk-alpha-pll.c:6: drivers/clk/qcom/clk-alpha-pll.c: In function 'clk_alpha_pll_hwfsm_enable': include/linux/kernel.h:852:8: warning: declaration of '__mptr' shadows a previous local [-Wshadow] 852 | void *__mptr = (void *)(ptr); \ | ^~~~~~ drivers/clk/qcom/clk-alpha-pll.c:155:31: note: in expansion of macro 'container_of' 155 | #define to_clk_alpha_pll(_hw) container_of(to_clk_regmap(_hw), \ | ^~~~~~~~~~~~ drivers/clk/qcom/clk-regmap.h:27:28: note: in expansion of macro 'container_of' 27 | #define to_clk_regmap(_hw) container_of(_hw, struct clk_regmap, hw) | ^~~~~~~~~~~~ drivers/clk/qcom/clk-alpha-pll.c:155:44: note: in expansion of macro 'to_clk_regmap' 155 | #define to_clk_alpha_pll(_hw) container_of(to_clk_regmap(_hw), \ | ^~~~~~~~~~~~~ drivers/clk/qcom/clk-alpha-pll.c:254:30: note: in expansion of macro 'to_clk_alpha_pll' 254 | struct clk_alpha_pll *pll = to_clk_alpha_pll(hw); | ^~~~~~~~~~~~~~~~ include/linux/kernel.h:852:8: note: shadowed declaration is here 852 | void *__mptr = (void *)(ptr); \ | ^~~~~~ Redefine two copies of the to_clk_regmap() macro as inline functions to avoid a lot of these. Fixes: ea11dda9e091 ("clk: meson: add regmap clocks") Fixes: 085d7a455444 ("clk: qcom: Add a regmap type clock struct") Signed-off-by: Arnd Bergmann --- drivers/clk/meson/clk-regmap.h | 5 ++++- drivers/clk/qcom/clk-regmap.h | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/clk/meson/clk-regmap.h b/drivers/clk/meson/clk-regmap.h index c4a39604cffd..e365312da54e 100644 --- a/drivers/clk/meson/clk-regmap.h +++ b/drivers/clk/meson/clk-regmap.h @@ -26,7 +26,10 @@ struct clk_regmap { void *data; }; -#define to_clk_regmap(_hw) container_of(_hw, struct clk_regmap, hw) +static inline struct clk_regmap *to_clk_regmap(struct clk_hw *hw) +{ + return container_of(hw, struct clk_regmap, hw); +} /** * struct clk_regmap_gate_data - regmap backed gate specific data diff --git a/drivers/clk/qcom/clk-regmap.h b/drivers/clk/qcom/clk-regmap.h index 6cfc1bccb255..14ec659a3a77 100644 --- a/drivers/clk/qcom/clk-regmap.h +++ b/drivers/clk/qcom/clk-regmap.h @@ -24,7 +24,11 @@ struct clk_regmap { unsigned int enable_mask; bool enable_is_inverted; }; -#define to_clk_regmap(_hw) container_of(_hw, struct clk_regmap, hw) + +static inline struct clk_regmap *to_clk_regmap(struct clk_hw *hw) +{ + return container_of(hw, struct clk_regmap, hw); +} int clk_is_enabled_regmap(struct clk_hw *hw); int clk_enable_regmap(struct clk_hw *hw); -- 2.27.0