Skip to content

Commit ca54239

Browse files
jnikulalutzbichler
authored andcommitted
drm/sched: stop passing non struct drm_device to drm_err() and friends
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 <[email protected]> Acked-by: Philipp Stanner <[email protected]> Reviewed-by: Louis Chauvet <[email protected]> Signed-off-by: Jani Nikula <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/fe441dd1469d2b03e6b2ff247078bdde2011c6e3.1737644530.git.jani.nikula@intel.com
1 parent 6a4f83b commit ca54239

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

drivers/gpu/drm/scheduler/sched_entity.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ int drm_sched_entity_init(struct drm_sched_entity *entity,
9191
* the lowest priority available.
9292
*/
9393
if (entity->priority >= sched_list[0]->num_rqs) {
94-
drm_err(sched_list[0], "entity with out-of-bounds priority:%u num_rqs:%u\n",
94+
dev_err(sched_list[0]->dev, "entity has out-of-bounds priority: %u. num_rqs: %u\n",
9595
entity->priority, sched_list[0]->num_rqs);
9696
entity->priority = max_t(s32, (s32) sched_list[0]->num_rqs - 1,
9797
(s32) DRM_SCHED_PRIORITY_KERNEL);

drivers/gpu/drm/scheduler/sched_main.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ static u32 drm_sched_available_credits(struct drm_gpu_scheduler *sched)
102102
{
103103
u32 credits;
104104

105-
drm_WARN_ON(sched, check_sub_overflow(sched->credit_limit,
106-
atomic_read(&sched->credit_count),
107-
&credits));
105+
WARN_ON(check_sub_overflow(sched->credit_limit,
106+
atomic_read(&sched->credit_count),
107+
&credits));
108108

109109
return credits;
110110
}
@@ -129,9 +129,11 @@ static bool drm_sched_can_queue(struct drm_gpu_scheduler *sched,
129129
/* If a job exceeds the credit limit, truncate it to the credit limit
130130
* itself to guarantee forward progress.
131131
*/
132-
if (drm_WARN(sched, s_job->credits > sched->credit_limit,
133-
"Jobs may not exceed the credit limit, truncate.\n"))
132+
if (s_job->credits > sched->credit_limit) {
133+
dev_WARN(sched->dev,
134+
"Jobs may not exceed the credit limit, truncate.\n");
134135
s_job->credits = sched->credit_limit;
136+
}
135137

136138
return drm_sched_available_credits(sched) >= s_job->credits;
137139
}
@@ -789,7 +791,7 @@ int drm_sched_job_init(struct drm_sched_job *job,
789791
* or worse--a blank screen--leave a trail in the
790792
* logs, so this can be debugged easier.
791793
*/
792-
drm_err(job->sched, "%s: entity has no rq!\n", __func__);
794+
dev_err(job->sched->dev, "%s: entity has no rq!\n", __func__);
793795
return -ENOENT;
794796
}
795797

@@ -1263,15 +1265,15 @@ int drm_sched_init(struct drm_gpu_scheduler *sched, const struct drm_sched_init_
12631265
if (args->num_rqs > DRM_SCHED_PRIORITY_COUNT) {
12641266
/* This is a gross violation--tell drivers what the problem is.
12651267
*/
1266-
drm_err(sched, "%s: num_rqs cannot be greater than DRM_SCHED_PRIORITY_COUNT\n",
1268+
dev_err(sched->dev, "%s: num_rqs cannot be greater than DRM_SCHED_PRIORITY_COUNT\n",
12671269
__func__);
12681270
return -EINVAL;
12691271
} else if (sched->sched_rq) {
12701272
/* Not an error, but warn anyway so drivers can
12711273
* fine-tune their DRM calling order, and return all
12721274
* is good.
12731275
*/
1274-
drm_warn(sched, "%s: scheduler already initialized!\n", __func__);
1276+
dev_warn(sched->dev, "%s: scheduler already initialized!\n", __func__);
12751277
return 0;
12761278
}
12771279

@@ -1326,7 +1328,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched, const struct drm_sched_init_
13261328
Out_check_own:
13271329
if (sched->own_submit_wq)
13281330
destroy_workqueue(sched->submit_wq);
1329-
drm_err(sched, "%s: Failed to setup GPU scheduler--out of memory\n", __func__);
1331+
dev_err(sched->dev, "%s: Failed to setup GPU scheduler--out of memory\n", __func__);
13301332
return -ENOMEM;
13311333
}
13321334
EXPORT_SYMBOL(drm_sched_init);

0 commit comments

Comments
 (0)