From patchwork Tue Nov 28 10:24:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13470933 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 97F62C4167B for ; Tue, 28 Nov 2023 10:29:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=egBoGo81owmZY518AI1lX4mKYKgjI/btD8MC13ebhG8=; b=1ckPNH9UMQrwCM 6moKWy3atKazXFPaM4B/LMZzq6OEb04585Nh6uDzKLwHuRP+WnBmRAvJ2kvqoiZXeTN1kK/5xq4CS CHp90zkhXoGnJ10hwClv0+zC6Hwq3cxlnw4f5zB+6C2BL6aJg0vm1hDFHXS7TkqyTBauhN1jpT7KU IdLcQD2vls21s5FOMG0gtakr0sVXzxptGrMf4L/IAedudzLs5JgroRFpSIHY+JEMHTXBqlASP1qs9 As0wm8NcmAbHXY7s6MpbnaUFGi9AqvrjlmuI89yIHGUDDpzTyxKZI/Re2yChlLcglvgAaWPRVdUTe I4/cULLL+P2z5BIYYI2Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r7vKk-004vAr-1m; Tue, 28 Nov 2023 10:28:50 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r7vIQ-004t62-2V; Tue, 28 Nov 2023 10:26:28 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id 5B366B83A07; Tue, 28 Nov 2023 10:26:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F82EC433C7; Tue, 28 Nov 2023 10:26:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701167184; bh=BKAqssSSrz/lWlwNaLsJkad1kx62XBx3UGaeEawTwAE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Xniu33YR4/yU3WHn9V40iLgAKdo2Jeqbft/ixk0X2dc6ZGri7kPdbSlYJO7rRwAb7 w3Spgy6B0zWROYaqUMYsFv+s2y20p9lYtqKQ/MMJ38BYDbUU1zjO5v/ICbhmFE4WSo v4oCfBDdKVnM9jKlyo1A3i1rrXm5U/ZEs4T1hltYVZaoIv6ex1GxW0W2ZtfVV/oHUS xmxYKi+z/pe3ppj86QKSMlX8YCIS4V/oPHchnzLQE8ZHCxZz1Lfgie1XnFkJSSr87I GQ9UM3IYt1uJwXwTZR3+kJkEDGf9lOIZDsX+LgCnp/woDBvggL4FmqEPz6kC+24w27 avfx/C7GSeMCQ== From: Maxime Ripard Date: Tue, 28 Nov 2023 11:24:54 +0100 Subject: [PATCH v4 43/45] drm/sun4i: hdmi: Switch to container_of_const MIME-Version: 1.0 Message-Id: <20231128-kms-hdmi-connector-state-v4-43-c7602158306e@kernel.org> References: <20231128-kms-hdmi-connector-state-v4-0-c7602158306e@kernel.org> In-Reply-To: <20231128-kms-hdmi-connector-state-v4-0-c7602158306e@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Emma Anholt , Jonathan Corbet , Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: Hans Verkuil , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-sunxi@lists.linux.dev, Maxime Ripard X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1344; i=mripard@kernel.org; h=from:subject:message-id; bh=BKAqssSSrz/lWlwNaLsJkad1kx62XBx3UGaeEawTwAE=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDKmp+y/7KW9anrmo5fXx9lMamZVL91aycFY9XK8WFm/U0 T2Rw31LRykLgxgXg6yYIkuMsPmSuFOzXney8c2DmcPKBDKEgYtTACayRYyRYbbLu/1XL5/fwRy6 2CLkx46W566G1YbCG2d9St05/9Kllw2MDD9VNr/asivo6OaC07arvm568UPIyyvHmVNr2+M4w8T 5qSwA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231128_022627_001860_E38FF5A2 X-CRM114-Status: UNSURE ( 9.72 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org container_of_const() allows to preserve the pointer constness and is thus more flexible than inline functions. Let's switch all our instances of container_of() to container_of_const(). Signed-off-by: Maxime Ripard Reviewed-by: Sui Jingfeng --- drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c index bae69d696765..c276d984da6b 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c @@ -30,19 +30,11 @@ #include "sun4i_drv.h" #include "sun4i_hdmi.h" -static inline struct sun4i_hdmi * -drm_encoder_to_sun4i_hdmi(struct drm_encoder *encoder) -{ - return container_of(encoder, struct sun4i_hdmi, - encoder); -} +#define drm_encoder_to_sun4i_hdmi(e) \ + container_of_const(e, struct sun4i_hdmi, encoder) -static inline struct sun4i_hdmi * -drm_connector_to_sun4i_hdmi(struct drm_connector *connector) -{ - return container_of(connector, struct sun4i_hdmi, - connector); -} +#define drm_connector_to_sun4i_hdmi(c) \ + container_of_const(c, struct sun4i_hdmi, connector) static int sun4i_hdmi_setup_avi_infoframes(struct sun4i_hdmi *hdmi, struct drm_display_mode *mode)