From patchwork Thu Feb 22 18:14:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 204980 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp130914dyb; Thu, 22 Feb 2024 10:31:18 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWGU/td0F+L2REPHKAv1L2SoZt/h8n0ekEyfZff4xW46VvL4MhrBgW3CEthQum1FlSp9PLxwyFTD9F889mzMAv3UdldJw== X-Google-Smtp-Source: AGHT+IHvalISAspqYEObKIeEF/Ll2OygCX8k4Wq5FICSEfgyBgbfYobaEYcZWiT7j+GgFVevjbSC X-Received: by 2002:a05:6402:1497:b0:564:a53b:b8ce with SMTP id e23-20020a056402149700b00564a53bb8cemr7296814edv.13.1708626677898; Thu, 22 Feb 2024 10:31:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708626677; cv=pass; d=google.com; s=arc-20160816; b=gRUJr578Q23XXZ8YRhwGsx5Kgo4elTH9T5PMRaosXbWW1nnuwdhVZSOjvcaxcfcHWX Se0e4ihjalmg5QUBZH4P5UlLiOV04orQP+Eov0lhw6plWT8dfbVJQ66K3pH7G1o4pfEH yOZXmEPBIuPoY3gRloqrNWjRnkvm3xSjueQxUatl0rsI0Ro6orH+SUGXNDWqlbbaeHla FxzRaFgRjvTpGIuEroDhAKjly/bFgoxhqpzS0uySPgDEakI0HtjD0v/Skc5Pre25PgLw gM0HgcW2BtaeOqiYEtko3gUWDXthLEcLgybKfqeFYexfmoqH+rqYEQFJlmmoheUQ3sS5 IzEA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=QIST/Uzol5i65SE3NJG6Cz7GwzPANcUlEWG/IP/5F4A=; fh=jHlABrYnApVt5KJlrthitgyo0hqpWWrdlN0oFT+yLLg=; b=lSPzVNOBAiy1UPAlgO0RwcOIa0wAkF5geQwGRbMjy9kOqChDlKVW0eer+VV65fshVp TC/BHQY9kyjV7Bry+WfLLBwc8GFEFJpDtO4w0Q74DS01TF5bEOy2UOL5XOgDeQHe7TP+ uCSYCuHIYr/QFwjLKRCdKK6GfVzfkb4Ld6wNvjSBCDvyU4+3RQC1oLUlOkfh1sE0dbYx f8Flr7ue4qdnY+rjZpppuDJJ3Snc9spcQ1JQ8hCCXV3Eu8xgI/0WVYo7G7l+g3NWIbEq JEdDvAImI3Zeu6ZRFYgzm7OU8SZrunaPvLAArPBxkjY0/TOG5ipkI/YvlnE780//GXVq miWw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Jmup7ZtY; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-77114-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77114-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id bl11-20020a056402210b00b0056446be4293si4852208edb.645.2024.02.22.10.31.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 10:31:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-77114-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Jmup7ZtY; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-77114-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77114-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 812241F22BBE for ; Thu, 22 Feb 2024 18:31:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5996014EFF9; Thu, 22 Feb 2024 18:16:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Jmup7ZtY" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B3F8B14EFC6; Thu, 22 Feb 2024 18:16:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708625763; cv=none; b=DqyQzVmeWwZ4C3L66Xaw1QNwmf4GvhX1IoWbY3Bw3mkEQ3jELAnmRcIMZHfko0a/8EH272mA2AzBA8/d0FxdjkV5cfS9o5NVvJQLA6wwIZlDA4Tyzpewvi2XAQC8iNLpx81QEvYxxLZQgrGU0mMX0uWY0ZzR4KCwmZO2laKueZI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708625763; c=relaxed/simple; bh=BTZIvRqcuCTEKcvLPQKN0PrMjRjf9kk4vsMhE/kOVtY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PhqH7PUrvqAwTWtButs8uHMIRr46q4LobAIwdXiOrI+TY2MAB95OzKDiWErPy59tAPW6QIoh2NOwPtt/OXxJZUQ8NpGFcp+xxbMLrY1Dy50hf+VvArHhhJO+UBCMxZRDfqk3L9M+x2mFjTQDTSDqAezUfYHxf3PiLxcfpHHlcJk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Jmup7ZtY; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42413C43399; Thu, 22 Feb 2024 18:16:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708625763; bh=BTZIvRqcuCTEKcvLPQKN0PrMjRjf9kk4vsMhE/kOVtY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Jmup7ZtY0PC+Ppu5C9ix3hOqqK5wEZ+noUiy7APcEAVG25bVpcSHzOT3QYUEWPg38 vnn4IWUvYJxk0rsjc/ulwqwwMM0SUuBWZ+W51mnhum9GoapU+0A2X1HB7caJRJ/CVd 6QxUKYzJujnEoj4nY906EdIxGaCGNjVSe8yjduq3cOcR3Z9T2stK4Zqv9eUyWu/Erq i0GfhITXuFwGCFBn8Q7XeAhLGwpl3V/zfHEVZblpqKzKKuR9UwiEckxcrnQSde6Ue3 JXjHWcBEN+d556PrpEKnPaRksE9yZKPSvQcNDURhngA6f66MCIzVFCG4n1PMSj83vS f0fzYZ4fejIrw== From: Maxime Ripard Date: Thu, 22 Feb 2024 19:14:20 +0100 Subject: [PATCH v7 34/36] drm/sun4i: hdmi: Switch to container_of_const Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240222-kms-hdmi-connector-state-v7-34-8f4af575fce2@kernel.org> References: <20240222-kms-hdmi-connector-state-v7-0-8f4af575fce2@kernel.org> In-Reply-To: <20240222-kms-hdmi-connector-state-v7-0-8f4af575fce2@kernel.org> To: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Jonathan Corbet , Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: Hans Verkuil , Sebastian Wick , =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= , 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=BTZIvRqcuCTEKcvLPQKN0PrMjRjf9kk4vsMhE/kOVtY=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDKnX+/69f2n8caKoQub+F69/+e2KY3v54bKK+SHvnykL9 me/4wzt6ihlYRDjYpAVU2SJETZfEndq1utONr55MHNYmUCGMHBxCsBEOOwYGW5MTL44peuu6wL+ f5aCIedmyan++RhyZeIKdiFl2Znn9vYz/A+ak310c+ZsyZfhR0Ul1TeK2r3+57NoRdPiCzFbJp7 xucAOAA== X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791624927795147745 X-GMAIL-MSGID: 1791624927795147745 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 Reviewed-by: Jernej Skrabec --- 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)