mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Javier Martinez Canillas <javierm@redhat.com>
To: Iker Pedrosa <ikerpedrosam@gmail.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Iker Pedrosa <ikerpedrosam@gmail.com>
Subject: Re: [PATCH 1/5] drm/solomon: Move calls to drm_gem_fb_end_cpu*()
Date: Wed, 17 Sep 2025 11:06:11 +0200	[thread overview]
Message-ID: <874it1phx8.fsf@minerva.mail-host-address-is-not-set> (raw)
In-Reply-To: <20250912-improve-ssd130x-v1-1-bc9389ed299e@gmail.com>

Iker Pedrosa <ikerpedrosam@gmail.com> writes:

Hello Iker,

Thanks for your patch.

> Calls to drm_gem_fb_end_cpu*() should be between the calls to
> drm_dev*(), and not hidden inside some other function. This way the
> critical section code is visible at a glance, keeping it short and
> improving maintainability.
>
> Signed-off-by: Iker Pedrosa <ikerpedrosam@gmail.com>
> ---
>  drivers/gpu/drm/solomon/ssd130x.c | 33 +++++++++++++++------------------
>  1 file changed, 15 insertions(+), 18 deletions(-)
>

[...]

> @@ -1232,6 +1214,9 @@ static void ssd130x_primary_plane_atomic_update(struct drm_plane *plane,
>  	if (!drm_dev_enter(drm, &idx))
>  		return;
>  
> +	if (drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE))
> +		return;
> +

In this error path you should call drm_dev_exit(). The convention in the
kernel usually is to have a goto label for this, e.g.:

       if (drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE))
              goto out_drm_dev_exit;

>  	drm_atomic_helper_damage_iter_init(&iter, old_plane_state, plane_state);
>  	drm_atomic_for_each_plane_damage(&iter, &damage) {
>  		dst_clip = plane_state->dst;
> @@ -1245,6 +1230,8 @@ static void ssd130x_primary_plane_atomic_update(struct drm_plane *plane,
>  				     &shadow_plane_state->fmtcnv_state);
>  	}
>  
> +	drm_gem_fb_end_cpu_access(fb, DMA_FROM_DEVICE);
> +

and then here before the call you could have the label.

out_drm_dev_exit:

>  	drm_dev_exit(idx);

Same comments for the other places where you are adding the
drm_gem_fb_end_cpu*() calls next to the drm_dev*() ones.

After the mentioned changes:

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


  reply	other threads:[~2025-09-17  9:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-12 16:42 [PATCH 0/5] drm/solomon: Code improvements and DRM helper adoption Iker Pedrosa
2025-09-12 16:42 ` [PATCH 1/5] drm/solomon: Move calls to drm_gem_fb_end_cpu*() Iker Pedrosa
2025-09-17  9:06   ` Javier Martinez Canillas [this message]
2025-09-17  9:20     ` Thomas Zimmermann
2025-09-12 16:42 ` [PATCH 2/5] drm/solomon: Use drm_WARN_ON_ONCE instead of WARN_ON Iker Pedrosa
2025-09-17  9:23   ` Javier Martinez Canillas
2025-09-12 16:42 ` [PATCH 3/5] drm/solomon: Simplify mode_valid() using DRM helper Iker Pedrosa
2025-09-17  9:27   ` Javier Martinez Canillas
2025-09-12 16:42 ` [PATCH 4/5] drm/solomon: Simplify get_modes() " Iker Pedrosa
2025-09-17  9:28   ` Javier Martinez Canillas
2025-09-12 16:42 ` [PATCH 5/5] drm/solomon: Enforce one assignment per line Iker Pedrosa
2025-09-17  9:29   ` Javier Martinez Canillas
2025-09-15 11:24 ` [PATCH 0/5] drm/solomon: Code improvements and DRM helper adoption Thomas Zimmermann

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=874it1phx8.fsf@minerva.mail-host-address-is-not-set \
    --to=javierm@redhat.com \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ikerpedrosam@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®