From patchwork Wed Sep 20 14:35:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 142447 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp4196547vqi; Wed, 20 Sep 2023 07:50:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHQf5BrjCceb804YyzYIXNZf2uw4xMGxiWvQ3NANmszfuKd7seAxfOh05pqxNAIORkpNjDL X-Received: by 2002:a05:6358:998f:b0:132:d333:4a5c with SMTP id j15-20020a056358998f00b00132d3334a5cmr3109459rwb.10.1695221439918; Wed, 20 Sep 2023 07:50:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695221439; cv=none; d=google.com; s=arc-20160816; b=ORRGYsS9/zBfXaHtpxhkPXEqYVJ7wf1SzmgZkDb5mNJ+LlvXa2VtQjKwDH2WpkIuNb hTd1+GeWhjNkiXcW9wUCrqLQw8r1+Haweo72MZajwIeLDwamnCck1B3q4odYtMAs0yxQ neUkXfnPuGR4VEwXCY9ZTxn47Jc0qEM/P7F58vq2k/8ecKGJyVi/KSjbbeSoXQDffE48 eZM7ocl8S5rGOE0pj6mADF3sHmwFM931/9vLrV3xhDY5/bHCHGXp1Ew2u8JjcwWO8Nce juEnEcQXRuGMq3lVlIWmXY/va3QIkEN8FQE5hE3CgI0jBUU3mIUHsU/KiAhd/81fwHO7 D7xQ== 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 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id f27-20020a63101b000000b005648b1d63aasi11456054pgl.553.2023.09.20.07.50.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 07:50:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; 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 23.128.96.36 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 pete.vger.email (Postfix) with ESMTP id 34D918311B7B; Wed, 20 Sep 2023 07:39:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236891AbjITOi6 (ORCPT + 27 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 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=-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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email 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 (pete.vger.email [0.0.0.0]); Wed, 20 Sep 2023 07:39:35 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777568516283302083 X-GMAIL-MSGID: 1777568516283302083 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)