Re: [PATCH] drm: Replace DRM_INFO() with pr_info()

2022-12-20 Thread Siddh Raman Pant
On Mon, 19 Dec 2022 20:27:45 +0530, Thomas Zimmermann wrote:
> Hi
> 
> Am 19.12.22 um 15:23 schrieb Siddh Raman Pant:
> > Line 536 of drm_print.h says DRM_INFO() is deprecated
> > in favor of pr_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

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


Re: [PATCH] drm: Replace DRM_INFO() with pr_info()

2022-12-19 Thread Thomas Zimmermann

Hi

Am 19.12.22 um 16:34 schrieb Siddh Raman Pant:

On Mon, 19 Dec 2022 20:27:45 +0530, Thomas Zimmermann wrote:

Hi

Am 19.12.22 um 15:23 schrieb Siddh Raman Pant:

Line 536 of drm_print.h says DRM_INFO() is deprecated
in favor of pr_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


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.


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



Thanks,
Siddh


--
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


OpenPGP_signature
Description: OpenPGP digital signature


Re: [PATCH] drm: Replace DRM_INFO() with pr_info()

2022-12-19 Thread Thomas Zimmermann

Hi

Am 19.12.22 um 15:23 schrieb Siddh Raman Pant:

Line 536 of drm_print.h says DRM_INFO() is deprecated
in favor of pr_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



Signed-off-by: Siddh Raman Pant 
---
  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(-)

diff --git a/drivers/gpu/drm/drm_client_modeset.c 
b/drivers/gpu/drm/drm_client_modeset.c
index bbc535cc50dd..2e2891614c58 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -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;
  }
  
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c

index 61c29ce74b03..26a03b70e2c6 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -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);
}
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 203bf8d6c34c..1486df097908 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -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;
  
diff --git a/drivers/gpu/drm/drm_edid_load.c b/drivers/gpu/drm/drm_edid_load.c

index 37d8ba3ddb46..d3cb198380c5 100644
--- a/drivers/gpu/drm/drm_edid_load.c
+++ b/drivers/gpu/drm/drm_edid_load.c
@@ -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,