From patchwork Tue Oct 31 16:48:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 160271 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b90f:0:b0:403:3b70:6f57 with SMTP id t15csp375881vqg; Tue, 31 Oct 2023 09:55:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGjemWJ9D6iADplw6eThCcVyiFbRFqUiskT2XKwu7O2IP0eA5QqSF0Xeb/Exp11dd41N4R5 X-Received: by 2002:a17:90a:fc8e:b0:280:ac76:69bb with SMTP id ci14-20020a17090afc8e00b00280ac7669bbmr1322984pjb.2.1698771303685; Tue, 31 Oct 2023 09:55:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698771303; cv=none; d=google.com; s=arc-20160816; b=mNDB8r0yWqsdP+QzkMSvBdpR6DIjjXIwCqRrHyaeCJ4fO+JcZWPijaSsgnzvXbC3W2 VZBDww93Vt90dHkc44WPsy7HHlwtsZsylfasyeA6FjDjUcK34985c8mJvfd1+8cFfGbG 8y0Se8okmhvxqIdzI1JBiifI3EjHZsYmRxukTjCoso4jIZCsMwcwzuDx+y0XUZng11ul utjkJm31oVpHSQQCBD1UWCCaW1ubOLkGrapgxnhsBiGlpg3Tga82aIJKYik+vgJPt5Xr 7VnbcfHj+19EUPb9LeoSN0uN24Rz1M1UlCxnPj6lnj8BL8y+wRw1JRes4YsNj9n4s3Z5 Lu5g== 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=nt5dj4rvb4vE7CPha22LpUOKiiPxyscGmrPCTTXEh4rVwm2YEdgNJEte7oTW7utRwt FkS6wLSUHx2f5SPw1qcIwMwuXTfLnHFhuk+NgVL3TEf3Gv5bNJi5GtwWbuFUx9Jw9eC0 pd2xrgM0MAlA8RIUye1Mi0sRATyUhnOXFuJLX+Wr5jMB5XzJmsqLUlCeM6SwraIYS1UL YQF3ThzCwRO+9ItVmIaUeDUf0796m+VXMJgJD1xRZrbtD0TTCHzKHSHdKuS/HC7qrw3U OYDOxCDzL9b89i38U0GbYmhlCTVE/mMrGh/zsH5Gy4CmavKg27PXlLv4zh6jgJoyfCDa U35A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LKl9FeWJ; 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id p14-20020a17090a4f0e00b002801f1333fesi1151560pjh.128.2023.10.31.09.55.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 09:55:03 -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=LKl9FeWJ; 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 A329B80ECF27; Tue, 31 Oct 2023 09:55:02 -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 S1346786AbjJaQyy (ORCPT + 33 others); Tue, 31 Oct 2023 12:54:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346511AbjJaQwg (ORCPT ); Tue, 31 Oct 2023 12:52:36 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E7C110F9; Tue, 31 Oct 2023 09:50:14 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50A14C433C9; Tue, 31 Oct 2023 16:50:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698771013; bh=BKAqssSSrz/lWlwNaLsJkad1kx62XBx3UGaeEawTwAE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=LKl9FeWJaHq869sseHpye9UOjmAohwH8x7IADYt/bJhPUJ0cfJkq7aM2HvYfKh9In DIkOPbNmYxurvX1rjCH5KuIkMP1B5mB12FwCH4suR93h4tmKpQsgDounwXNoc57OrV hVqZjH2snA6rhJaB5cp2M2u6cDdRmXtcq1900OP7LrExL9tkDHphfVtcCjqbBWM3OM MUbjP49xhviEC4wDmujF1UtnAD+8QcUzTrj/fZ+DPbiroo4MKVxBFdNxSi/D73d+r6 qX//dJ7DRZdv+hxa+dIvg76nQcRISUUwJ9yhtSEjiL0lT1sv/r693XiCpdXTwmexsS hXvhN5cwWGwqQ== From: Maxime Ripard Date: Tue, 31 Oct 2023 17:48:48 +0100 Subject: [PATCH RFC v3 35/37] drm/sun4i: hdmi: Switch to container_of_const MIME-Version: 1.0 Message-Id: <20231031-kms-hdmi-connector-state-v3-35-328b0fae43a7@kernel.org> References: <20231031-kms-hdmi-connector-state-v3-0-328b0fae43a7@kernel.org> In-Reply-To: <20231031-kms-hdmi-connector-state-v3-0-328b0fae43a7@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+D1vfrpE4FHG02pJDKmO+vddm8P4p5/ZuibZ+EbKgX7LSZpbzKKaU/7bsxsti tm/g7Oyo5SFQYyLQVZMkSVG2HxJ3KlZrzvZ+ObBzGFlAhnCwMUpABMp7GX4Xz5jq8lTOQfNc49y v13qEZl2RYxbb2NS+LGyDFk7323n7zAyHAswNXWZfT54svCaIwExmcd4rt0veSN8xcrM51mcXZg KHwA= X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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]); Tue, 31 Oct 2023 09:55:02 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781290818430747167 X-GMAIL-MSGID: 1781290818430747167 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)