drm: Replace DRM_INFO() with pr_info()
Subsystems (2)
PATCH 1/1 drm: Replace DRM_INFO() with pr_info()
Line 536 of drm_print.h says DRM_INFO() is deprecated in favor of pr_info().
--- drivers/gpu/drm/drm_client_modeset.c | 2 +- drivers/gpu/drm/drm_connector.c | 8 ++++---- drivers/gpu/drm/drm_drv.c | 10 +++++----- drivers/gpu/drm/drm_edid_load.c | 14 +++++++------- drivers/gpu/drm/drm_pci.c | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-)
drivers/gpu/drm/drm_client_modeset.c +1 -1
@@ -335,7 +335,7 @@ static bool drm_client_target_cloned(struct drm_device *dev,DRM_DEBUG_KMS ("can clone using 1024x768\n" );return true; } -DRM_INFO ("kms: can't enable cloning when we probably wanted to.\n" ); +pr_info ("[drm] kms: can't enable cloning when we probably wanted to.\n" );return false; }
drivers/gpu/drm/drm_connector.c +4 -4
@@ -165,14 +165,14 @@ static void drm_connector_get_cmdline_mode(struct drm_connector *connector)return ;if (mode->force) { -DRM_INFO ("forcing %s connector %s\n" , connector->name, -drm_get_connector_force_name (mode->force)); +pr_info ("[drm] forcing %s connector %s\n" , connector->name, +drm_get_connector_force_name (mode->force)); connector->force = mode->force; }if (mode->panel_orientation !=DRM_MODE_PANEL_ORIENTATION_UNKNOWN ) { -DRM_INFO ("cmdline forces connector %s panel_orientation to %d\n" , - connector->name, mode->panel_orientation); +pr_info ("[drm] cmdline forces connector %s panel_orientation to %d\n" , + connector->name, mode->panel_orientation);drm_connector_set_panel_orientation (connector, mode->panel_orientation); }
drivers/gpu/drm/drm_drv.c +5 -5
@@ -898,11 +898,11 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)if (drm_core_check_feature (dev,DRIVER_MODESET ))drm_modeset_register_all (dev); -DRM_INFO ("Initialized %s %d.%d.%d %s for %s on minor %d\n" , - driver->name, driver->major, driver->minor, - driver->patchlevel, driver->date, - dev->dev ?dev_name (dev->dev) :"virtual device" , - dev->primary->index); +pr_info ("[drm] Initialized %s %d.%d.%d %s for %s on minor %d\n" , + driver->name, driver->major, driver->minor, + driver->patchlevel, driver->date, + dev->dev ?dev_name (dev->dev) :"virtual device" , + dev->primary->index); goto out_unlock;
drivers/gpu/drm/drm_edid_load.c +7 -7
@@ -242,9 +242,9 @@ static void *edid_load(struct drm_connector *connector, const char *name,u8 *new_edid; edid[EDID_LENGTH -1 ] += edid[0x7e ] - valid_extensions; -DRM_INFO ("Found %d valid extensions instead of %d in EDID data " -"\"%s\" for connector \"%s\"\n" , valid_extensions, - edid[0x7e ], name, connector_name); +pr_info ("[drm] Found %d valid extensions instead of %d in EDID data " +"\"%s\" for connector \"%s\"\n" , valid_extensions, + edid[0x7e ], name, connector_name); edid[0x7e ] = valid_extensions; new_edid = krealloc(edid, (valid_extensions + 1) * EDID_LENGTH,
@@ -253,10 +253,10 @@ static void *edid_load(struct drm_connector *connector, const char *name, edid = new_edid; } -DRM_INFO ("Got %s EDID base block and %d extension%s from " -"\"%s\" for connector \"%s\"\n" , (builtin >=0 ) ?"built-in" : -"external" , valid_extensions, valid_extensions ==1 ?"" :"s" , - name, connector_name); +pr_info ("[drm] Got %s EDID base block and %d extension%s from " +"\"%s\" for connector \"%s\"\n" , (builtin >=0 ) ?"built-in" : +"external" , valid_extensions, valid_extensions ==1 ?"" :"s" , + name, connector_name); out:release_firmware (fw);
drivers/gpu/drm/drm_pci.c +1 -1
@@ -262,7 +262,7 @@ void drm_legacy_pci_exit(const struct drm_driver *driver, }mutex_unlock (&legacy_dev_list_lock); } -DRM_INFO ("Module unloaded\n" ); +pr_info ("[drm] Module unloaded\n" ); }EXPORT_SYMBOL (drm_legacy_pci_exit);
Signature · 1 line
2.35.1
Thomas Zimmermann
maintainerHi
Am 19.12.22 um 15:23 schrieb Siddh Raman Pant:
Quoted 2 lines
Line 536 of
drm_print.hsaysDRM_INFO()is deprecated in favor ofpr_info().
That's a misleading comment. DRM_INFO() is deprecated for drm_info(). pr_info() et al is only to be used of you don't have a dev pointer.
Best regards
Thomas
Quoted 112 lines
Signed-off-by Siddh Raman Pant <[email protected]>--- drivers/gpu/drm/drm_client_modeset.c | 2 +- drivers/gpu/drm/drm_connector.c | 8 ++++---- drivers/gpu/drm/drm_drv.c | 10 +++++----- drivers/gpu/drm/drm_edid_load.c | 14 +++++++------- drivers/gpu/drm/drm_pci.c | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-)drivers/gpu/drm/drm_client_modeset.c +1
-1@@ -335,7 +335,7 @@ static bool drm_client_target_cloned(struct drm_device *dev,DRM_DEBUG_KMS ("can clone using 1024x768\n" );return true; } -DRM_INFO ("kms: can't enable cloning when we probably wanted to.\n" ); +pr_info ("[drm] kms: can't enable cloning when we probably wanted to.\n" );return false; }drivers/gpu/drm/drm_connector.c +4
-4@@ -165,14 +165,14 @@ static void drm_connector_get_cmdline_mode(struct drm_connector *connector)return ;if (mode->force) { -DRM_INFO ("forcing %s connector %s\n" , connector->name, -drm_get_connector_force_name (mode->force)); +pr_info ("[drm] forcing %s connector %s\n" , connector->name, +drm_get_connector_force_name (mode->force)); connector->force = mode->force; }if (mode->panel_orientation !=DRM_MODE_PANEL_ORIENTATION_UNKNOWN ) { -DRM_INFO ("cmdline forces connector %s panel_orientation to %d\n" , - connector->name, mode->panel_orientation); +pr_info ("[drm] cmdline forces connector %s panel_orientation to %d\n" , + connector->name, mode->panel_orientation);drm_connector_set_panel_orientation (connector, mode->panel_orientation); }drivers/gpu/drm/drm_drv.c +5
-5@@ -898,11 +898,11 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)if (drm_core_check_feature (dev,DRIVER_MODESET ))drm_modeset_register_all (dev); -DRM_INFO ("Initialized %s %d.%d.%d %s for %s on minor %d\n" , - driver->name, driver->major, driver->minor, - driver->patchlevel, driver->date, - dev->dev ?dev_name (dev->dev) :"virtual device" , - dev->primary->index); +pr_info ("[drm] Initialized %s %d.%d.%d %s for %s on minor %d\n" , + driver->name, driver->major, driver->minor, + driver->patchlevel, driver->date, + dev->dev ?dev_name (dev->dev) :"virtual device" , + dev->primary->index); goto out_unlock;drivers/gpu/drm/drm_edid_load.c +7
-7@@ -242,9 +242,9 @@ static void *edid_load(struct drm_connector *connector, const char *name,u8 *new_edid; edid[EDID_LENGTH -1 ] += edid[0x7e ] - valid_extensions; -DRM_INFO ("Found %d valid extensions instead of %d in EDID data " -"\"%s\" for connector \"%s\"\n" , valid_extensions, - edid[0x7e ], name, connector_name); +pr_info ("[drm] Found %d valid extensions instead of %d in EDID data " +"\"%s\" for connector \"%s\"\n" , valid_extensions, + edid[0x7e ], name, connector_name); edid[0x7e ] = valid_extensions; new_edid = krealloc(edid, (valid_extensions + 1) * EDID_LENGTH,@@ -253,10 +253,10 @@ static void *edid_load(struct drm_connector *connector, const char *name, edid = new_edid; } -DRM_INFO ("Got %s EDID base block and %d extension%s from " -"\"%s\" for connector \"%s\"\n" , (builtin >=0 ) ?"built-in" : -"external" , valid_extensions, valid_extensions ==1 ?"" :"s" , - name, connector_name); +pr_info ("[drm] Got %s EDID base block and %d extension%s from " +"\"%s\" for connector \"%s\"\n" , (builtin >=0 ) ?"built-in" : +"external" , valid_extensions, valid_extensions ==1 ?"" :"s" , + name, connector_name); out:release_firmware (fw);drivers/gpu/drm/drm_pci.c +1
-1@@ -262,7 +262,7 @@ void drm_legacy_pci_exit(const struct drm_driver *driver, }mutex_unlock (&legacy_dev_list_lock); } -DRM_INFO ("Module unloaded\n" ); +pr_info ("[drm] Module unloaded\n" ); }EXPORT_SYMBOL (drm_legacy_pci_exit);
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev
Quoted 11 lines · Thomas Zimmermann
Hi
Am 19.12.22 um 15:23 schrieb Siddh Raman Pant:
Quoted 2 lines
Line 536 of
drm_print.hsaysDRM_INFO()is deprecated in favor ofpr_info().That's a misleading comment.
DRM_INFO()is deprecated fordrm_info().pr_info()et al is only to be used of you don't have a dev pointer.Best regards
Thomas
Maybe you are confusing it with DRM_DEV_INFO? It takes the dev pointer, and is indeed told to be deprecated in favour of drm_info() in the comments (see line 394).
DRM_INFO is a separate macro for printing stuff, and does not take the dev pointer. They seem to be early wrappers for printk, I guess when pr_info did not exist. And all they do different from pr_info is to add DRM_NAME (which seems to be just "drm") in front of the string.
Thanks,
Siddh
Thomas Zimmermann
maintainerHi
Am 19.12.22 um 16:34 schrieb Siddh Raman Pant:
Quoted 13 lines · Thomas Zimmermann
Quoted 11 lines
Hi
Am 19.12.22 um 15:23 schrieb Siddh Raman Pant:
Quoted 2 lines
Line 536 of
drm_print.hsaysDRM_INFO()is deprecated in favor ofpr_info().That's a misleading comment.
DRM_INFO()is deprecated fordrm_info().pr_info()et al is only to be used of you don't have a dev pointer.Best regards
Thomas
Quoted 8 lines
Maybe you are confusing it with
DRM_DEV_INFO? It takes the dev pointer, and is indeed told to be deprecated in favour ofdrm_info()in the comments (see line 394).
DRM_INFOis a separate macro for printing stuff, and does not take the dev pointer. They seem to be early wrappers for printk, I guess whenpr_infodid not exist. And all they do different frompr_infois to addDRM_NAME(which seems to be just "drm") in front of the string.
The DRM_ print macros in capital letters are deprecated AFAIK. In cases where a dev pointer is available, using drm_info() et al. is preferred over pr_info().
In the context of your patch, you should use drm_info() in drm_client_target_cloned(), as is gets a dev pointer as its first argument. In most the other cases from your patch, you can get the dev pointer from connector->dev.
The final case, drm_legacy_pci_exit(), there's no dev pointer, so you can use pr_info() there. I'd remove '[drm]' from the string. We don't use this much elsewhere.
Best regards
Thomas
Quoted 3 lines
Thanks,
Siddh
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev