Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1750700rdb; Thu, 7 Dec 2023 07:54:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IFAAsMuP0T9gG8vVbSf8+rv3gWgzKVYMlQtQr8WKHMxktcdhdDZ73PpM9L0Q7wT+o3V75Lk X-Received: by 2002:a05:6358:913:b0:170:578e:b033 with SMTP id r19-20020a056358091300b00170578eb033mr1973244rwi.52.1701964490226; Thu, 07 Dec 2023 07:54:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701964490; cv=none; d=google.com; s=arc-20160816; b=VfZMBk3CmayFsh/W8oWfV9XtZi71dKkbfpbx6C5gKxkRsxu3A6SpktNThN/0g4ibmD 41yu1Ynl63Fhlc/YWWu9tF9BK6K/XLlXYoqxxMW5KxohA4ZxlSW3ZwwDngq8iExJKqI3 dzGaUaYs3LpcLEUqN8an6J7Xh3tmKx+BENeKwmDsZqpr+WnHWnW+/K5F0QMrf7cENiF+ e/uXRgex7UldjWF/s/h02vsUZZxE6iEG6C/dROiidlL7K+rJh+z5lePE9vJ5O2FosDBh AWw1c5YP7xdMsKOT0QOcB7+f6QlmYD5A/3FqDMaVrSfkEdw92UdEAXBp+VxJ5eJdR+7s By0g== 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=8X+6xpGvGMK4DaOOfocn5mZ/84gxhJwU8WJdEmQq88g=; fh=T4Y0VaWD0d/DeOHrML42t8biK24SxnDSs75b6Buus7k=; b=xyVeLbQ+ncG/wnXuHeV1rVQ0nYwh7V2fM8JHX7UJ2q5HKsA/7bK81xj1m5RZUoY3Al iHVFzWt/DY6B6542FOgQh3RXCAvMw45JPAWxB57vOjPGCO65EPvAgs3/GizD/iROwSmQ 3H7dbC3y/Nhy25f7wjj7fTcX5/0jRxTGvaZBZe4O0Ibney+EmkYcAGA1zsbzJvPvq0Kn EhQCyxE5zKgxccZwK8DH4n2bD4Pn8yxgbQu3uJz34GPqvwHjDowGvzU2cyqJiAr+1i7i RosHIEw0CEQCsIQJnXtuisGDNITvtIpR8eb8VyzTFLBnwPNkSUc8vCnwcrs6IiEOa08s 3Ocg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HR0Qz2SZ; 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 b12-20020a6567cc000000b005c626128e67si1382891pgs.494.2023.12.07.07.54.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 07:54:50 -0800 (PST) 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=HR0Qz2SZ; 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 274408031E15; Thu, 7 Dec 2023 07:54:49 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443664AbjLGPyg (ORCPT + 99 others); Thu, 7 Dec 2023 10:54:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443626AbjLGPyH (ORCPT ); Thu, 7 Dec 2023 10:54:07 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6256D170F for ; Thu, 7 Dec 2023 07:51:31 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A14BC433AB; Thu, 7 Dec 2023 15:51:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701964290; bh=pVOwlxGRG4Yx77sVCEVDWc/W+8/UbYOVd7SBFXh+HU4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=HR0Qz2SZALMK22ZmWNxsgFQ4gG7E5jrzyzscGzHC910+1LakOCMMg4V9f+t+mZF/r +4TjHxb+bXyO+nSa7Q060sIgoudPhIQlI3VmgZccHz/N5FFEf4cpUysi4dNi3XSFBh mAqBJpQ1tXt9adZJHlWKk+X7Z04xF1coLwz+BhMtb3GusWUNsEzmhpUGU5MiQ1t9fw rIKS+WpuRKnoOP3eCK+gu9co9qkKQs+XMMgWSD1/ONJZB+OodSwbZGZJZFnpc9Ik5B lOrKL0tYNB81MjiRLBh1duXDbaqwBnYzrA45h4U9/iM7zAi/5q/Ek/fNL2I/B3CBsp gZaiI6vWSx2fw== From: Maxime Ripard Date: Thu, 07 Dec 2023 16:50:05 +0100 Subject: [PATCH v5 42/44] 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: <20231207-kms-hdmi-connector-state-v5-42-6538e19d634d@kernel.org> References: <20231207-kms-hdmi-connector-state-v5-0-6538e19d634d@kernel.org> In-Reply-To: <20231207-kms-hdmi-connector-state-v5-0-6538e19d634d@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 , Sui Jingfeng X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1396; i=mripard@kernel.org; h=from:subject:message-id; bh=pVOwlxGRG4Yx77sVCEVDWc/W+8/UbYOVd7SBFXh+HU4=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDKmFL9udLS3VmzdvuRS84fOEDBUVl2NnNfrXmu2O2ffnq Ij/mnVhHaUsDGJcDLJiiiwxwuZL4k7Net3JxjcPZg4rE8gQBi5OAZiI/AVGht2JzZGltRzebRPO B5ZG82mzSNxnkhFXlX/NLa47Yf/rB4wMk57+OfxKe/GpI0+mGhXzSFifU+49p3xu15sdLz8Jsxq f5QEA 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,T_SCC_BODY_TEXT_LINE 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]); Thu, 07 Dec 2023 07:54:49 -0800 (PST) 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(). Reviewed-by: Sui Jingfeng 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.43.0