dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Maxime Ripard <mripard@kernel.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	dri-devel@lists.freedesktop.org,
	Russell King <linux@armlinux.org.uk>
Subject: Re: [PATCH v3 13/39] drm/armada: Drop always true condition in atomic_check
Date: Tue, 9 Sep 2025 16:39:07 +0300	[thread overview]
Message-ID: <aMAt-_CheWl5XGNF@intel.com> (raw)
In-Reply-To: <20250909-drm-no-more-existing-state-v3-13-1c7a7d960c33@kernel.org>

On Tue, Sep 09, 2025 at 01:27:32PM +0200, Maxime Ripard wrote:
> The drm_atomic_state pointer passed to atomic_check is always valid, so
> checking if it's NULL or not is pointless. Remove the check.
> 
> Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Maxime Ripard <mripard@kernel.org>
> 
> ---
> To: Russell King <linux@armlinux.org.uk>
> ---
>  drivers/gpu/drm/armada/armada_plane.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/armada/armada_plane.c b/drivers/gpu/drm/armada/armada_plane.c
> index cc47c032dbc151a463cbd0b0d048c74c2828f253..976b6a271c912421e3fec7525f77234e73a74212 100644
> --- a/drivers/gpu/drm/armada/armada_plane.c
> +++ b/drivers/gpu/drm/armada/armada_plane.c
> @@ -83,25 +83,20 @@ int armada_drm_plane_atomic_check(struct drm_plane *plane,
>  {
>  	struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(state,
>  										 plane);
>  	struct armada_plane_state *st = to_armada_plane_state(new_plane_state);
>  	struct drm_crtc *crtc = new_plane_state->crtc;
> -	struct drm_crtc_state *crtc_state;
> +	struct drm_crtc_state *crtc_state =
> +		drm_atomic_get_existing_crtc_state(state, crtc);

new_plane_state->crtc might be NULL here.

>  	bool interlace;
>  	int ret;
>  
>  	if (!new_plane_state->fb || WARN_ON(!new_plane_state->crtc)) {
>  		new_plane_state->visible = false;
>  		return 0;
>  	}
>  

Here we know it's not NULL.

> -	if (state)
> -		crtc_state = drm_atomic_get_existing_crtc_state(state,
> -								crtc);
> -	else
> -		crtc_state = crtc->state;
> -
>  	ret = drm_atomic_helper_check_plane_state(new_plane_state, crtc_state,
>  						  0,
>  						  INT_MAX, true, false);
>  	if (ret)
>  		return ret;
> 
> -- 
> 2.50.1

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2025-09-09 13:39 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-09 11:27 [PATCH v3 00/39] drm/atomic: Get rid of existing states (not really) Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 01/39] drm/atomic: Convert drm_atomic_get_connector_state() to use new connector state Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 02/39] drm/atomic: Remove unused drm_atomic_get_existing_connector_state() Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 03/39] drm/atomic: Document __drm_connectors_state state pointer Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 04/39] drm/atomic: Convert __drm_atomic_get_current_plane_state() to modern accessor Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 05/39] drm/atomic: Convert drm_atomic_get_plane_state() to use new plane state Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 06/39] drm/vkms: Convert vkms_crtc_atomic_check() " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 07/39] drm/tilcdc: crtc: Use drm_atomic_helper_check_crtc_primary_plane() Maxime Ripard
2025-09-12  9:43   ` Jyri Sarha
2025-09-09 11:27 ` [PATCH v3 08/39] drm/atomic: Remove unused drm_atomic_get_existing_plane_state() Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 09/39] drm/atomic: Document __drm_planes_state state pointer Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 10/39] drm/atomic: Convert drm_atomic_get_crtc_state() to use new connector state Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 11/39] drm/ingenic: ipu: Switch to drm_atomic_get_new_crtc_state() Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 12/39] drm/arm/malidp: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 13/39] drm/armada: Drop always true condition in atomic_check Maxime Ripard
2025-09-09 13:39   ` Ville Syrjälä [this message]
2025-09-09 11:27 ` [PATCH v3 14/39] drm/armada: Switch to drm_atomic_get_new_crtc_state() Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 15/39] drm/atmel-hlcdc: " Maxime Ripard
2025-09-16  6:52   ` Manikandan.M
2025-09-09 11:27 ` [PATCH v3 16/39] drm/exynos: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 17/39] drm/imx-dc: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 18/39] drm/imx-dcss: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 19/39] drm/imx-ipuv3: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 20/39] drm/ingenic: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 21/39] drm/kmb: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 22/39] drm/logicvc: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 23/39] drm/loongson: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 24/39] drm/mediatek: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 25/39] drm/msm/mdp5: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 26/39] drm/omap: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 27/39] drm/rockchip: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 28/39] drm/sun4i: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 29/39] drm/tegra: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 30/39] drm/tilcdc: " Maxime Ripard
2025-09-12  9:47   ` Jyri Sarha
2025-09-09 11:27 ` [PATCH v3 31/39] drm/vboxvideo: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 32/39] drm/vc4: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 33/39] drm/atomic: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 34/39] drm/framebuffer: " Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 35/39] drm/atomic: Remove unused drm_atomic_get_existing_crtc_state() Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 36/39] drm/atomic: Document __drm_crtcs_state state pointer Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 37/39] drm/ingenic: crtc: Switch to ingenic_drm_get_new_priv_state() Maxime Ripard
2025-09-09 11:43   ` Paul Cercueil
2025-09-09 13:52   ` Ville Syrjälä
2025-09-09 14:45     ` Paul Cercueil
2025-09-10 11:26       ` Maxime Ripard
2025-09-10 13:14         ` Paul Cercueil
2025-09-10 12:19       ` Ville Syrjälä
2025-09-09 11:27 ` [PATCH v3 38/39] drm/atomic: Convert drm_atomic_get_private_obj_state() to use new plane state Maxime Ripard
2025-09-09 11:27 ` [PATCH v3 39/39] drm/atomic: Document __drm_private_objs_state state pointer Maxime Ripard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aMAt-_CheWl5XGNF@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux@armlinux.org.uk \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox