Re: [PATCH v2] drm: Replace the deprecated DRM_* logging macros in gem helper files

Thomas Zimmermann
2025-08-20T08:50:43Z

Hi

Am 18.08.25 um 21:20 schrieb Athul Raj Kollareth:
> Replace the DRM_* logging macros used in gem helper files with the appropriate
> ones specified in /include/drm/drm_print.h.
>
> Signed-off-by: Athul Raj Kollareth <krathul3152@gmail.com>
> ---
> Changes in v2:
> - Change drm_gem_objects_lookup() to take a drm_device* argument.
> - Make appropriate changes to all calls of drm_gem_objects_lookup().

Please see Michal's reply about using filp->minor->dev for the device.
Saves from any changes to the interface. You might want to be defensive
about it and test for filp->minor for NULL.

Best regards
Thomas

> ---
> drivers/accel/rocket/rocket_job.c | 4 ++--
> drivers/gpu/drm/drm_gem.c | 12 +++++++-----
> drivers/gpu/drm/drm_gem_dma_helper.c | 2 +-
> drivers/gpu/drm/panfrost/panfrost_drv.c | 2 +-
> drivers/gpu/drm/v3d/v3d_submit.c | 2 +-
> drivers/gpu/drm/vc4/vc4_gem.c | 2 +-
> include/drm/drm_gem.h | 5 +++--
> 7 files changed, 16 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/accel/rocket/rocket_job.c b/drivers/accel/rocket/rocket_job.c
> index 5d4afd692306..db7c50c9ab90 100644
> --- a/drivers/accel/rocket/rocket_job.c
> +++ b/drivers/accel/rocket/rocket_job.c
> @@ -560,14 +560,14 @@ static int rocket_ioctl_submit_job(struct drm_device *dev, struct drm_file *file
> if (ret)
> goto out_cleanup_job;
>
> - ret = drm_gem_objects_lookup(file, u64_to_user_ptr(job->in_bo_handles),
> + ret = drm_gem_objects_lookup(dev, file, u64_to_user_ptr(job->in_bo_handles),
> job->in_bo_handle_count, &rjob->in_bos);
> if (ret)
> goto out_cleanup_job;
>
> rjob->in_bo_count = job->in_bo_handle_count;
>
> - ret = drm_gem_objects_lookup(file, u64_to_user_ptr(job->out_bo_handles),
> + ret = drm_gem_objects_lookup(dev, file, u64_to_user_ptr(job->out_bo_handles),
> job->out_bo_handle_count, &rjob->out_bos);
> if (ret)
> goto out_cleanup_job;
> diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
> index 4a89b6acb6af..ee1e5ded6dd6 100644
> --- a/drivers/gpu/drm/drm_gem.c
> +++ b/drivers/gpu/drm/drm_gem.c
> @@ -102,7 +102,7 @@ drm_gem_init(struct drm_device *dev)
> vma_offset_manager = drmm_kzalloc(dev, sizeof(*vma_offset_manager),
> GFP_KERNEL);
> if (!vma_offset_manager) {
> - DRM_ERROR("out of memory\n");
> + drm_err(dev, "out of memory\n");
> return -ENOMEM;
> }
>
> @@ -764,6 +764,7 @@ static int objects_lookup(struct drm_file *filp, u32 *handle, int count,
>
> /**
> * drm_gem_objects_lookup - look up GEM objects from an array of handles
> + * @dev: corresponding drm_device
> * @filp: DRM file private date
> * @bo_handles: user pointer to array of userspace handle
> * @count: size of handle array
> @@ -780,8 +781,9 @@ static int objects_lookup(struct drm_file *filp, u32 *handle, int count,
> * failure. 0 is returned on success.
> *
> */
> -int drm_gem_objects_lookup(struct drm_file *filp, void __user *bo_handles,
> - int count, struct drm_gem_object ***objs_out)
> +int drm_gem_objects_lookup(struct drm_device *dev, struct drm_file *filp,
> + void __user *bo_handles, int count,
> + struct drm_gem_object ***objs_out)
> {
> int ret;
> u32 *handles;
> @@ -805,7 +807,7 @@ int drm_gem_objects_lookup(struct drm_file *filp, void __user *bo_handles,
>
> if (copy_from_user(handles, bo_handles, count * sizeof(u32))) {
> ret = -EFAULT;
> - DRM_DEBUG("Failed to copy in GEM handles\n");
> + drm_dbg_core(dev, "Failed to copy in GEM handles\n");
> goto out;
> }
>
> @@ -858,7 +860,7 @@ long drm_gem_dma_resv_wait(struct drm_file *filep, u32 handle,
>
> obj = drm_gem_object_lookup(filep, handle);
> if (!obj) {
> - DRM_DEBUG("Failed to look up GEM BO %d\n", handle);
> + drm_dbg_core(NULL, "Failed to look up GEM BO %d\n", handle);
> return -EINVAL;
> }
>
> diff --git a/drivers/gpu/drm/drm_gem_dma_helper.c b/drivers/gpu/drm/drm_gem_dma_helper.c
> index 4f0320df858f..a507cf517015 100644
> --- a/drivers/gpu/drm/drm_gem_dma_helper.c
> +++ b/drivers/gpu/drm/drm_gem_dma_helper.c
> @@ -582,7 +582,7 @@ drm_gem_dma_prime_import_sg_table_vmap(struct drm_device *dev,
>
> ret = dma_buf_vmap_unlocked(attach->dmabuf, &map);
> if (ret) {
> - DRM_ERROR("Failed to vmap PRIME buffer\n");
> + drm_err(dev, "Failed to vmap PRIME buffer\n");
> return ERR_PTR(ret);
> }
>
> diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
> index 1ea6c509a5d5..3ffd9d5a9056 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_drv.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
> @@ -188,7 +188,7 @@ panfrost_lookup_bos(struct drm_device *dev,
> if (!job->bo_count)
> return 0;
>
> - ret = drm_gem_objects_lookup(file_priv,
> + ret = drm_gem_objects_lookup(dev, file_priv,
> (void __user *)(uintptr_t)args->bo_handles,
> job->bo_count, &job->bos);
> if (ret)
> diff --git a/drivers/gpu/drm/v3d/v3d_submit.c b/drivers/gpu/drm/v3d/v3d_submit.c
> index 5171ffe9012d..a3ac8e6a4a72 100644
> --- a/drivers/gpu/drm/v3d/v3d_submit.c
> +++ b/drivers/gpu/drm/v3d/v3d_submit.c
> @@ -79,7 +79,7 @@ v3d_lookup_bos(struct drm_device *dev,
> return -EINVAL;
> }
>
> - return drm_gem_objects_lookup(file_priv,
> + return drm_gem_objects_lookup(dev, file_priv,
> (void __user *)(uintptr_t)bo_handles,
> job->bo_count, &job->bo);
> }
> diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c
> index 255e5817618e..6ce65611231b 100644
> --- a/drivers/gpu/drm/vc4/vc4_gem.c
> +++ b/drivers/gpu/drm/vc4/vc4_gem.c
> @@ -692,7 +692,7 @@ vc4_cl_lookup_bos(struct drm_device *dev,
> return -EINVAL;
> }
>
> - ret = drm_gem_objects_lookup(file_priv, u64_to_user_ptr(args->bo_handles),
> + ret = drm_gem_objects_lookup(dev, file_priv, u64_to_user_ptr(args->bo_handles),
> exec->bo_count, &exec->bo);
>
> if (ret)
> diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h
> index d3a7b43e2c63..03cb03f46524 100644
> --- a/include/drm/drm_gem.h
> +++ b/include/drm/drm_gem.h
> @@ -544,8 +544,9 @@ void drm_gem_unlock(struct drm_gem_object *obj);
> int drm_gem_vmap(struct drm_gem_object *obj, struct iosys_map *map);
> void drm_gem_vunmap(struct drm_gem_object *obj, struct iosys_map *map);
>
> -int drm_gem_objects_lookup(struct drm_file *filp, void __user *bo_handles,
> - int count, struct drm_gem_object ***objs_out);
> +int drm_gem_objects_lookup(struct drm_device *dev, struct drm_file *filp,
> + void __user *bo_handles, int count,
> + struct drm_gem_object ***objs_out);
> struct drm_gem_object *drm_gem_object_lookup(struct drm_file *filp, u32 handle);
> long drm_gem_dma_resv_wait(struct drm_file *filep, u32 handle,
> bool wait_all, unsigned long timeout);

--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)