Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1389987rdb; Wed, 20 Sep 2023 07:57:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHI11dhgPHiCGlIcIkgsNAYKgN6duC4EaYrq3EQMGl3a9KryTNS31TwKzXGfwDlICiGaI4m X-Received: by 2002:a05:6a20:3941:b0:14d:4ab5:5e3c with SMTP id r1-20020a056a20394100b0014d4ab55e3cmr3029135pzg.1.1695221832289; Wed, 20 Sep 2023 07:57:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695221832; cv=none; d=google.com; s=arc-20160816; b=q2uL97jG35qJd/YlXlmBEyGmiULfBtn4fpI5d07jf7wQ9LO8cPEbwxhImhVmA7oBTW mOrmDc2V+Ongapv/8VZ88x1YwKL7SAYtuWTnAL4OCci4WsCwtFBlExsres1OQJ+UFQfY Tflh5pnUIPICXBDTH4R9AtwHBSTS23SNFOM6Z1rTHcQmafOccvOQG/ujih5n8PjaP04N oTuK72UqKxdIwx1G5E9oK4BSpqKONZ8j87A5j0ubyIELpCc3GODDYwMgF+Q8BZ15JIuv CH88BLvB+XoNgUHpwQMEODd+tSkZhwUZHTKFeXkNDBsmrUHeMFgfi2tXuSo85rbQCcd2 EDOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=W5v1CypZwTCBDBhs9j4/J36uqVFusl1ZDZjhAU4hWc0=; fh=e6/uyeFf2k7v8JUtB6fPyaAS5iN3eSA1hjtg35V2Rzw=; b=NfXBefe2N2m7ZQPPBF9yJlUuap9Ci8FQX44L0L0Q9cGjesD0ginslj0w4Z48fuyqy9 /hHzPBPt92nlhhcfeAaAnS8Z0o1qDmFDsAgD8SYWPI51ypvZI/8RWwZhGSFZU5wBWcDV L3aBSMzh4b/xH37WUCxRdinzjpbbyN/0JKw4rzHBEkZbBlzrnnTCt9jO2fP0FLrn0enG I/qTbzQTdaX3yOuqxog72T75LH4qOm9fy6MH5+ED+le9ZRfCT99DpHK7NWASf99ryUxY ROTdoUXTFFmI95OGCkjcH7gM/iULVwyEaMifpcwYW/IWnpUXWALHJf9frq3tMQ4wx7O0 1mWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EtN6A+MK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id f7-20020a056a001ac700b00690d9cd7b56si1954587pfv.66.2023.09.20.07.57.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 07:57:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EtN6A+MK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 59CC2827C181; Wed, 20 Sep 2023 07:39:04 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236801AbjITOi6 (ORCPT + 99 others); Wed, 20 Sep 2023 10:38:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234580AbjITOiw (ORCPT ); Wed, 20 Sep 2023 10:38:52 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57EC4CD4; Wed, 20 Sep 2023 07:37:21 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8235C433CA; Wed, 20 Sep 2023 14:37:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695220641; bh=BKAqssSSrz/lWlwNaLsJkad1kx62XBx3UGaeEawTwAE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=EtN6A+MKtH7qocG6NTeWELFzrImwk7f49faBZSnroJ/zTK+i0DNgeEEH+FDHZ+XZD Rcf7dMVCTghvN1vhIrYdvfBaoZnuub2d8bxIzTz5Wfgadu2wQAhTy27GDHjHepUZve UiuiKMSRAmoomKV6O/HqMOnximPKTz46FRztFxn4didL1e/3F3wuu7ugLpj5mmi04F 2VjoDQ1S9D3piYoBcQgwTM4mMQ+qNsh8mraasiyORexLFmuI7s5+s+2nNtsYh3oBXe fBX2CrLYHDanA1z79sAW16lIAfXPU8QtwA0FMgK0UOA7LY/ugww5QZxH/v0TZcWjZm kreap6LRbh7zA== From: Maxime Ripard Date: Wed, 20 Sep 2023 16:35:50 +0200 Subject: [PATCH RFC v2 35/37] drm/sun4i: hdmi: Switch to container_of_const MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230920-kms-hdmi-connector-state-v2-35-17932daddd7d@kernel.org> References: <20230920-kms-hdmi-connector-state-v2-0-17932daddd7d@kernel.org> In-Reply-To: <20230920-kms-hdmi-connector-state-v2-0-17932daddd7d@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+D1vfrpE4FHG02pJDKnczFYZmq/yffmeSE+sO+ZV+LTO//EmfpsWr61Zi0Vqn YPmHJ/eUcrCIMbFICumyBIjbL4k7tSs151sfPNg5rAygQxh4OIUgImsfs7IMLfG0cOgUbJuw4EV 3XNYD1Yt9Qqa53vy+N3HgiLNjWsM2RgZVm3kNjXsfbV9xnOnw4sf1l/Z/fA5K9v2r7viUlYm7Ej ZzgYA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 20 Sep 2023 07:39:04 -0700 (PDT) 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 --- 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) -- 2.41.0