Message ID | 20231128-kms-hdmi-connector-state-v4-43-c7602158306e@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp3815684vqx; Tue, 28 Nov 2023 02:30:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IHOCz+JZj6xtK3qdMIP3EiTwFYvUbgoy3zLe3SUkQRrKCkP7DuYGWNarRXnn/aQgWDaBSfK X-Received: by 2002:a17:90b:1d83:b0:285:adca:e8e7 with SMTP id pf3-20020a17090b1d8300b00285adcae8e7mr8762907pjb.5.1701167445099; Tue, 28 Nov 2023 02:30:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701167445; cv=none; d=google.com; s=arc-20160816; b=Y3APhFhh1+2HkYuDddymlkuwkh+9uAyWiV30Ly/pNaiL4Sn49XeAcHeNkT0RLPQewK r7GI/DIuWTdyYS9FrTTWXqBhbfnEmlN+3aQm8rHD61NVpFmOhPCFjVQ7yKJMF8r1NVUo V2uCIFZoiNPO2yeN23ic9Xy3XhP7oGljE/d/XPYKDm0xy+36aBfhQKqlYGK65++sqbmF qiNJBXYlvw7nCuEWLqxPOzDv+HRMak8jj24QmZAVpSTBkYrKnyNE/QdjOfoMRA7JAaNO MTzljW2NRvjwC9GVgtjH9dYV1l5JAzAenJmdkbHTB7cecQ2IxgJkDxamOz5VFadQDEW7 uWPQ== 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=BJtwyO7LfN8ma2JpWgV+uKCb41ddR9PvtMDONS3/xiDJL7Y5KLMgclu8luasvz4sZE 6HS1uyiO/+Qut/GAmw1Fo1ubG8utAUBnRiWuETEb38qHEbXIjzBvcebgnWMO+wdhxqQD IMbPSDlr4BQd4bG9fbrXWhLNr1Ztcb8r3z83MyVqNQRSb9rLzfjp2bHFrML2SK3QrxAF s8ZbNZfTISzjvdgYSrG+5KcXL+hrpyl4E9VhVYMZIqnFQhuD0BUr+2TJTxPD6vJ+kCkf PyViW8jEY2jHGIzJKITMZgOQzfthIaGOTq7Ho5nGVa5LuhAnrrIL6k81qg3xWn8OnZ7n a0dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Xniu33YR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id u8-20020a17090a3fc800b0028525cfb9f9si11768328pjm.105.2023.11.28.02.30.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 02:30:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Xniu33YR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id 2757B809C929; Tue, 28 Nov 2023 02:30:42 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344210AbjK1KaT (ORCPT <rfc822;toshivichauhan@gmail.com> + 99 others); Tue, 28 Nov 2023 05:30:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234915AbjK1K32 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 28 Nov 2023 05:29:28 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F5B4324F for <linux-kernel@vger.kernel.org>; Tue, 28 Nov 2023 02:26:25 -0800 (PST) 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 <mripard@kernel.org> 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 <maarten.lankhorst@linux.intel.com>, Thomas Zimmermann <tzimmermann@suse.de>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, Emma Anholt <emma@anholt.net>, Jonathan Corbet <corbet@lwn.net>, Sandy Huang <hjc@rock-chips.com>, =?utf-8?q?Heiko_St=C3=BCbner?= <heiko@sntech.de>, Chen-Yu Tsai <wens@csie.org>, Jernej Skrabec <jernej.skrabec@gmail.com>, Samuel Holland <samuel@sholland.org> Cc: Hans Verkuil <hverkuil@xs4all.nl>, 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 <mripard@kernel.org> 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-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 28 Nov 2023 02:30:42 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783803355266232159 X-GMAIL-MSGID: 1783803355266232159 |
Series |
drm/connector: Create HDMI Connector infrastructure
|
|
Commit Message
Maxime Ripard
Nov. 28, 2023, 10:24 a.m. UTC
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 <mripard@kernel.org>
---
drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
Comments
Hi, On 2023/11/28 18:24, Maxime Ripard wrote: > 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 <mripard@kernel.org> LGTM, Reviewed-by: Sui Jingfeng <sui.jingfeng@linux.dev> > --- > 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)
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)