From patchwork Mon Feb 12 13:13:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 199782 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp2426034dyd; Mon, 12 Feb 2024 05:28:44 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUYlvlocsiomg7B5G7c8b+7wkRtdYcF3VNmbvV9l3KOT4IzjdjkTGIc1fF8TJ6l3F/G0oTGskIj3mvme/xDtZKrwsgCzg== X-Google-Smtp-Source: AGHT+IGkNwN1gYAXiLefr+afa+0CtPEUVDLHF6JTJSqqmIgXy56n7asma1NjwvltHrXfpQTxzhab X-Received: by 2002:a05:6871:7514:b0:219:75a7:5f43 with SMTP id ny20-20020a056871751400b0021975a75f43mr5936623oac.37.1707744524160; Mon, 12 Feb 2024 05:28:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707744524; cv=pass; d=google.com; s=arc-20160816; b=y/YvRZ8aZryw4A6e9eb3IRO9OxnVCyGzKf0vjpk+zIHKBKLKf2MjXVWq4sewE/7xcI YbVleGpt1fzO0IHE2qqpNndpcGjiKzk2+HmRMyIlV7KOe/WjqAF2AH+l8tKijTGyWEXR OWMrAgonGjgvH3iHn5+CXE5bBun56xLlVeGbwVuvdQToo5l0GUCEsg+2RivIXiSriNtk m4LoCXwAFv3DJPRpN+Gutk07pKM2e7Grj5P7MelgMO24iSfPFP63FByBBcYz5/t5VKRs Ut5lqYMzf7mkfbnYSrd4eGwIftWWsSu/CuX7Twc65Q0MRWD55I8PAOos+xBpbh8M3Dwd 9alQ== 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=8X+6xpGvGMK4DaOOfocn5mZ/84gxhJwU8WJdEmQq88g=; fh=b2+X7gymVnag85Ssci+x67st1DoFbmnu0ilZ5fp3Px0=; b=PqSZ03tgne/uXC2OSZqyBaXAMDPKC6Xentsi09c6ueZU31ex8lFIf5bZPo7c2v/HG2 G+HSPpHf3T6DcCle18B9M9J/9LznS8w1aGFLLmvw/7uHV8ReudWC37yceDywxFTE3wCw tKH8orBN+IYAA/w6IwcR1BY5Huz6zNvwZqrMvXgzTDuGnsE4BtC4VV8nFX/pafabBkbA voniwWKEZg3l2xinLzmoBbNRtQOpk0kckV1gPb8oAjHOZLwFQV3hi+Fk6A1+2M4wSpWf A+5z82ZY+SAzkdmR8cfBx/Fro4ocMe6TNfQh5sfo6HM2L4h9yFiYbdoRPzbPb5zRx4IC fV/Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ui7XWkL0; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-61659-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61659-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCWA++GGgBt5r0cW3lcaklYIap17ADE4AOBiwVriMy0dwHNkId+ghLF8ItoGoKOmutEzo2S54TryaWlrycXr2uJQ1KScwQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id k22-20020ac85fd6000000b0042c7cd394f1si397018qta.57.2024.02.12.05.28.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 05:28:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61659-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ui7XWkL0; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-61659-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61659-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E77441C216BC for ; Mon, 12 Feb 2024 13:28:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 60C98535D1; Mon, 12 Feb 2024 13:15:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Ui7XWkL0" 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 ADE0953391; Mon, 12 Feb 2024 13:15:05 +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=1707743705; cv=none; b=A/1UGZ4N+5jvlvhF1COMoNnhVs0LEgmOmBpFj7OheCRPQUUT7MiPfI0+bYFXvuKsL/0yhEY2/r6NRIuC+U0LFs3pISTuB7VP+wenrF6QCuSPdxtrHt8UOK51xNvChNcLaDqia5s7nbqCT2tAfLFcaWvWu/isExSY9CvHWm0o/ZY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707743705; c=relaxed/simple; bh=pVOwlxGRG4Yx77sVCEVDWc/W+8/UbYOVd7SBFXh+HU4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tQwoK0Weypo4ca/fUgw655Wcrm7ACdIOarXKmGSgDs3R0i3QAhR0ZGs1cPxVAHx+syV0OuHqUf7P/0xYI3/5q0IJOxGlIOHTuWHrN4kAhMzS00yJrccEXAX8xTx6fgJKxRUJeDqRmjz2vBQZqHFiiiYZsf4eUpXW6MN290p5AOw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ui7XWkL0; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 376E2C433F1; Mon, 12 Feb 2024 13:15:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707743705; bh=pVOwlxGRG4Yx77sVCEVDWc/W+8/UbYOVd7SBFXh+HU4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Ui7XWkL0oI5fI+U4c+5RDww7fbXJ7n6ga02OInJjaLdlqpnx0TXzXuSEOommzRzZO Pb9VW5WGRbqJMPszuaD+NxwHwTtJdNZjyySJG5gStr+o/hP+0yAbK6AT3oiU9YdD/m jK79GfBaYCpvE/tIcoA8NnYab0E3Fm8vPb6K3+gvvR78pFSCCZcV1nqs/maIOOk/6c GO74aHFo4IB5M8DbqRzwCZOATCyKLTgfqrLTdWoB7x8yNrf07LOOVdJkmSKKEXrRgA XzVidhy4Dzkx+6BGuDSLHJ3ONUDcP8kzPrvO8qixDrDD4mGWwQ9rPNeQi89idxPRwE H7onuj7vJK9XA== From: Maxime Ripard Date: Mon, 12 Feb 2024 14:13:17 +0100 Subject: [PATCH v6 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: <20240212-kms-hdmi-connector-state-v6-34-f4bcdc979e6f@kernel.org> References: <20240212-kms-hdmi-connector-state-v6-0-f4bcdc979e6f@kernel.org> In-Reply-To: <20240212-kms-hdmi-connector-state-v6-0-f4bcdc979e6f@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+D1vfrpE4FHG02pJDKmnJEvizUo8N/gt2Ch6I6iqf8P9PsXAzoS0a4uuKtfuE eOcwz+5o5SFQYyLQVZMkSVG2HxJ3KlZrzvZ+ObBzGFlAhnCwMUpABN5vZ6R4bbnj3Uzs7lj/x8K fB2SeWCtiqn/eudNSxn6J3WuTf29v5Dhn0nnhvf51TaRJ5WYt9Q0Bh10X/N5tr4VB0eBxWFfO41 GPgA= X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790699922141375616 X-GMAIL-MSGID: 1790699922141375616 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)