Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3872728rdh; Tue, 28 Nov 2023 06:12:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IHa1J6PVfpsyaSLGMmsVoofe5oWvxPt4/5KwV/rEUW3KIGuv8ZaU+NY+WJRWjuAmzSb0XW+ X-Received: by 2002:a05:6830:58:b0:6d8:322d:e76d with SMTP id d24-20020a056830005800b006d8322de76dmr4682161otp.38.1701180766857; Tue, 28 Nov 2023 06:12:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701180766; cv=none; d=google.com; s=arc-20160816; b=njP8aURlaipiY9KChCNAL9KuO4pEAD0oCGY86mJXY3PnBSRZA5SYbrUgPDL/N6FGw2 Zqp9tEK8fcfolHHJS9BW/k6dFgwFbT6OIukH6ZLZNCkMfi5bjLAsvcEbfBhw7DOZnyWE dV0JZFjNCcIsIvt/01h+OYuaqGA92CBEy46NK9rg+QNHV2qa9b3nD04ImdDTWc/tw2zr Kt0ga6CPDGYBJP48Nud5C9Wqrj3zQQfxQn8Eip6seBMNh242O3oz8MsJ43oXFQk5/Wjl 8sZVNwf1diq5EEk4QKAliuYDnFQyzSRkkIscfGgpjeO8W/vJIGqjNQnnn8kjjri+Umwg IiZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:mime-version:date :dkim-signature:message-id; bh=Hxr6Qi8uAR1GAsmRwi31SrOVsQk0+PK+MAopQh8m5vk=; fh=Faqqo5FCrNJlgJus6y7odaXTkoXWw1VVK1ZjdsjuRmw=; b=FN9apkvfBKkHJQswr6Swf1XT+X8gt/HYUxYypxzLCK5bfeSxv3cDX/3SzauksT53u3 0fGspafxTV+3+IV+lkzqY7JYGHSHSM3ICJ4iWCiQEGmVYq3jBTqW254/H/RCECmyN/1/ W+ZH+hwckI8XwvZHvLD54Zo3JcYRSVdHTXfMKatzTqZvOa+MqIcALAaSN5neuMppPEYO Llt0UUSnHEjQeio08cMoSSyYJYAy1NAcTVpePcfFiYvxWA8KDKZlvfl7gkieEqB7Wsz4 mzlxHOqlS/yqhkG/UTp/Fqw4VWLulxraa2E4GRYlqyXPYVzo47XiZD/5YkN8ia8Ae4m7 dNNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=lKKIARly; 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=linux.dev Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id z10-20020a9d65ca000000b006d7f6879207si4761925oth.99.2023.11.28.06.12.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 06:12:46 -0800 (PST) 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=@linux.dev header.s=key1 header.b=lKKIARly; 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=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id B2EEF8051934; Tue, 28 Nov 2023 06:12:45 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346348AbjK1OMf (ORCPT + 99 others); Tue, 28 Nov 2023 09:12:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346336AbjK1OMR (ORCPT ); Tue, 28 Nov 2023 09:12:17 -0500 Received: from out-171.mta0.migadu.com (out-171.mta0.migadu.com [IPv6:2001:41d0:1004:224b::ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B369E1FE2 for ; Tue, 28 Nov 2023 06:11:51 -0800 (PST) Message-ID: <6d0f8057-70f9-46f9-828a-df03c753b42b@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1701180706; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Hxr6Qi8uAR1GAsmRwi31SrOVsQk0+PK+MAopQh8m5vk=; b=lKKIARlyv1H6YGZl6IGyLBEni04sQJfG863/4ZgCGXNR9S/hHpHmfvXyouaj//rnKHuvYk 43za6NCU8WEn9fiHOOidCkKIH83XwBPPuHZ4e1Grw5BHUwFC6vH+V7cw0wmx5/w3WiJdFA LOF/zVvAJBOiCI+vxywRaIkiRGMDZMs= Date: Tue, 28 Nov 2023 22:11:24 +0800 MIME-Version: 1.0 Subject: Re: [v4,43/45] drm/sun4i: hdmi: Switch to container_of_const Content-Language: en-US To: Maxime Ripard , 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: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Hans Verkuil , linux-rockchip@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org References: <20231128-kms-hdmi-connector-state-v4-43-c7602158306e@kernel.org> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Sui Jingfeng In-Reply-To: <20231128-kms-hdmi-connector-state-v4-43-c7602158306e@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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, 28 Nov 2023 06:12:45 -0800 (PST) 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 LGTM, Reviewed-by: Sui Jingfeng > --- > 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)