[Intel-xe] [PATCH 2/2] drm/xe: Replace DRM_ERROR() with pr_err()

Jani Nikula jani.nikula at linux.intel.com
Mon May 29 07:58:21 UTC 2023


On Fri, 26 May 2023, Matt Roper <matthew.d.roper at intel.com> wrote:
> On Thu, May 25, 2023 at 09:42:35PM -0300, Gustavo Sousa wrote:
>> The former has been deprecated in favor of the latter.
>
> It has?  I thought generally the goal has been to replace DRM_FOO() with
> drm_foo() (i.e., drm_err() in this case) because then you get nicer
> device-specific output.

Yes, drm_foo is preferred over pr_foo.

BR,
Jani.

> Or when we're doing something GT-specific, we
> move to xe_gt_err() so that the useful information about which GT is
> automatically included.
>
> It looks like xe_reg_sr_add() doesn't have a reference to a drm_device
> to use drm_err (I didn't check how hard it would be to plumb down to
> that point), but xe_vm_bind_ioctl() should be able to use drm_err() I
> think?
>
>
> Matt
>
>> 
>> Signed-off-by: Gustavo Sousa <gustavo.sousa at intel.com>
>> ---
>>  drivers/gpu/drm/xe/xe_reg_sr.c | 11 ++++++-----
>>  drivers/gpu/drm/xe/xe_vm.c     |  3 ++-
>>  2 files changed, 8 insertions(+), 6 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/xe/xe_reg_sr.c b/drivers/gpu/drm/xe/xe_reg_sr.c
>> index 24d9c73ef279..4266999cdeb6 100644
>> --- a/drivers/gpu/drm/xe/xe_reg_sr.c
>> +++ b/drivers/gpu/drm/xe/xe_reg_sr.c
>> @@ -7,6 +7,7 @@
>>  
>>  #include <kunit/visibility.h>
>>  #include <linux/align.h>
>> +#include <linux/printk.h>
>>  #include <linux/string_helpers.h>
>>  #include <linux/xarray.h>
>>  
>> @@ -123,11 +124,11 @@ int xe_reg_sr_add(struct xe_reg_sr *sr,
>>  	return 0;
>>  
>>  fail:
>> -	DRM_ERROR("Discarding save-restore reg %04lx (clear: %08x, set: %08x, masked: %s, mcr: %s): ret=%d\n",
>> -		  idx, e->clr_bits, e->set_bits,
>> -		  str_yes_no(e->reg.masked),
>> -		  str_yes_no(e->reg.mcr),
>> -		  ret);
>> +	pr_err("Discarding save-restore reg %04lx (clear: %08x, set: %08x, masked: %s, mcr: %s): ret=%d\n",
>> +	       idx, e->clr_bits, e->set_bits,
>> +	       str_yes_no(e->reg.masked),
>> +	       str_yes_no(e->reg.mcr),
>> +	       ret);
>>  	reg_sr_inc_error(sr);
>>  
>>  	return ret;
>> diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
>> index 4d9c8de8b348..89d8240ea6aa 100644
>> --- a/drivers/gpu/drm/xe/xe_vm.c
>> +++ b/drivers/gpu/drm/xe/xe_vm.c
>> @@ -13,6 +13,7 @@
>>  #include <linux/delay.h>
>>  #include <linux/kthread.h>
>>  #include <linux/mm.h>
>> +#include <linux/printk.h>
>>  #include <linux/swap.h>
>>  
>>  #include "xe_bo.h"
>> @@ -3019,7 +3020,7 @@ int xe_vm_bind_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
>>  	}
>>  
>>  	if (XE_IOCTL_ERR(xe, xe_vm_is_closed(vm))) {
>> -		DRM_ERROR("VM closed while we began looking up?\n");
>> +		pr_err("VM closed while we began looking up?\n");
>>  		err = -ENOENT;
>>  		goto put_vm;
>>  	}
>> -- 
>> 2.40.1
>> 

-- 
Jani Nikula, Intel Open Source Graphics Center


More information about the Intel-xe mailing list