]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/sched: stop passing non struct drm_device to drm_err() and friends
authorJani Nikula <jani.nikula@intel.com>
Thu, 23 Jan 2025 15:09:10 +0000 (17:09 +0200)
committerJani Nikula <jani.nikula@intel.com>
Tue, 4 Mar 2025 15:03:43 +0000 (17:03 +0200)
The expectation is that the struct drm_device based logging helpers get
passed an actual struct drm_device pointer rather than some random
struct pointer where you can dereference the ->dev member.

Convert drm_err(sched, ...) to dev_err(sched->dev, ...) and
similar. This matches current usage, as struct drm_device is not
available, but drops "[drm]" or "[drm] *ERROR*" prefix from logging.

Unfortunately, there's no dev_WARN_ON(), so the conversion is not
exactly the same.

Reviewed-by: Simona Vetter <simona.vetter@ffwll.ch>
Acked-by: Philipp Stanner <phasta@kernel.org>
Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/fe441dd1469d2b03e6b2ff247078bdde2011c6e3.1737644530.git.jani.nikula@intel.com
drivers/gpu/drm/scheduler/sched_entity.c
drivers/gpu/drm/scheduler/sched_main.c

index 87f88259ddf67fb57945d31e2a25130f53fca033..a6d2a4722d8223b17b4ecb2d1dfac9c870dd6474 100644 (file)
@@ -91,7 +91,7 @@ int drm_sched_entity_init(struct drm_sched_entity *entity,
                 * the lowest priority available.
                 */
                if (entity->priority >= sched_list[0]->num_rqs) {
-                       drm_err(sched_list[0], "entity with out-of-bounds priority:%u num_rqs:%u\n",
+                       dev_err(sched_list[0]->dev, "entity has out-of-bounds priority: %u. num_rqs: %u\n",
                                entity->priority, sched_list[0]->num_rqs);
                        entity->priority = max_t(s32, (s32) sched_list[0]->num_rqs - 1,
                                                 (s32) DRM_SCHED_PRIORITY_KERNEL);
index c634993f1346f9acba905a6585b0509f583e44f7..c0b9822d62741b7c2a281a83b8a80cf1ab662c8f 100644 (file)
@@ -102,9 +102,9 @@ static u32 drm_sched_available_credits(struct drm_gpu_scheduler *sched)
 {
        u32 credits;
 
-       drm_WARN_ON(sched, check_sub_overflow(sched->credit_limit,
-                                             atomic_read(&sched->credit_count),
-                                             &credits));
+       WARN_ON(check_sub_overflow(sched->credit_limit,
+                                  atomic_read(&sched->credit_count),
+                                  &credits));
 
        return credits;
 }
@@ -129,9 +129,11 @@ static bool drm_sched_can_queue(struct drm_gpu_scheduler *sched,
        /* If a job exceeds the credit limit, truncate it to the credit limit
         * itself to guarantee forward progress.
         */
-       if (drm_WARN(sched, s_job->credits > sched->credit_limit,
-                    "Jobs may not exceed the credit limit, truncate.\n"))
+       if (s_job->credits > sched->credit_limit) {
+               dev_WARN(sched->dev,
+                        "Jobs may not exceed the credit limit, truncate.\n");
                s_job->credits = sched->credit_limit;
+       }
 
        return drm_sched_available_credits(sched) >= s_job->credits;
 }
@@ -789,7 +791,7 @@ int drm_sched_job_init(struct drm_sched_job *job,
                 * or worse--a blank screen--leave a trail in the
                 * logs, so this can be debugged easier.
                 */
-               drm_err(job->sched, "%s: entity has no rq!\n", __func__);
+               dev_err(job->sched->dev, "%s: entity has no rq!\n", __func__);
                return -ENOENT;
        }
 
@@ -1263,7 +1265,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched, const struct drm_sched_init_
        if (args->num_rqs > DRM_SCHED_PRIORITY_COUNT) {
                /* This is a gross violation--tell drivers what the  problem is.
                 */
-               drm_err(sched, "%s: num_rqs cannot be greater than DRM_SCHED_PRIORITY_COUNT\n",
+               dev_err(sched->dev, "%s: num_rqs cannot be greater than DRM_SCHED_PRIORITY_COUNT\n",
                        __func__);
                return -EINVAL;
        } else if (sched->sched_rq) {
@@ -1271,7 +1273,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched, const struct drm_sched_init_
                 * fine-tune their DRM calling order, and return all
                 * is good.
                 */
-               drm_warn(sched, "%s: scheduler already initialized!\n", __func__);
+               dev_warn(sched->dev, "%s: scheduler already initialized!\n", __func__);
                return 0;
        }
 
@@ -1326,7 +1328,7 @@ Out_unroll:
 Out_check_own:
        if (sched->own_submit_wq)
                destroy_workqueue(sched->submit_wq);
-       drm_err(sched, "%s: Failed to setup GPU scheduler--out of memory\n", __func__);
+       dev_err(sched->dev, "%s: Failed to setup GPU scheduler--out of memory\n", __func__);
        return -ENOMEM;
 }
 EXPORT_SYMBOL(drm_sched_init);