This patchset aims to remove usages of deprecated DRM_* macros from the
files residing in drivers/gpu/drm root.
In process, I found out that NULL as first argument of drm_dbg_* wasn't
working, but it was listed as the alternative in deprecation comment,
so I fixed that before removing usages of DRM_DEBUG_* macros.
Courtesy discussion on v1, I added support for NULL in drm_()* macros too.
Courtesy discussion on v7, I removed generic macro stuff meant to accomodate
stuff like mipi_dsi_host, and instead reverted a commit which used the
drm_err() macro incorrectly by passing mipi_dsi_host.
This patchset should be applied in order as changes might be dependent.
Please review and let me know if any errors are there, and hopefully
this gets accepted.
---
v8 -> v9 (today):
- Rebased to drm-misc-next.
v7 -> v8 (28 Feb 2023):
- Reverted 1040e424353f ("drm: mipi-dsi: Convert logging to drm_* functions.")
which used drm_err macro incorrectly by passing mipi_dsi_host.
- Thus, removed _Generic and allow only drm_device.
v6 -> v7 (26 Feb 2023):
- Rebased to drm-misc-next, accounting for the merger of last 3 patches
in the previous series (4665280990fa, fc2602b553c8, 7bd224b6625a),
and 7428ff70a18 ("drm: initialize accel framework").
v5 -> v6 (09 Jan 2023):
- Move drm_device to default case in _Generic as it is the default behaviour.
- Fix incorrect const drm_device handling in _Generic.
- Minor positioning / comment changes.
v4 -> v5 (07 Jan 2023):
- Make separate function instead of using boolean in _Generic (sravn on IRC).
- Also, simplified the Generic macro, and renamed the function and macro.
v3 -> v4 (05 Jan 2023):
- Fix commit message for DRM_NOTE erroneously mentioning DRM_INFO.
- Rebased to drm-misc-next, as 723dad977acd added drm_dbg_core() to some
files.
- Move Generic out to a separate macro __drm_get_dev_ptr, so that interface
of drm_dbg_*() is also same as other drm_*() macros.
- Fix comment in __drm_get_dev_ptr (now ___drm_get_dev_ptr) to use correct
name.
v2 -> v3 (26 Dec 2022):
- Added support for NULL in __drm_printk and thus by extension to drm_()*.
- Thus, converted dropped pr_()* changes to drm_*(NULL, ...).
- Rebased to drm-misc-next and resulting appropriate changes.
v1 (20 Dec 2022) -> v2 (22 Dec 2022):
- Removed conversions to pr_*() in DRM_INFO, DRM_NOTE, and DRM_ERROR changes.
- Due to above, DRM_NOTE usage cannot be removed and the patch is dropped.
- DRY: NULL support is now achieved by way of a separate function.
Siddh Raman Pant (8):
Revert "drm: mipi-dsi: Convert logging to drm_* functions."
drm/print: Fix and add support for NULL as first argument in drm_*
macros
drm: Remove usage of deprecated DRM_INFO
drm: Remove usage of deprecated DRM_NOTE
drm: Remove usage of deprecated DRM_ERROR
drm: Remove usage of deprecated DRM_DEBUG
drm: Remove usage of deprecated DRM_DEBUG_DRIVER
drm: Remove usage of deprecated DRM_DEBUG_KMS
drivers/gpu/drm/drm_agpsupport.c | 4 +-
drivers/gpu/drm/drm_bridge.c | 8 +-
drivers/gpu/drm/drm_bufs.c | 122 ++++++++++++------------
drivers/gpu/drm/drm_client_modeset.c | 118 +++++++++++++----------
drivers/gpu/drm/drm_color_mgmt.c | 4 +-
drivers/gpu/drm/drm_connector.c | 28 +++---
drivers/gpu/drm/drm_context.c | 18 ++--
drivers/gpu/drm/drm_crtc.c | 36 ++++---
drivers/gpu/drm/drm_crtc_helper.c | 62 ++++++------
drivers/gpu/drm/drm_debugfs_crc.c | 8 +-
drivers/gpu/drm/drm_displayid.c | 6 +-
drivers/gpu/drm/drm_dma.c | 10 +-
drivers/gpu/drm/drm_drv.c | 28 +++---
drivers/gpu/drm/drm_edid.c | 17 ++--
drivers/gpu/drm/drm_flip_work.c | 2 +-
drivers/gpu/drm/drm_framebuffer.c | 3 +-
drivers/gpu/drm/drm_gem.c | 7 +-
drivers/gpu/drm/drm_gem_dma_helper.c | 2 +-
drivers/gpu/drm/drm_hashtab.c | 10 +-
drivers/gpu/drm/drm_irq.c | 4 +-
drivers/gpu/drm/drm_kms_helper_common.c | 2 +-
drivers/gpu/drm/drm_lease.c | 4 +-
drivers/gpu/drm/drm_legacy_misc.c | 4 +-
drivers/gpu/drm/drm_lock.c | 36 +++----
drivers/gpu/drm/drm_mipi_dbi.c | 19 ++--
drivers/gpu/drm/drm_mipi_dsi.c | 15 +--
drivers/gpu/drm/drm_mm.c | 8 +-
drivers/gpu/drm/drm_mode_config.c | 2 +-
drivers/gpu/drm/drm_mode_object.c | 6 +-
drivers/gpu/drm/drm_modes.c | 36 +++----
drivers/gpu/drm/drm_modeset_helper.c | 2 +-
drivers/gpu/drm/drm_pci.c | 14 +--
drivers/gpu/drm/drm_plane.c | 46 ++++-----
drivers/gpu/drm/drm_probe_helper.c | 39 ++++----
drivers/gpu/drm/drm_rect.c | 4 +-
drivers/gpu/drm/drm_scatter.c | 19 ++--
drivers/gpu/drm/drm_syncobj.c | 2 +-
drivers/gpu/drm/drm_sysfs.c | 22 ++---
drivers/gpu/drm/drm_vm.c | 45 +++++----
include/drm/drm_print.h | 81 ++++++++++------
40 files changed, 480 insertions(+), 423 deletions(-)
--
2.39.2
drm_print.h says DRM_DEBUG_KMS is deprecated in favor of
drm_dbg_kms().
Signed-off-by: Siddh Raman Pant <[email protected]>
---
drivers/gpu/drm/drm_client_modeset.c | 112 +++++++++++++++------------
drivers/gpu/drm/drm_color_mgmt.c | 4 +-
drivers/gpu/drm/drm_connector.c | 21 ++---
drivers/gpu/drm/drm_crtc.c | 36 ++++-----
drivers/gpu/drm/drm_crtc_helper.c | 54 ++++++-------
drivers/gpu/drm/drm_debugfs_crc.c | 5 +-
drivers/gpu/drm/drm_displayid.c | 4 +-
drivers/gpu/drm/drm_edid.c | 17 ++--
drivers/gpu/drm/drm_lease.c | 2 +-
drivers/gpu/drm/drm_mipi_dbi.c | 7 +-
drivers/gpu/drm/drm_modes.c | 10 +--
drivers/gpu/drm/drm_plane.c | 32 ++++----
drivers/gpu/drm/drm_probe_helper.c | 39 +++++-----
drivers/gpu/drm/drm_rect.c | 4 +-
drivers/gpu/drm/drm_sysfs.c | 8 +-
15 files changed, 187 insertions(+), 168 deletions(-)
diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c
index e2403b8c6347..4e08ae688b83 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -242,8 +242,9 @@ static void drm_client_connectors_enabled(struct drm_connector **connectors,
for (i = 0; i < connector_count; i++) {
connector = connectors[i];
enabled[i] = drm_connector_enabled(connector, true);
- DRM_DEBUG_KMS("connector %d enabled? %s\n", connector->base.id,
- connector->display_info.non_desktop ? "non desktop" : str_yes_no(enabled[i]));
+ drm_dbg_kms(connector->dev, "connector %d enabled? %s\n",
+ connector->base.id,
+ connector->display_info.non_desktop ? "non desktop" : str_yes_no(enabled[i]));
any_enabled |= enabled[i];
}
@@ -303,7 +304,7 @@ static bool drm_client_target_cloned(struct drm_device *dev,
}
if (can_clone) {
- DRM_DEBUG_KMS("can clone using command line\n");
+ drm_dbg_kms(dev, "can clone using command line\n");
return true;
}
@@ -328,7 +329,7 @@ static bool drm_client_target_cloned(struct drm_device *dev,
}
if (can_clone) {
- DRM_DEBUG_KMS("can clone using 1024x768\n");
+ drm_dbg_kms(dev, "can clone using 1024x768\n");
return true;
}
drm_info(dev, "kms: can't enable cloning when we probably wanted to.\n");
@@ -352,8 +353,9 @@ static int drm_client_get_tile_offsets(struct drm_connector **connectors,
continue;
if (!modes[i] && (h_idx || v_idx)) {
- DRM_DEBUG_KMS("no modes for connector tiled %d %d\n", i,
- connector->base.id);
+ drm_dbg_kms(connector->dev,
+ "no modes for connector tiled %d %d\n",
+ i, connector->base.id);
continue;
}
if (connector->tile_h_loc < h_idx)
@@ -364,7 +366,8 @@ static int drm_client_get_tile_offsets(struct drm_connector **connectors,
}
offsets[idx].x = hoffset;
offsets[idx].y = voffset;
- DRM_DEBUG_KMS("returned %d %d for %d %d\n", hoffset, voffset, h_idx, v_idx);
+ drm_dbg_kms(NULL, "returned %d %d for %d %d\n",
+ hoffset, voffset, h_idx, v_idx);
return 0;
}
@@ -421,14 +424,16 @@ static bool drm_client_target_preferred(struct drm_connector **connectors,
drm_client_get_tile_offsets(connectors, connector_count, modes, offsets, i,
connector->tile_h_loc, connector->tile_v_loc);
}
- DRM_DEBUG_KMS("looking for cmdline mode on connector %d\n",
- connector->base.id);
+ drm_dbg_kms(connector->dev,
+ "looking for cmdline mode on connector %d\n",
+ connector->base.id);
/* got for command line mode first */
modes[i] = drm_connector_pick_cmdline_mode(connector);
if (!modes[i]) {
- DRM_DEBUG_KMS("looking for preferred mode on connector %d %d\n",
- connector->base.id, connector->tile_group ? connector->tile_group->id : 0);
+ drm_dbg_kms(connector->dev,
+ "looking for preferred mode on connector %d %d\n",
+ connector->base.id, connector->tile_group ? connector->tile_group->id : 0);
modes[i] = drm_connector_has_preferred_mode(connector, width, height);
}
/* No preferred modes, pick one off the list */
@@ -450,16 +455,17 @@ static bool drm_client_target_preferred(struct drm_connector **connectors,
(connector->tile_h_loc == 0 &&
connector->tile_v_loc == 0 &&
!drm_connector_get_tiled_mode(connector))) {
- DRM_DEBUG_KMS("Falling back to non tiled mode on Connector %d\n",
- connector->base.id);
+ drm_dbg_kms(connector->dev,
+ "Falling back to non tiled mode on Connector %d\n",
+ connector->base.id);
modes[i] = drm_connector_fallback_non_tiled_mode(connector);
} else {
modes[i] = drm_connector_get_tiled_mode(connector);
}
}
- DRM_DEBUG_KMS("found mode %s\n", modes[i] ? modes[i]->name :
- "none");
+ drm_dbg_kms(connector->dev, "found mode %s\n",
+ modes[i] ? modes[i]->name : "none");
conn_configured |= BIT_ULL(i);
}
@@ -619,15 +625,17 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
num_connectors_detected++;
if (!enabled[i]) {
- DRM_DEBUG_KMS("connector %s not enabled, skipping\n",
- connector->name);
+ drm_dbg_kms(connector->dev,
+ "connector %s not enabled, skipping\n",
+ connector->name);
conn_configured |= BIT(i);
continue;
}
if (connector->force == DRM_FORCE_OFF) {
- DRM_DEBUG_KMS("connector %s is disabled by user, skipping\n",
- connector->name);
+ drm_dbg_kms(connector->dev,
+ "connector %s is disabled by user, skipping\n",
+ connector->name);
enabled[i] = false;
continue;
}
@@ -637,8 +645,9 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
if (connector->force > DRM_FORCE_OFF)
goto bail;
- DRM_DEBUG_KMS("connector %s has no encoder or crtc, skipping\n",
- connector->name);
+ drm_dbg_kms(connector->dev,
+ "connector %s has no encoder or crtc, skipping\n",
+ connector->name);
enabled[i] = false;
conn_configured |= BIT(i);
continue;
@@ -655,28 +664,32 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
*/
for (j = 0; j < count; j++) {
if (crtcs[j] == new_crtc) {
- DRM_DEBUG_KMS("fallback: cloned configuration\n");
+ drm_dbg_kms(connector->dev,
+ "fallback: cloned configuration\n");
goto bail;
}
}
- DRM_DEBUG_KMS("looking for cmdline mode on connector %s\n",
- connector->name);
+ drm_dbg_kms(connector->dev,
+ "looking for cmdline mode on connector %s\n",
+ connector->name);
/* go for command line mode first */
modes[i] = drm_connector_pick_cmdline_mode(connector);
/* try for preferred next */
if (!modes[i]) {
- DRM_DEBUG_KMS("looking for preferred mode on connector %s %d\n",
- connector->name, connector->has_tile);
+ drm_dbg_kms(connector->dev,
+ "looking for preferred mode on connector %s %d\n",
+ connector->name, connector->has_tile);
modes[i] = drm_connector_has_preferred_mode(connector, width, height);
}
/* No preferred mode marked by the EDID? Are there any modes? */
if (!modes[i] && !list_empty(&connector->modes)) {
- DRM_DEBUG_KMS("using first mode listed on connector %s\n",
- connector->name);
+ drm_dbg_kms(connector->dev,
+ "using first mode listed on connector %s\n",
+ connector->name);
modes[i] = list_first_entry(&connector->modes,
struct drm_display_mode,
head);
@@ -695,8 +708,9 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
* This is crtc->mode and not crtc->state->mode for the
* fastboot check to work correctly.
*/
- DRM_DEBUG_KMS("looking for current mode on connector %s\n",
- connector->name);
+ drm_dbg_kms(connector->dev,
+ "looking for current mode on connector %s\n",
+ connector->name);
modes[i] = &connector->state->crtc->mode;
}
/*
@@ -705,18 +719,20 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
*/
if (connector->has_tile &&
num_tiled_conns < connector->num_h_tile * connector->num_v_tile) {
- DRM_DEBUG_KMS("Falling back to non tiled mode on Connector %d\n",
- connector->base.id);
+ drm_dbg_kms(connector->dev,
+ "Falling back to non tiled mode on Connector %d\n",
+ connector->base.id);
modes[i] = drm_connector_fallback_non_tiled_mode(connector);
}
crtcs[i] = new_crtc;
- DRM_DEBUG_KMS("connector %s on [CRTC:%d:%s]: %dx%d%s\n",
- connector->name,
- connector->state->crtc->base.id,
- connector->state->crtc->name,
- modes[i]->hdisplay, modes[i]->vdisplay,
- modes[i]->flags & DRM_MODE_FLAG_INTERLACE ? "i" : "");
+ drm_dbg_kms(connector->dev,
+ "connector %s on [CRTC:%d:%s]: %dx%d%s\n",
+ connector->name,
+ connector->state->crtc->base.id,
+ connector->state->crtc->name,
+ modes[i]->hdisplay, modes[i]->vdisplay,
+ modes[i]->flags & DRM_MODE_FLAG_INTERLACE ? "i" : "");
fallback = false;
conn_configured |= BIT(i);
@@ -732,15 +748,15 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
*/
if (num_connectors_enabled != num_connectors_detected &&
num_connectors_enabled < dev->mode_config.num_crtc) {
- DRM_DEBUG_KMS("fallback: Not all outputs enabled\n");
- DRM_DEBUG_KMS("Enabled: %i, detected: %i\n", num_connectors_enabled,
- num_connectors_detected);
+ drm_dbg_kms(NULL, "fallback: Not all outputs enabled\n");
+ drm_dbg_kms(NULL, "Enabled: %i, detected: %i\n",
+ num_connectors_enabled, num_connectors_detected);
fallback = true;
}
if (fallback) {
bail:
- DRM_DEBUG_KMS("Not using firmware configuration\n");
+ drm_dbg_kms(NULL, "Not using firmware configuration\n");
memcpy(enabled, save_enabled, count);
ret = false;
}
@@ -777,7 +793,7 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width,
int i, ret = 0;
bool *enabled;
- DRM_DEBUG_KMS("\n");
+ drm_dbg_kms(dev, "\n");
if (!width)
width = dev->mode_config.max_width;
@@ -819,7 +835,7 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width,
for (i = 0; i < connector_count; i++)
total_modes_count += connectors[i]->funcs->fill_modes(connectors[i], width, height);
if (!total_modes_count)
- DRM_DEBUG_KMS("No connectors reported connected with modes\n");
+ drm_dbg_kms(dev, "No connectors reported connected with modes\n");
drm_client_connectors_enabled(connectors, connector_count, enabled);
if (!drm_client_firmware_config(client, connectors, connector_count, crtcs,
@@ -834,8 +850,8 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width,
offsets, enabled, width, height))
drm_err(client->dev, "Unable to find initial modes\n");
- DRM_DEBUG_KMS("picking CRTCs for %dx%d config\n",
- width, height);
+ drm_dbg_kms(dev, "picking CRTCs for %dx%d config\n",
+ width, height);
drm_client_pick_crtcs(client, connectors, connector_count,
crtcs, modes, 0, width, height);
@@ -853,8 +869,8 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width,
struct drm_mode_set *modeset = drm_client_find_modeset(client, crtc);
struct drm_connector *connector = connectors[i];
- DRM_DEBUG_KMS("desired mode %s set on crtc %d (%d,%d)\n",
- mode->name, crtc->base.id, offset->x, offset->y);
+ drm_dbg_kms(dev, "desired mode %s set on crtc %d (%d,%d)\n",
+ mode->name, crtc->base.id, offset->x, offset->y);
if (WARN_ON_ONCE(modeset->num_connectors == DRM_CLIENT_MAX_CLONED_CONNECTORS ||
(dev->mode_config.num_crtc > 1 && modeset->num_connectors == 1))) {
diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c
index d021497841b8..a2761a6ce11f 100644
--- a/drivers/gpu/drm/drm_color_mgmt.c
+++ b/drivers/gpu/drm/drm_color_mgmt.c
@@ -612,7 +612,7 @@ int drm_color_lut_check(const struct drm_property_blob *lut, u32 tests)
if (tests & DRM_COLOR_LUT_EQUAL_CHANNELS) {
if (entry[i].red != entry[i].blue ||
entry[i].red != entry[i].green) {
- DRM_DEBUG_KMS("All LUT entries must have equal r/g/b\n");
+ drm_dbg_kms(NULL, "All LUT entries must have equal r/g/b\n");
return -EINVAL;
}
}
@@ -621,7 +621,7 @@ int drm_color_lut_check(const struct drm_property_blob *lut, u32 tests)
if (entry[i].red < entry[i - 1].red ||
entry[i].green < entry[i - 1].green ||
entry[i].blue < entry[i - 1].blue) {
- DRM_DEBUG_KMS("LUT entries must never decrease.\n");
+ drm_dbg_kms(NULL, "LUT entries must never decrease.\n");
return -EINVAL;
}
}
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index dca8dd4ab93f..adedaf05418a 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -181,13 +181,14 @@ static void drm_connector_get_cmdline_mode(struct drm_connector *connector)
mode->panel_orientation);
}
- DRM_DEBUG_KMS("cmdline mode for connector %s %s %dx%d@%dHz%s%s%s\n",
- connector->name, mode->name,
- mode->xres, mode->yres,
- mode->refresh_specified ? mode->refresh : 60,
- mode->rb ? " reduced blanking" : "",
- mode->margins ? " with margins" : "",
- mode->interlace ? " interlaced" : "");
+ drm_dbg_kms(connector->dev,
+ "cmdline mode for connector %s %s %dx%d@%dHz%s%s%s\n",
+ connector->name, mode->name,
+ mode->xres, mode->yres,
+ mode->refresh_specified ? mode->refresh : 60,
+ mode->rb ? " reduced blanking" : "",
+ mode->margins ? " with margins" : "",
+ mode->interlace ? " interlaced" : "");
}
static void drm_connector_free(struct kref *kref)
@@ -247,9 +248,9 @@ static int __drm_connector_init(struct drm_device *dev,
/* connector index is used with 32bit bitmasks */
ret = ida_alloc_max(&config->connector_ida, 31, GFP_KERNEL);
if (ret < 0) {
- DRM_DEBUG_KMS("Failed to allocate %s connector index: %d\n",
- drm_connector_enum_list[connector_type].name,
- ret);
+ drm_dbg_kms(dev, "Failed to allocate %s connector index: %d\n",
+ drm_connector_enum_list[connector_type].name,
+ ret);
goto out_put;
}
connector->index = ret;
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index df9bf3c9206e..adc426561e17 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -730,10 +730,10 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
crtc = drm_crtc_find(dev, file_priv, crtc_req->crtc_id);
if (!crtc) {
- DRM_DEBUG_KMS("Unknown CRTC ID %d\n", crtc_req->crtc_id);
+ drm_dbg_kms(dev, "Unknown CRTC ID %d\n", crtc_req->crtc_id);
return -ENOENT;
}
- DRM_DEBUG_KMS("[CRTC:%d:%s]\n", crtc->base.id, crtc->name);
+ drm_dbg_kms(dev, "[CRTC:%d:%s]\n", crtc->base.id, crtc->name);
plane = crtc->primary;
@@ -756,7 +756,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
old_fb = plane->fb;
if (!old_fb) {
- DRM_DEBUG_KMS("CRTC doesn't have current FB\n");
+ drm_dbg_kms(dev, "CRTC doesn't have current FB\n");
ret = -EINVAL;
goto out;
}
@@ -767,8 +767,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
} else {
fb = drm_framebuffer_lookup(dev, file_priv, crtc_req->fb_id);
if (!fb) {
- DRM_DEBUG_KMS("Unknown FB ID%d\n",
- crtc_req->fb_id);
+ drm_dbg_kms(dev, "Unknown FB ID%d\n", crtc_req->fb_id);
ret = -ENOENT;
goto out;
}
@@ -781,7 +780,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
}
if (!file_priv->aspect_ratio_allowed &&
(crtc_req->mode.flags & DRM_MODE_FLAG_PIC_AR_MASK) != DRM_MODE_FLAG_PIC_AR_NONE) {
- DRM_DEBUG_KMS("Unexpected aspect-ratio flag bits\n");
+ drm_dbg_kms(dev, "Unexpected aspect-ratio flag bits\n");
ret = -EINVAL;
goto out;
}
@@ -789,8 +788,8 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
ret = drm_mode_convert_umode(dev, mode, &crtc_req->mode);
if (ret) {
- DRM_DEBUG_KMS("Invalid mode (ret=%d, status=%s)\n",
- ret, drm_get_mode_status_name(mode->status));
+ drm_dbg_kms(dev, "Invalid mode (ret=%d, status=%s)\n",
+ ret, drm_get_mode_status_name(mode->status));
drm_mode_debug_printmodeline(mode);
goto out;
}
@@ -807,9 +806,8 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
fb->format->format,
fb->modifier);
if (ret) {
- DRM_DEBUG_KMS("Invalid pixel format %p4cc, modifier 0x%llx\n",
- &fb->format->format,
- fb->modifier);
+ drm_dbg_kms(dev, "Invalid pixel format %p4cc, modifier 0x%llx\n",
+ &fb->format->format, fb->modifier);
goto out;
}
}
@@ -822,14 +820,14 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
}
if (crtc_req->count_connectors == 0 && mode) {
- DRM_DEBUG_KMS("Count connectors is 0 but mode set\n");
+ drm_dbg_kms(dev, "Count connectors is 0 but mode set\n");
ret = -EINVAL;
goto out;
}
if (crtc_req->count_connectors > 0 && (!mode || !fb)) {
- DRM_DEBUG_KMS("Count connectors is %d but no mode or fb set\n",
- crtc_req->count_connectors);
+ drm_dbg_kms(dev, "Count connectors is %d but no mode or fb set\n",
+ crtc_req->count_connectors);
ret = -EINVAL;
goto out;
}
@@ -861,14 +859,14 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
connector = drm_connector_lookup(dev, file_priv, out_id);
if (!connector) {
- DRM_DEBUG_KMS("Connector id %d unknown\n",
- out_id);
+ drm_dbg_kms(dev, "Connector id %d unknown\n",
+ out_id);
ret = -ENOENT;
goto out;
}
- DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
- connector->base.id,
- connector->name);
+ drm_dbg_kms(dev, "[CONNECTOR:%d:%s]\n",
+ connector->base.id,
+ connector->name);
connector_set[i] = connector;
}
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index b74b4301a471..59e7b86eab93 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -338,7 +338,7 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
if (encoder_funcs->mode_fixup) {
if (!(ret = encoder_funcs->mode_fixup(encoder, mode,
adjusted_mode))) {
- DRM_DEBUG_KMS("Encoder fixup failed\n");
+ drm_dbg_kms(dev, "Encoder fixup failed\n");
goto done;
}
}
@@ -347,11 +347,11 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
if (crtc_funcs->mode_fixup) {
if (!(ret = crtc_funcs->mode_fixup(crtc, mode,
adjusted_mode))) {
- DRM_DEBUG_KMS("CRTC fixup failed\n");
+ drm_dbg_kms(dev, "CRTC fixup failed\n");
goto done;
}
}
- DRM_DEBUG_KMS("[CRTC:%d:%s]\n", crtc->base.id, crtc->name);
+ drm_dbg_kms(dev, "[CRTC:%d:%s]\n", crtc->base.id, crtc->name);
drm_mode_copy(&crtc->hwmode, adjusted_mode);
@@ -390,8 +390,8 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
if (!encoder_funcs)
continue;
- DRM_DEBUG_KMS("[ENCODER:%d:%s] set [MODE:%s]\n",
- encoder->base.id, encoder->name, mode->name);
+ drm_dbg_kms(dev, "[ENCODER:%d:%s] set [MODE:%s]\n",
+ encoder->base.id, encoder->name, mode->name);
if (encoder_funcs->mode_set)
encoder_funcs->mode_set(encoder, mode, adjusted_mode);
}
@@ -567,7 +567,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
int ret;
int i;
- DRM_DEBUG_KMS("\n");
+ drm_dbg_kms(NULL, "\n");
BUG_ON(!set);
BUG_ON(!set->crtc);
@@ -586,13 +586,13 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
set->fb = NULL;
if (set->fb) {
- DRM_DEBUG_KMS("[CRTC:%d:%s] [FB:%d] #connectors=%d (x y) (%i %i)\n",
- set->crtc->base.id, set->crtc->name,
- set->fb->base.id,
- (int)set->num_connectors, set->x, set->y);
+ drm_dbg_kms(dev, "[CRTC:%d:%s] [FB:%d] #connectors=%d (x y) (%i %i)\n",
+ set->crtc->base.id, set->crtc->name,
+ set->fb->base.id,
+ (int)set->num_connectors, set->x, set->y);
} else {
- DRM_DEBUG_KMS("[CRTC:%d:%s] [NOFB]\n",
- set->crtc->base.id, set->crtc->name);
+ drm_dbg_kms(dev, "[CRTC:%d:%s] [NOFB]\n",
+ set->crtc->base.id, set->crtc->name);
drm_crtc_helper_disable(set->crtc);
return 0;
}
@@ -642,7 +642,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
if (set->crtc->primary->fb != set->fb) {
/* If we have no fb then treat it as a full mode set */
if (set->crtc->primary->fb == NULL) {
- DRM_DEBUG_KMS("crtc has no fb, full mode set\n");
+ drm_dbg_kms(dev, "crtc has no fb, full mode set\n");
mode_changed = true;
} else if (set->fb->format != set->crtc->primary->fb->format) {
mode_changed = true;
@@ -654,7 +654,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
fb_changed = true;
if (!drm_mode_equal(set->mode, &set->crtc->mode)) {
- DRM_DEBUG_KMS("modes are different, full mode set\n");
+ drm_dbg_kms(dev, "modes are different, full mode set\n");
drm_mode_debug_printmodeline(&set->crtc->mode);
drm_mode_debug_printmodeline(set->mode);
mode_changed = true;
@@ -690,7 +690,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
fail = 1;
if (connector->dpms != DRM_MODE_DPMS_ON) {
- DRM_DEBUG_KMS("connector dpms not on, full mode switch\n");
+ drm_dbg_kms(dev, "connector dpms not on, full mode switch\n");
mode_changed = true;
}
@@ -699,7 +699,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
}
if (new_encoder != connector->encoder) {
- DRM_DEBUG_KMS("encoder changed, full mode switch\n");
+ drm_dbg_kms(dev, "encoder changed, full mode switch\n");
mode_changed = true;
/* If the encoder is reused for another connector, then
* the appropriate crtc will be set later.
@@ -740,17 +740,17 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
goto fail;
}
if (new_crtc != connector->encoder->crtc) {
- DRM_DEBUG_KMS("crtc changed, full mode switch\n");
+ drm_dbg_kms(dev, "crtc changed, full mode switch\n");
mode_changed = true;
connector->encoder->crtc = new_crtc;
}
if (new_crtc) {
- DRM_DEBUG_KMS("[CONNECTOR:%d:%s] to [CRTC:%d:%s]\n",
- connector->base.id, connector->name,
- new_crtc->base.id, new_crtc->name);
+ drm_dbg_kms(dev, "[CONNECTOR:%d:%s] to [CRTC:%d:%s]\n",
+ connector->base.id, connector->name,
+ new_crtc->base.id, new_crtc->name);
} else {
- DRM_DEBUG_KMS("[CONNECTOR:%d:%s] to [NOCRTC]\n",
- connector->base.id, connector->name);
+ drm_dbg_kms(dev, "[CONNECTOR:%d:%s] to [NOCRTC]\n",
+ connector->base.id, connector->name);
}
}
drm_connector_list_iter_end(&conn_iter);
@@ -761,8 +761,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
if (mode_changed) {
if (drm_helper_crtc_in_use(set->crtc)) {
- DRM_DEBUG_KMS("attempting to set mode from"
- " userspace\n");
+ drm_dbg_kms(dev, "attempting to set mode from userspace\n");
drm_mode_debug_printmodeline(set->mode);
set->crtc->primary->fb = set->fb;
if (!drm_crtc_helper_set_mode(set->crtc, set->mode,
@@ -774,10 +773,11 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
ret = -EINVAL;
goto fail;
}
- DRM_DEBUG_KMS("Setting connector DPMS state to on\n");
+ drm_dbg_kms(dev, "Setting connector DPMS state to on\n");
for (i = 0; i < set->num_connectors; i++) {
- DRM_DEBUG_KMS("\t[CONNECTOR:%d:%s] set DPMS on\n", set->connectors[i]->base.id,
- set->connectors[i]->name);
+ drm_dbg_kms(dev, "\t[CONNECTOR:%d:%s] set DPMS on\n",
+ set->connectors[i]->base.id,
+ set->connectors[i]->name);
set->connectors[i]->funcs->dpms(set->connectors[i], DRM_MODE_DPMS_ON);
}
}
diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c
index a59ef3f0e4a1..f29d286f4760 100644
--- a/drivers/gpu/drm/drm_debugfs_crc.c
+++ b/drivers/gpu/drm/drm_debugfs_crc.c
@@ -131,8 +131,9 @@ static ssize_t crc_control_write(struct file *file, const char __user *ubuf,
return 0;
if (len > PAGE_SIZE - 1) {
- DRM_DEBUG_KMS("Expected < %lu bytes into crtc crc control\n",
- PAGE_SIZE);
+ drm_dbg_kms(crtc->dev,
+ "Expected < %lu bytes into crtc crc control\n",
+ PAGE_SIZE);
return -E2BIG;
}
diff --git a/drivers/gpu/drm/drm_displayid.c b/drivers/gpu/drm/drm_displayid.c
index 27ffeee09e4f..7e591bc0883f 100644
--- a/drivers/gpu/drm/drm_displayid.c
+++ b/drivers/gpu/drm/drm_displayid.c
@@ -31,8 +31,8 @@ validate_displayid(const u8 *displayid, int length, int idx)
if (IS_ERR(base))
return base;
- DRM_DEBUG_KMS("base revision 0x%x, length %d, %d %d\n",
- base->rev, base->bytes, base->prod_id, base->ext_count);
+ drm_dbg_kms(NULL, "base revision 0x%x, length %d, %d %d\n",
+ base->rev, base->bytes, base->prod_id, base->ext_count);
/* +1 for DispID checksum */
dispid_length = sizeof(*base) + base->bytes + 1;
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 0454da505687..791152c4afd4 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -1986,7 +1986,7 @@ bool drm_edid_block_valid(u8 *_block, int block_num, bool print_bad_edid,
status = edid_block_check(block, is_base_block);
if (status == EDID_BLOCK_HEADER_REPAIR) {
- DRM_DEBUG_KMS("Fixing EDID header, your hardware may be failing\n");
+ drm_dbg_kms(NULL, "Fixing EDID header, your hardware may be failing\n");
edid_header_fix(block);
/* Retry with fixed header, update status if that worked. */
@@ -2172,8 +2172,9 @@ drm_do_probe_ddc_edid(void *data, u8 *buf, unsigned int block, size_t len)
ret = i2c_transfer(adapter, &msgs[3 - xfers], xfers);
if (ret == -ENXIO) {
- DRM_DEBUG_KMS("drm: skipping non-existent adapter %s\n",
- adapter->name);
+ drm_dbg_kms(NULL,
+ "drm: skipping non-existent adapter %s\n",
+ adapter->name);
break;
}
} while (ret != xfers && --retries);
@@ -5589,7 +5590,7 @@ static int _drm_edid_to_sad(const struct drm_edid *drm_edid,
}
cea_db_iter_end(&iter);
- DRM_DEBUG_KMS("Found %d Short Audio Descriptors\n", count);
+ drm_dbg_kms(NULL, "Found %d Short Audio Descriptors\n", count);
return count;
}
@@ -5634,7 +5635,7 @@ static int _drm_edid_to_speaker_allocation(const struct drm_edid *drm_edid,
}
cea_db_iter_end(&iter);
- DRM_DEBUG_KMS("Found %d Speaker Allocation Data Blocks\n", count);
+ drm_dbg_kms(NULL, "Found %d Speaker Allocation Data Blocks\n", count);
return count;
}
@@ -5761,7 +5762,7 @@ static bool _drm_detect_monitor_audio(const struct drm_edid *drm_edid)
drm_edid_iter_end(&edid_iter);
if (has_audio) {
- DRM_DEBUG_KMS("Monitor has basic audio support\n");
+ drm_dbg_kms(NULL, "Monitor has basic audio support\n");
goto end;
}
@@ -5772,8 +5773,8 @@ static bool _drm_detect_monitor_audio(const struct drm_edid *drm_edid)
int i;
for (i = 0; i < cea_db_payload_len(db); i += 3)
- DRM_DEBUG_KMS("CEA audio format %d\n",
- (data[i] >> 3) & 0xf);
+ drm_dbg_kms(NULL, "CEA audio format %d\n",
+ (data[i] >> 3) & 0xf);
has_audio = true;
break;
}
diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c
index af72fc38bb7c..c1b8717b5794 100644
--- a/drivers/gpu/drm/drm_lease.c
+++ b/drivers/gpu/drm/drm_lease.c
@@ -403,7 +403,7 @@ static int fill_object_idr(struct drm_device *dev,
}
if (!drm_mode_object_lease_required(objects[o]->type)) {
- DRM_DEBUG_KMS("invalid object for lease\n");
+ drm_dbg_kms(dev, "invalid object for lease\n");
ret = -EINVAL;
goto out_free_objects;
}
diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c
index ab5dd5933a1a..793fdd7da1d0 100644
--- a/drivers/gpu/drm/drm_mipi_dbi.c
+++ b/drivers/gpu/drm/drm_mipi_dbi.c
@@ -265,7 +265,8 @@ static void mipi_dbi_fb_dirty(struct iosys_map *src, struct drm_framebuffer *fb,
full = width == fb->width && height == fb->height;
- DRM_DEBUG_KMS("Flushing [FB:%d] " DRM_RECT_FMT "\n", fb->base.id, DRM_RECT_ARG(rect));
+ drm_dbg_kms(fb->dev, "Flushing [FB:%d] " DRM_RECT_FMT "\n",
+ fb->base.id, DRM_RECT_ARG(rect));
if (!dbi->dc || !full || swap ||
fb->format->format == DRM_FORMAT_XRGB8888) {
@@ -408,7 +409,7 @@ void mipi_dbi_pipe_disable(struct drm_simple_display_pipe *pipe)
{
struct mipi_dbi_dev *dbidev = drm_to_mipi_dbi_dev(pipe->crtc.dev);
- DRM_DEBUG_KMS("\n");
+ drm_dbg_kms(&dbidev->drm, "\n");
if (dbidev->backlight)
backlight_disable(dbidev->backlight);
@@ -627,7 +628,7 @@ int mipi_dbi_dev_init_with_formats(struct mipi_dbi_dev *dbidev,
drm->mode_config.max_height = dbidev->mode.vdisplay;
dbidev->rotation = rotation;
- DRM_DEBUG_KMS("rotation = %u\n", rotation);
+ drm_dbg_kms(drm, "rotation = %u\n", rotation);
return 0;
}
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index f5171bf91eae..440e3b015cc6 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -53,11 +53,11 @@
* drm_mode_debug_printmodeline - print a mode to dmesg
* @mode: mode to print
*
- * Describe @mode using DRM_DEBUG.
+ * Describe @mode using drm_dbg_kms().
*/
void drm_mode_debug_printmodeline(const struct drm_display_mode *mode)
{
- DRM_DEBUG_KMS("Modeline " DRM_MODE_FMT "\n", DRM_MODE_ARG(mode));
+ drm_dbg_kms(NULL, "Modeline " DRM_MODE_FMT "\n", DRM_MODE_ARG(mode));
}
EXPORT_SYMBOL(drm_mode_debug_printmodeline);
@@ -1813,9 +1813,9 @@ void drm_mode_prune_invalid(struct drm_device *dev,
}
if (verbose) {
drm_mode_debug_printmodeline(mode);
- DRM_DEBUG_KMS("Not using %s mode: %s\n",
- mode->name,
- drm_get_mode_status_name(mode->status));
+ drm_dbg_kms(dev, "Not using %s mode: %s\n",
+ mode->name,
+ drm_get_mode_status_name(mode->status));
}
drm_mode_destroy(dev, mode);
}
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 1e8727b7bce9..12fed5f812a1 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -275,7 +275,7 @@ static int __drm_universal_plane_init(struct drm_device *dev,
plane->format_types = kmalloc_array(format_count, sizeof(uint32_t),
GFP_KERNEL);
if (!plane->format_types) {
- DRM_DEBUG_KMS("out of memory when allocating plane\n");
+ drm_dbg_kms(dev, "out of memory when allocating plane\n");
drm_mode_object_unregister(dev, &plane->base);
return -ENOMEM;
}
@@ -302,7 +302,7 @@ static int __drm_universal_plane_init(struct drm_device *dev,
GFP_KERNEL);
if (format_modifier_count && !plane->modifiers) {
- DRM_DEBUG_KMS("out of memory when allocating plane\n");
+ drm_dbg_kms(dev, "out of memory when allocating plane\n");
kfree(plane->format_types);
drm_mode_object_unregister(dev, &plane->base);
return -ENOMEM;
@@ -786,7 +786,7 @@ static int __setplane_check(struct drm_plane *plane,
/* Check whether this plane is usable on this CRTC */
if (!(plane->possible_crtcs & drm_crtc_mask(crtc))) {
- DRM_DEBUG_KMS("Invalid crtc for plane\n");
+ drm_dbg_kms(plane->dev, "Invalid crtc for plane\n");
return -EINVAL;
}
@@ -794,8 +794,9 @@ static int __setplane_check(struct drm_plane *plane,
ret = drm_plane_check_pixel_format(plane, fb->format->format,
fb->modifier);
if (ret) {
- DRM_DEBUG_KMS("Invalid pixel format %p4cc, modifier 0x%llx\n",
- &fb->format->format, fb->modifier);
+ drm_dbg_kms(fb->dev,
+ "Invalid pixel format %p4cc, modifier 0x%llx\n",
+ &fb->format->format, fb->modifier);
return ret;
}
@@ -804,8 +805,8 @@ static int __setplane_check(struct drm_plane *plane,
crtc_x > INT_MAX - (int32_t) crtc_w ||
crtc_h > INT_MAX ||
crtc_y > INT_MAX - (int32_t) crtc_h) {
- DRM_DEBUG_KMS("Invalid CRTC coordinates %ux%u+%d+%d\n",
- crtc_w, crtc_h, crtc_x, crtc_y);
+ drm_dbg_kms(crtc->dev, "Invalid CRTC coordinates %ux%u+%d+%d\n",
+ crtc_w, crtc_h, crtc_x, crtc_y);
return -ERANGE;
}
@@ -982,24 +983,23 @@ int drm_mode_setplane(struct drm_device *dev, void *data,
*/
plane = drm_plane_find(dev, file_priv, plane_req->plane_id);
if (!plane) {
- DRM_DEBUG_KMS("Unknown plane ID %d\n",
- plane_req->plane_id);
+ drm_dbg_kms(dev, "Unknown plane ID %d\n", plane_req->plane_id);
return -ENOENT;
}
if (plane_req->fb_id) {
fb = drm_framebuffer_lookup(dev, file_priv, plane_req->fb_id);
if (!fb) {
- DRM_DEBUG_KMS("Unknown framebuffer ID %d\n",
- plane_req->fb_id);
+ drm_dbg_kms(dev, "Unknown framebuffer ID %d\n",
+ plane_req->fb_id);
return -ENOENT;
}
crtc = drm_crtc_find(dev, file_priv, plane_req->crtc_id);
if (!crtc) {
drm_framebuffer_put(fb);
- DRM_DEBUG_KMS("Unknown crtc ID %d\n",
- plane_req->crtc_id);
+ drm_dbg_kms(dev, "Unknown crtc ID %d\n",
+ plane_req->crtc_id);
return -ENOENT;
}
}
@@ -1048,7 +1048,7 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc,
if (req->handle) {
fb = drm_internal_framebuffer_create(dev, &fbreq, file_priv);
if (IS_ERR(fb)) {
- DRM_DEBUG_KMS("failed to wrap cursor buffer in drm framebuffer\n");
+ drm_dbg_kms(dev, "failed to wrap cursor buffer in drm framebuffer\n");
return PTR_ERR(fb);
}
@@ -1119,7 +1119,7 @@ static int drm_mode_cursor_common(struct drm_device *dev,
crtc = drm_crtc_find(dev, file_priv, req->crtc_id);
if (!crtc) {
- DRM_DEBUG_KMS("Unknown CRTC ID %d\n", req->crtc_id);
+ drm_dbg_kms(dev, "Unknown CRTC ID %d\n", req->crtc_id);
return -ENOENT;
}
@@ -1340,7 +1340,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
* to modifier changes.
*/
if (old_fb->format->format != fb->format->format) {
- DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
+ drm_dbg_kms(dev, "Page flip is not allowed to change frame buffer format.\n");
ret = -EINVAL;
goto out;
}
diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
index 2fb9bf901a2c..6cdaf84735cd 100644
--- a/drivers/gpu/drm/drm_probe_helper.c
+++ b/drivers/gpu/drm/drm_probe_helper.c
@@ -532,8 +532,8 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
drm_modeset_acquire_init(&ctx, 0);
- DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id,
- connector->name);
+ drm_dbg_kms(dev, "[CONNECTOR:%d:%s]\n", connector->base.id,
+ connector->name);
retry:
ret = drm_modeset_lock(&dev->mode_config.connection_mutex, &ctx);
@@ -576,11 +576,12 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
* check here, and if anything changed start the hotplug code.
*/
if (old_status != connector->status) {
- DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to %s\n",
- connector->base.id,
- connector->name,
- drm_get_connector_status_name(old_status),
- drm_get_connector_status_name(connector->status));
+ drm_dbg_kms(dev,
+ "[CONNECTOR:%d:%s] status updated from %s to %s\n",
+ connector->base.id,
+ connector->name,
+ drm_get_connector_status_name(old_status),
+ drm_get_connector_status_name(connector->status));
/*
* The hotplug event code might call into the fb
@@ -599,8 +600,8 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
drm_kms_helper_poll_enable(dev);
if (connector->status == connector_status_disconnected) {
- DRM_DEBUG_KMS("[CONNECTOR:%d:%s] disconnected\n",
- connector->base.id, connector->name);
+ drm_dbg_kms(dev, "[CONNECTOR:%d:%s] disconnected\n",
+ connector->base.id, connector->name);
drm_connector_update_edid_property(connector, NULL);
drm_mode_prune_invalid(dev, &connector->modes, false);
goto exit;
@@ -658,8 +659,8 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
drm_mode_sort(&connector->modes);
- DRM_DEBUG_KMS("[CONNECTOR:%d:%s] probed modes :\n", connector->base.id,
- connector->name);
+ drm_dbg_kms(dev, "[CONNECTOR:%d:%s] probed modes :\n",
+ connector->base.id, connector->name);
list_for_each_entry(mode, &connector->modes, head) {
drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
drm_mode_debug_printmodeline(mode);
@@ -793,14 +794,14 @@ static void output_poll_execute(struct work_struct *work)
old = drm_get_connector_status_name(old_status);
new = drm_get_connector_status_name(connector->status);
- DRM_DEBUG_KMS("[CONNECTOR:%d:%s] "
- "status updated from %s to %s\n",
- connector->base.id,
- connector->name,
- old, new);
- DRM_DEBUG_KMS("[CONNECTOR:%d:%s] epoch counter %llu -> %llu\n",
- connector->base.id, connector->name,
- old_epoch_counter, connector->epoch_counter);
+ drm_dbg_kms(dev, "[CONNECTOR:%d:%s] "
+ "status updated from %s to %s\n",
+ connector->base.id,
+ connector->name,
+ old, new);
+ drm_dbg_kms(dev, "[CONNECTOR:%d:%s] epoch counter %llu -> %llu\n",
+ connector->base.id, connector->name,
+ old_epoch_counter, connector->epoch_counter);
changed = true;
}
diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c
index 85c79a38c13a..8f4abcb1cbd8 100644
--- a/drivers/gpu/drm/drm_rect.c
+++ b/drivers/gpu/drm/drm_rect.c
@@ -228,9 +228,9 @@ EXPORT_SYMBOL(drm_rect_calc_vscale);
void drm_rect_debug_print(const char *prefix, const struct drm_rect *r, bool fixed_point)
{
if (fixed_point)
- DRM_DEBUG_KMS("%s" DRM_RECT_FP_FMT "\n", prefix, DRM_RECT_FP_ARG(r));
+ drm_dbg_kms(NULL, "%s" DRM_RECT_FP_FMT "\n", prefix, DRM_RECT_FP_ARG(r));
else
- DRM_DEBUG_KMS("%s" DRM_RECT_FMT "\n", prefix, DRM_RECT_ARG(r));
+ drm_dbg_kms(NULL, "%s" DRM_RECT_FMT "\n", prefix, DRM_RECT_ARG(r));
}
EXPORT_SYMBOL(drm_rect_debug_print);
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index b7c6754b4688..0edd0df29cb3 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -209,10 +209,10 @@ static ssize_t status_store(struct device *device,
ret = -EINVAL;
if (old_force != connector->force || !connector->force) {
- DRM_DEBUG_KMS("[CONNECTOR:%d:%s] force updated from %d to %d or reprobing\n",
- connector->base.id,
- connector->name,
- old_force, connector->force);
+ drm_dbg_kms(dev, "[CONNECTOR:%d:%s] force updated from %d to %d or reprobing\n",
+ connector->base.id,
+ connector->name,
+ old_force, connector->force);
connector->funcs->fill_modes(connector,
dev->mode_config.max_width,
--
2.39.2
Comments say macros DRM_DEBUG_* are deprecated in favor of
drm_dbg_*(NULL, ...), but they have broken support for it,
as the macro will result in `(NULL) ? (NULL)->dev : NULL`.
Thus, fix them by separating logic to get dev ptr in a new
function, which will return the dev ptr if arg is not NULL.
Use it in drm_dbg_*, and also in __DRM_DEFINE_DBG_RATELIMITED,
where a similar (but correct) NULL check was in place.
Also, add support for NULL in __drm_printk, so that all the
drm_* macros will hence support NULL as the first argument.
This also means that deprecation comments mentioning pr_()*
can now be changed to the drm equivalents.
Signed-off-by: Siddh Raman Pant <[email protected]>
---
include/drm/drm_print.h | 79 +++++++++++++++++++++++++++--------------
1 file changed, 52 insertions(+), 27 deletions(-)
diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
index a93a387f8a1a..4b8532cf2ae6 100644
--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -34,6 +34,7 @@
#include <linux/dynamic_debug.h>
#include <drm/drm.h>
+#include <drm/drm_device.h>
/* Do *not* use outside of drm_print.[ch]! */
extern unsigned long __drm_debug;
@@ -451,9 +452,32 @@ void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
* Prefer drm_device based logging over device or prink based logging.
*/
+/* Helpers for struct drm_device based logging. */
+
+/**
+ * __drm_dev_ptr - Helper function to get drm->dev pointer.
+ * @drm: struct drm_device pointer.
+ *
+ * RETURNS:
+ * The struct device pointer (NULL if @drm is NULL).
+ */
+static inline struct device *__drm_dev_ptr(const struct drm_device *drm)
+{
+ if (drm)
+ return drm->dev;
+
+ return NULL;
+}
+
/* Helper for struct drm_device based logging. */
#define __drm_printk(drm, level, type, fmt, ...) \
- dev_##level##type((drm)->dev, "[drm] " fmt, ##__VA_ARGS__)
+({ \
+ struct device *__dev_ = __drm_dev_ptr(drm); \
+ if (__dev_) \
+ dev_##level##type(__dev_, "[drm] " fmt, ##__VA_ARGS__); \
+ else \
+ pr_##level##type("[drm] " fmt, ##__VA_ARGS__); \
+})
#define drm_info(drm, fmt, ...) \
@@ -487,25 +511,25 @@ void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
#define drm_dbg_core(drm, fmt, ...) \
- drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_CORE, fmt, ##__VA_ARGS__)
-#define drm_dbg_driver(drm, fmt, ...) \
- drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
+ drm_dev_dbg(__drm_dev_ptr(drm), DRM_UT_CORE, fmt, ##__VA_ARGS__)
+#define drm_dbg_driver(drm, fmt, ...) \
+ drm_dev_dbg(__drm_dev_ptr(drm), DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
#define drm_dbg_kms(drm, fmt, ...) \
- drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_KMS, fmt, ##__VA_ARGS__)
+ drm_dev_dbg(__drm_dev_ptr(drm), DRM_UT_KMS, fmt, ##__VA_ARGS__)
#define drm_dbg_prime(drm, fmt, ...) \
- drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
+ drm_dev_dbg(__drm_dev_ptr(drm), DRM_UT_PRIME, fmt, ##__VA_ARGS__)
#define drm_dbg_atomic(drm, fmt, ...) \
- drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
+ drm_dev_dbg(__drm_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
#define drm_dbg_vbl(drm, fmt, ...) \
- drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_VBL, fmt, ##__VA_ARGS__)
+ drm_dev_dbg(__drm_dev_ptr(drm), DRM_UT_VBL, fmt, ##__VA_ARGS__)
#define drm_dbg_state(drm, fmt, ...) \
- drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_STATE, fmt, ##__VA_ARGS__)
+ drm_dev_dbg(__drm_dev_ptr(drm), DRM_UT_STATE, fmt, ##__VA_ARGS__)
#define drm_dbg_lease(drm, fmt, ...) \
- drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_LEASE, fmt, ##__VA_ARGS__)
+ drm_dev_dbg(__drm_dev_ptr(drm), DRM_UT_LEASE, fmt, ##__VA_ARGS__)
#define drm_dbg_dp(drm, fmt, ...) \
- drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DP, fmt, ##__VA_ARGS__)
+ drm_dev_dbg(__drm_dev_ptr(drm), DRM_UT_DP, fmt, ##__VA_ARGS__)
#define drm_dbg_drmres(drm, fmt, ...) \
- drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DRMRES, fmt, ##__VA_ARGS__)
+ drm_dev_dbg(__drm_dev_ptr(drm), DRM_UT_DRMRES, fmt, ##__VA_ARGS__)
#define drm_dbg(drm, fmt, ...) drm_dbg_driver(drm, fmt, ##__VA_ARGS__)
@@ -533,31 +557,31 @@ void __drm_err(const char *format, ...);
#define _DRM_PRINTK(once, level, fmt, ...) \
printk##once(KERN_##level "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
-/* NOTE: this is deprecated in favor of pr_info(). */
+/* NOTE: this is deprecated in favor of drm_info(NULL, ...). */
#define DRM_INFO(fmt, ...) \
_DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
-/* NOTE: this is deprecated in favor of pr_notice(). */
+/* NOTE: this is deprecated in favor of drm_notice(NULL, ...). */
#define DRM_NOTE(fmt, ...) \
_DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
-/* NOTE: this is deprecated in favor of pr_warn(). */
+/* NOTE: this is deprecated in favor of drm_warn(NULL, ...). */
#define DRM_WARN(fmt, ...) \
_DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
-/* NOTE: this is deprecated in favor of pr_info_once(). */
+/* NOTE: this is deprecated in favor of drm_info_once(NULL, ...). */
#define DRM_INFO_ONCE(fmt, ...) \
_DRM_PRINTK(_once, INFO, fmt, ##__VA_ARGS__)
-/* NOTE: this is deprecated in favor of pr_notice_once(). */
+/* NOTE: this is deprecated in favor of drm_notice_once(NULL, ...). */
#define DRM_NOTE_ONCE(fmt, ...) \
_DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
-/* NOTE: this is deprecated in favor of pr_warn_once(). */
+/* NOTE: this is deprecated in favor of drm_warn_once(NULL, ...). */
#define DRM_WARN_ONCE(fmt, ...) \
_DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
-/* NOTE: this is deprecated in favor of pr_err(). */
+/* NOTE: this is deprecated in favor of drm_err(NULL, ...). */
#define DRM_ERROR(fmt, ...) \
__drm_err(fmt, ##__VA_ARGS__)
-/* NOTE: this is deprecated in favor of pr_err_ratelimited(). */
+/* NOTE: this is deprecated in favor of drm_err_ratelimited(NULL, ...). */
#define DRM_ERROR_RATELIMITED(fmt, ...) \
DRM_DEV_ERROR_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
@@ -593,13 +617,14 @@ void __drm_err(const char *format, ...);
#define DRM_DEBUG_DP(fmt, ...) \
__drm_dbg(DRM_UT_DP, fmt, ## __VA_ARGS__)
-#define __DRM_DEFINE_DBG_RATELIMITED(category, drm, fmt, ...) \
-({ \
- static DEFINE_RATELIMIT_STATE(rs_, DEFAULT_RATELIMIT_INTERVAL, DEFAULT_RATELIMIT_BURST);\
- const struct drm_device *drm_ = (drm); \
- \
- if (drm_debug_enabled(DRM_UT_ ## category) && __ratelimit(&rs_)) \
- drm_dev_printk(drm_ ? drm_->dev : NULL, KERN_DEBUG, fmt, ## __VA_ARGS__); \
+#define __DRM_DEFINE_DBG_RATELIMITED(category, drm, fmt, ...) \
+({ \
+ static DEFINE_RATELIMIT_STATE(rs_, DEFAULT_RATELIMIT_INTERVAL, \
+ DEFAULT_RATELIMIT_BURST); \
+ \
+ if (drm_debug_enabled(DRM_UT_ ## category) && __ratelimit(&rs_))\
+ drm_dev_printk(__drm_dev_ptr(drm), KERN_DEBUG, \
+ fmt, ## __VA_ARGS__); \
})
#define drm_dbg_kms_ratelimited(drm, fmt, ...) \
--
2.39.2
drm_print.h says DRM_INFO is deprecated in favor of drm_info().
Signed-off-by: Siddh Raman Pant <[email protected]>
---
drivers/gpu/drm/drm_client_modeset.c | 2 +-
drivers/gpu/drm/drm_connector.c | 7 ++++---
drivers/gpu/drm/drm_drv.c | 2 +-
drivers/gpu/drm/drm_pci.c | 2 +-
4 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c
index 1b12a3c201a3..ae19734974b5 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -331,7 +331,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");
+ drm_info(dev, "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 48df7a5ea503..dca8dd4ab93f 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -168,13 +168,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));
+ drm_info(connector->dev, "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",
+ drm_info(connector->dev,
+ "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 12687dd9e1ac..02eaa4c9344d 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -943,7 +943,7 @@ 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",
+ drm_info(dev, "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",
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index 39d35fc3a43b..7dfb837d1325 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -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");
+ drm_info(NULL, "Module unloaded\n");
}
EXPORT_SYMBOL(drm_legacy_pci_exit);
--
2.39.2
This reverts commit 1040e424353f5f4d39f6f3aa8723eb3bd6ea6446.
It used an incorrect way to use drm_* functions. Only drm_device ptrs
should be passed, but the mentioned commit passed mipi_dsi_host ptr.
It worked by accident due to macro magic.
Reported-by: Jani Nikula <[email protected]>
Reviewed-by: Jani Nikula <[email protected]>
Signed-off-by: Siddh Raman Pant <[email protected]>
---
drivers/gpu/drm/drm_mipi_dsi.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index 3fd6c733ff4e..a37af4edf394 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -33,7 +33,6 @@
#include <drm/display/drm_dsc.h>
#include <drm/drm_mipi_dsi.h>
-#include <drm/drm_print.h>
#include <video/mipi_display.h>
@@ -156,18 +155,19 @@ static int mipi_dsi_device_add(struct mipi_dsi_device *dsi)
static struct mipi_dsi_device *
of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct device_node *node)
{
+ struct device *dev = host->dev;
struct mipi_dsi_device_info info = { };
int ret;
u32 reg;
if (of_alias_from_compatible(node, info.type, sizeof(info.type)) < 0) {
- drm_err(host, "modalias failure on %pOF\n", node);
+ dev_err(dev, "modalias failure on %pOF\n", node);
return ERR_PTR(-EINVAL);
}
ret = of_property_read_u32(node, "reg", ®);
if (ret) {
- drm_err(host, "device node %pOF has no valid reg property: %d\n",
+ dev_err(dev, "device node %pOF has no valid reg property: %d\n",
node, ret);
return ERR_PTR(-EINVAL);
}
@@ -202,21 +202,22 @@ mipi_dsi_device_register_full(struct mipi_dsi_host *host,
const struct mipi_dsi_device_info *info)
{
struct mipi_dsi_device *dsi;
+ struct device *dev = host->dev;
int ret;
if (!info) {
- drm_err(host, "invalid mipi_dsi_device_info pointer\n");
+ dev_err(dev, "invalid mipi_dsi_device_info pointer\n");
return ERR_PTR(-EINVAL);
}
if (info->channel > 3) {
- drm_err(host, "invalid virtual channel: %u\n", info->channel);
+ dev_err(dev, "invalid virtual channel: %u\n", info->channel);
return ERR_PTR(-EINVAL);
}
dsi = mipi_dsi_device_alloc(host);
if (IS_ERR(dsi)) {
- drm_err(host, "failed to allocate DSI device %ld\n",
+ dev_err(dev, "failed to allocate DSI device %ld\n",
PTR_ERR(dsi));
return dsi;
}
@@ -227,7 +228,7 @@ mipi_dsi_device_register_full(struct mipi_dsi_host *host,
ret = mipi_dsi_device_add(dsi);
if (ret) {
- drm_err(host, "failed to add DSI device %d\n", ret);
+ dev_err(dev, "failed to add DSI device %d\n", ret);
kfree(dsi);
return ERR_PTR(ret);
}
--
2.39.2
drm_print.h says DRM_DEBUG_DRIVER is deprecated.
Thus, use newer drm_dbg_driver().
Also fix the deprecation comment in drm_print.h which
mentions drm_dbg() instead of drm_dbg_driver().
Signed-off-by: Siddh Raman Pant <[email protected]>
---
drivers/gpu/drm/drm_mipi_dbi.c | 10 +++++-----
include/drm/drm_print.h | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c
index 58ff9503a403..ab5dd5933a1a 100644
--- a/drivers/gpu/drm/drm_mipi_dbi.c
+++ b/drivers/gpu/drm/drm_mipi_dbi.c
@@ -70,11 +70,11 @@
#define MIPI_DBI_DEBUG_COMMAND(cmd, data, len) \
({ \
if (!len) \
- DRM_DEBUG_DRIVER("cmd=%02x\n", cmd); \
+ drm_dbg_driver(NULL, "cmd=%02x\n", cmd); \
else if (len <= 32) \
- DRM_DEBUG_DRIVER("cmd=%02x, par=%*ph\n", cmd, (int)len, data);\
+ drm_dbg_driver(NULL, "cmd=%02x, par=%*ph\n", cmd, (int)len, data);\
else \
- DRM_DEBUG_DRIVER("cmd=%02x, len=%zu\n", cmd, len); \
+ drm_dbg_driver(NULL, "cmd=%02x, len=%zu\n", cmd, len); \
})
static const u8 mipi_dbi_dcs_read_commands[] = {
@@ -708,7 +708,7 @@ bool mipi_dbi_display_is_on(struct mipi_dbi *dbi)
DCS_POWER_MODE_DISPLAY_NORMAL_MODE | DCS_POWER_MODE_SLEEP_MODE))
return false;
- DRM_DEBUG_DRIVER("Display is ON\n");
+ drm_dbg_driver(NULL, "Display is ON\n");
return true;
}
@@ -1256,7 +1256,7 @@ int mipi_dbi_spi_init(struct spi_device *spi, struct mipi_dbi *dbi,
mutex_init(&dbi->cmdlock);
- DRM_DEBUG_DRIVER("SPI speed: %uMHz\n", spi->max_speed_hz / 1000000);
+ drm_dbg_driver(NULL, "SPI speed: %uMHz\n", spi->max_speed_hz / 1000000);
return 0;
}
diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
index 4b8532cf2ae6..2bac5e8fd550 100644
--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -589,7 +589,7 @@ void __drm_err(const char *format, ...);
#define DRM_DEBUG(fmt, ...) \
__drm_dbg(DRM_UT_CORE, fmt, ##__VA_ARGS__)
-/* NOTE: this is deprecated in favor of drm_dbg(NULL, ...). */
+/* NOTE: this is deprecated in favor of drm_dbg_driver(NULL, ...). */
#define DRM_DEBUG_DRIVER(fmt, ...) \
__drm_dbg(DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
--
2.39.2
drm_print.h says DRM_DEBUG is deprecated in favor of drm_dbg_core().
Signed-off-by: Siddh Raman Pant <[email protected]>
---
drivers/gpu/drm/drm_agpsupport.c | 4 +-
drivers/gpu/drm/drm_bufs.c | 114 +++++++++++++++---------------
drivers/gpu/drm/drm_context.c | 14 ++--
drivers/gpu/drm/drm_dma.c | 10 +--
drivers/gpu/drm/drm_drv.c | 10 +--
drivers/gpu/drm/drm_gem.c | 5 +-
drivers/gpu/drm/drm_hashtab.c | 6 +-
drivers/gpu/drm/drm_irq.c | 4 +-
drivers/gpu/drm/drm_lease.c | 2 +-
drivers/gpu/drm/drm_legacy_misc.c | 4 +-
drivers/gpu/drm/drm_lock.c | 20 +++---
drivers/gpu/drm/drm_mode_object.c | 6 +-
drivers/gpu/drm/drm_pci.c | 12 ++--
drivers/gpu/drm/drm_plane.c | 12 ++--
drivers/gpu/drm/drm_scatter.c | 10 +--
drivers/gpu/drm/drm_syncobj.c | 2 +-
drivers/gpu/drm/drm_sysfs.c | 14 ++--
drivers/gpu/drm/drm_vm.c | 43 ++++++-----
18 files changed, 150 insertions(+), 142 deletions(-)
diff --git a/drivers/gpu/drm/drm_agpsupport.c b/drivers/gpu/drm/drm_agpsupport.c
index a4ad6fd13abc..d27686d6e82d 100644
--- a/drivers/gpu/drm/drm_agpsupport.c
+++ b/drivers/gpu/drm/drm_agpsupport.c
@@ -315,8 +315,8 @@ int drm_legacy_agp_bind(struct drm_device *dev, struct drm_agp_binding *request)
if (retcode)
return retcode;
entry->bound = dev->agp->base + (page << PAGE_SHIFT);
- DRM_DEBUG("base = 0x%lx entry->bound = 0x%lx\n",
- dev->agp->base, entry->bound);
+ drm_dbg_core(dev, "base = 0x%lx entry->bound = 0x%lx\n",
+ dev->agp->base, entry->bound);
return 0;
}
EXPORT_SYMBOL(drm_legacy_agp_bind);
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index aa66fe16ea6e..a767f51c5369 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -171,8 +171,8 @@ static int drm_addmap_core(struct drm_device *dev, resource_size_t offset,
kfree(map);
return -EINVAL;
}
- DRM_DEBUG("offset = 0x%08llx, size = 0x%08lx, type = %d\n",
- (unsigned long long)map->offset, map->size, map->type);
+ drm_dbg_core(dev, "offset = 0x%08llx, size = 0x%08lx, type = %d\n",
+ (unsigned long long)map->offset, map->size, map->type);
/* page-align _DRM_SHM maps. They are allocated here so there is no security
* hole created by that and it works around various broken drivers that use
@@ -205,10 +205,10 @@ static int drm_addmap_core(struct drm_device *dev, resource_size_t offset,
list = drm_find_matching_map(dev, map);
if (list != NULL) {
if (list->map->size != map->size) {
- DRM_DEBUG("Matching maps of type %d with "
- "mismatched sizes, (%ld vs %ld)\n",
- map->type, map->size,
- list->map->size);
+ drm_dbg_core(dev, "Matching maps of type %d with "
+ "mismatched sizes, (%ld vs %ld)\n",
+ map->type, map->size,
+ list->map->size);
list->map->size = map->size;
}
@@ -239,9 +239,9 @@ static int drm_addmap_core(struct drm_device *dev, resource_size_t offset,
list = drm_find_matching_map(dev, map);
if (list != NULL) {
if (list->map->size != map->size) {
- DRM_DEBUG("Matching maps of type %d with "
- "mismatched sizes, (%ld vs %ld)\n",
- map->type, map->size, list->map->size);
+ drm_dbg_core(dev, "Matching maps of type %d with "
+ "mismatched sizes, (%ld vs %ld)\n",
+ map->type, map->size, list->map->size);
list->map->size = map->size;
}
@@ -250,8 +250,8 @@ static int drm_addmap_core(struct drm_device *dev, resource_size_t offset,
return 0;
}
map->handle = vmalloc_user(map->size);
- DRM_DEBUG("%lu %d %p\n",
- map->size, order_base_2(map->size), map->handle);
+ drm_dbg_core(dev, "%lu %d %p\n",
+ map->size, order_base_2(map->size), map->handle);
if (!map->handle) {
kfree(map);
return -ENOMEM;
@@ -308,8 +308,8 @@ static int drm_addmap_core(struct drm_device *dev, resource_size_t offset,
kfree(map);
return -EPERM;
}
- DRM_DEBUG("AGP offset = 0x%08llx, size = 0x%08lx\n",
- (unsigned long long)map->offset, map->size);
+ drm_dbg_core(dev, "AGP offset = 0x%08llx, size = 0x%08lx\n",
+ (unsigned long long)map->offset, map->size);
break;
}
@@ -745,13 +745,13 @@ int drm_legacy_addbufs_agp(struct drm_device *dev,
byte_count = 0;
agp_offset = dev->agp->base + request->agp_start;
- DRM_DEBUG("count: %d\n", count);
- DRM_DEBUG("order: %d\n", order);
- DRM_DEBUG("size: %d\n", size);
- DRM_DEBUG("agp_offset: %lx\n", agp_offset);
- DRM_DEBUG("alignment: %d\n", alignment);
- DRM_DEBUG("page_order: %d\n", page_order);
- DRM_DEBUG("total: %d\n", total);
+ drm_dbg_core(dev, "count: %d\n", count);
+ drm_dbg_core(dev, "order: %d\n", order);
+ drm_dbg_core(dev, "size: %d\n", size);
+ drm_dbg_core(dev, "agp_offset: %lx\n", agp_offset);
+ drm_dbg_core(dev, "alignment: %d\n", alignment);
+ drm_dbg_core(dev, "page_order: %d\n", page_order);
+ drm_dbg_core(dev, "total: %d\n", total);
if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
return -EINVAL;
@@ -766,7 +766,7 @@ int drm_legacy_addbufs_agp(struct drm_device *dev,
}
}
if (!list_empty(&dev->agp->memory) && !valid) {
- DRM_DEBUG("zone invalid\n");
+ drm_dbg_core(dev, "zone invalid\n");
return -EINVAL;
}
spin_lock(&dev->buf_lock);
@@ -829,14 +829,15 @@ int drm_legacy_addbufs_agp(struct drm_device *dev,
return -ENOMEM;
}
- DRM_DEBUG("buffer %d @ %p\n", entry->buf_count, buf->address);
+ drm_dbg_core(dev, "buffer %d @ %p\n", entry->buf_count,
+ buf->address);
offset += alignment;
entry->buf_count++;
byte_count += PAGE_SIZE << page_order;
}
- DRM_DEBUG("byte_count: %d\n", byte_count);
+ drm_dbg_core(dev, "byte_count: %d\n", byte_count);
temp_buflist = krealloc(dma->buflist,
(dma->buf_count + entry->buf_count) *
@@ -859,8 +860,8 @@ int drm_legacy_addbufs_agp(struct drm_device *dev,
dma->page_count += byte_count >> PAGE_SHIFT;
dma->byte_count += byte_count;
- DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count);
- DRM_DEBUG("entry->buf_count : %d\n", entry->buf_count);
+ drm_dbg_core(dev, "dma->buf_count : %d\n", dma->buf_count);
+ drm_dbg_core(dev, "entry->buf_count : %d\n", entry->buf_count);
mutex_unlock(&dev->struct_mutex);
@@ -908,8 +909,8 @@ int drm_legacy_addbufs_pci(struct drm_device *dev,
order = order_base_2(request->size);
size = 1 << order;
- DRM_DEBUG("count=%d, size=%d (%d), order=%d\n",
- request->count, request->size, size, order);
+ drm_dbg_core(dev, "count=%d, size=%d (%d), order=%d\n",
+ request->count, request->size, size, order);
if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
return -EINVAL;
@@ -971,8 +972,8 @@ int drm_legacy_addbufs_pci(struct drm_device *dev,
}
memcpy(temp_pagelist,
dma->pagelist, dma->page_count * sizeof(*dma->pagelist));
- DRM_DEBUG("pagelist: %d entries\n",
- dma->page_count + (count << page_order));
+ drm_dbg_core(dev, "pagelist: %d entries\n",
+ dma->page_count + (count << page_order));
entry->buf_size = size;
entry->page_order = page_order;
@@ -1011,9 +1012,9 @@ int drm_legacy_addbufs_pci(struct drm_device *dev,
}
entry->seglist[entry->seg_count++] = dmah;
for (i = 0; i < (1 << page_order); i++) {
- DRM_DEBUG("page %d @ 0x%08lx\n",
- dma->page_count + page_count,
- (unsigned long)dmah->vaddr + PAGE_SIZE * i);
+ drm_dbg_core(dev, "page %d @ 0x%08lx\n",
+ dma->page_count + page_count,
+ (unsigned long)dmah->vaddr + PAGE_SIZE * i);
temp_pagelist[dma->page_count + page_count++]
= (unsigned long)dmah->vaddr + PAGE_SIZE * i;
}
@@ -1047,8 +1048,8 @@ int drm_legacy_addbufs_pci(struct drm_device *dev,
return -ENOMEM;
}
- DRM_DEBUG("buffer %d @ %p\n",
- entry->buf_count, buf->address);
+ drm_dbg_core(dev, "buffer %d @ %p\n",
+ entry->buf_count, buf->address);
}
byte_count += PAGE_SIZE << page_order;
}
@@ -1136,13 +1137,13 @@ static int drm_legacy_addbufs_sg(struct drm_device *dev,
byte_count = 0;
agp_offset = request->agp_start;
- DRM_DEBUG("count: %d\n", count);
- DRM_DEBUG("order: %d\n", order);
- DRM_DEBUG("size: %d\n", size);
- DRM_DEBUG("agp_offset: %lu\n", agp_offset);
- DRM_DEBUG("alignment: %d\n", alignment);
- DRM_DEBUG("page_order: %d\n", page_order);
- DRM_DEBUG("total: %d\n", total);
+ drm_dbg_core(dev, "count: %d\n", count);
+ drm_dbg_core(dev, "order: %d\n", order);
+ drm_dbg_core(dev, "size: %d\n", size);
+ drm_dbg_core(dev, "agp_offset: %lu\n", agp_offset);
+ drm_dbg_core(dev, "alignment: %d\n", alignment);
+ drm_dbg_core(dev, "page_order: %d\n", page_order);
+ drm_dbg_core(dev, "total: %d\n", total);
if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
return -EINVAL;
@@ -1208,14 +1209,15 @@ static int drm_legacy_addbufs_sg(struct drm_device *dev,
return -ENOMEM;
}
- DRM_DEBUG("buffer %d @ %p\n", entry->buf_count, buf->address);
+ drm_dbg_core(dev, "buffer %d @ %p\n", entry->buf_count,
+ buf->address);
offset += alignment;
entry->buf_count++;
byte_count += PAGE_SIZE << page_order;
}
- DRM_DEBUG("byte_count: %d\n", byte_count);
+ drm_dbg_core(dev, "byte_count: %d\n", byte_count);
temp_buflist = krealloc(dma->buflist,
(dma->buf_count + entry->buf_count) *
@@ -1238,8 +1240,8 @@ static int drm_legacy_addbufs_sg(struct drm_device *dev,
dma->page_count += byte_count >> PAGE_SHIFT;
dma->byte_count += byte_count;
- DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count);
- DRM_DEBUG("entry->buf_count : %d\n", entry->buf_count);
+ drm_dbg_core(dev, "dma->buf_count : %d\n", dma->buf_count);
+ drm_dbg_core(dev, "entry->buf_count : %d\n", entry->buf_count);
mutex_unlock(&dev->struct_mutex);
@@ -1340,7 +1342,7 @@ int __drm_legacy_infobufs(struct drm_device *dev,
++count;
}
- DRM_DEBUG("count = %d\n", count);
+ drm_dbg_core(dev, "count = %d\n", count);
if (*p >= count) {
for (i = 0, count = 0; i < DRM_MAX_ORDER + 1; i++) {
@@ -1349,12 +1351,12 @@ int __drm_legacy_infobufs(struct drm_device *dev,
if (from->buf_count) {
if (f(data, count, from) < 0)
return -EFAULT;
- DRM_DEBUG("%d %d %d %d %d\n",
- i,
- dma->bufs[i].buf_count,
- dma->bufs[i].buf_size,
- dma->bufs[i].low_mark,
- dma->bufs[i].high_mark);
+ drm_dbg_core(dev, "%d %d %d %d %d\n",
+ i,
+ dma->bufs[i].buf_count,
+ dma->bufs[i].buf_size,
+ dma->bufs[i].low_mark,
+ dma->bufs[i].high_mark);
++count;
}
}
@@ -1417,8 +1419,8 @@ int drm_legacy_markbufs(struct drm_device *dev, void *data,
if (!dma)
return -EINVAL;
- DRM_DEBUG("%d, %d, %d\n",
- request->size, request->low_mark, request->high_mark);
+ drm_dbg_core(dev, "%d, %d, %d\n",
+ request->size, request->low_mark, request->high_mark);
order = order_base_2(request->size);
if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
return -EINVAL;
@@ -1465,7 +1467,7 @@ int drm_legacy_freebufs(struct drm_device *dev, void *data,
if (!dma)
return -EINVAL;
- DRM_DEBUG("%d\n", request->count);
+ drm_dbg_core(dev, "%d\n", request->count);
for (i = 0; i < request->count; i++) {
if (copy_from_user(&idx, &request->list[i], sizeof(idx)))
return -EFAULT;
@@ -1565,7 +1567,7 @@ int __drm_legacy_mapbufs(struct drm_device *dev, void *data, int *p,
}
done:
*p = dma->buf_count;
- DRM_DEBUG("%d buffers, retcode = %d\n", *p, retcode);
+ drm_dbg_core(dev, "%d buffers, retcode = %d\n", *p, retcode);
return retcode;
}
diff --git a/drivers/gpu/drm/drm_context.c b/drivers/gpu/drm/drm_context.c
index bf1fc8bb97de..8b7b925aee97 100644
--- a/drivers/gpu/drm/drm_context.c
+++ b/drivers/gpu/drm/drm_context.c
@@ -274,7 +274,7 @@ static int drm_context_switch(struct drm_device * dev, int old, int new)
return -EBUSY;
}
- DRM_DEBUG("Context switch from %d to %d\n", old, new);
+ drm_dbg_core(dev, "Context switch from %d to %d\n", old, new);
if (new == dev->last_context) {
clear_bit(0, &dev->context_flag);
@@ -371,9 +371,9 @@ int drm_legacy_addctx(struct drm_device *dev, void *data,
/* Skip kernel's context and get a new one. */
tmp_handle = drm_legacy_ctxbitmap_next(dev);
}
- DRM_DEBUG("%d\n", tmp_handle);
+ drm_dbg_core(dev, "%d\n", tmp_handle);
if (tmp_handle < 0) {
- DRM_DEBUG("Not enough free contexts.\n");
+ drm_dbg_core(dev, "Not enough free contexts.\n");
/* Should this return -EBUSY instead? */
return tmp_handle;
}
@@ -382,7 +382,7 @@ int drm_legacy_addctx(struct drm_device *dev, void *data,
ctx_entry = kmalloc(sizeof(*ctx_entry), GFP_KERNEL);
if (!ctx_entry) {
- DRM_DEBUG("out of memory\n");
+ drm_dbg_core(dev, "out of memory\n");
return -ENOMEM;
}
@@ -439,7 +439,7 @@ int drm_legacy_switchctx(struct drm_device *dev, void *data,
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
return -EOPNOTSUPP;
- DRM_DEBUG("%d\n", ctx->handle);
+ drm_dbg_core(dev, "%d\n", ctx->handle);
return drm_context_switch(dev, dev->last_context, ctx->handle);
}
@@ -462,7 +462,7 @@ int drm_legacy_newctx(struct drm_device *dev, void *data,
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
return -EOPNOTSUPP;
- DRM_DEBUG("%d\n", ctx->handle);
+ drm_dbg_core(dev, "%d\n", ctx->handle);
drm_context_switch_complete(dev, file_priv, ctx->handle);
return 0;
@@ -487,7 +487,7 @@ int drm_legacy_rmctx(struct drm_device *dev, void *data,
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
return -EOPNOTSUPP;
- DRM_DEBUG("%d\n", ctx->handle);
+ drm_dbg_core(dev, "%d\n", ctx->handle);
if (ctx->handle != DRM_KERNEL_CONTEXT) {
if (dev->driver->context_dtor)
dev->driver->context_dtor(dev, ctx->handle);
diff --git a/drivers/gpu/drm/drm_dma.c b/drivers/gpu/drm/drm_dma.c
index eb6b741a6f99..dac137072c33 100644
--- a/drivers/gpu/drm/drm_dma.c
+++ b/drivers/gpu/drm/drm_dma.c
@@ -94,11 +94,11 @@ void drm_legacy_dma_takedown(struct drm_device *dev)
/* Clear dma buffers */
for (i = 0; i <= DRM_MAX_ORDER; i++) {
if (dma->bufs[i].seg_count) {
- DRM_DEBUG("order %d: buf_count = %d,"
- " seg_count = %d\n",
- i,
- dma->bufs[i].buf_count,
- dma->bufs[i].seg_count);
+ drm_dbg_core(dev, "order %d: buf_count = %d,"
+ " seg_count = %d\n",
+ i,
+ dma->bufs[i].buf_count,
+ dma->bufs[i].seg_count);
for (j = 0; j < dma->bufs[i].seg_count; j++) {
if (dma->bufs[i].seglist[j]) {
dmah = dma->bufs[i].seglist[j];
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 04246afc934f..7adf10cc6e67 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -166,7 +166,7 @@ static int drm_minor_register(struct drm_device *dev, unsigned int type)
unsigned long flags;
int ret;
- DRM_DEBUG("\n");
+ drm_dbg_core(dev, "\n");
minor = *drm_minor_get_slot(dev, type);
if (!minor)
@@ -195,7 +195,7 @@ static int drm_minor_register(struct drm_device *dev, unsigned int type)
spin_unlock_irqrestore(&drm_minor_lock, flags);
}
- DRM_DEBUG("new minor registered %d\n", minor->index);
+ drm_dbg_core(dev, "new minor registered %d\n", minor->index);
return 0;
err_debugfs:
@@ -422,7 +422,7 @@ void drm_minor_release(struct drm_minor *minor)
*/
void drm_put_dev(struct drm_device *dev)
{
- DRM_DEBUG("\n");
+ drm_dbg_core(NULL, "\n");
if (!dev) {
drm_err(NULL, "cleanup called no dev\n");
@@ -1030,7 +1030,7 @@ static int drm_stub_open(struct inode *inode, struct file *filp)
struct drm_minor *minor;
int err;
- DRM_DEBUG("\n");
+ drm_dbg_core(NULL, "\n");
minor = drm_minor_acquire(iminor(inode));
if (IS_ERR(minor))
@@ -1099,7 +1099,7 @@ static int __init drm_core_init(void)
drm_core_init_complete = true;
- DRM_DEBUG("Initialized\n");
+ drm_dbg_core(NULL, "Initialized\n");
return 0;
error:
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
index e0d52e69df15..3d88f0483fdf 100644
--- a/drivers/gpu/drm/drm_gem.c
+++ b/drivers/gpu/drm/drm_gem.c
@@ -705,7 +705,7 @@ int drm_gem_objects_lookup(struct drm_file *filp, void __user *bo_handles,
if (copy_from_user(handles, bo_handles, count * sizeof(u32))) {
ret = -EFAULT;
- DRM_DEBUG("Failed to copy in GEM handles\n");
+ drm_dbg_core(filp->minor->dev, "Failed to copy in GEM handles\n");
goto out;
}
@@ -760,7 +760,8 @@ long drm_gem_dma_resv_wait(struct drm_file *filep, u32 handle,
obj = drm_gem_object_lookup(filep, handle);
if (!obj) {
- DRM_DEBUG("Failed to look up GEM BO %d\n", handle);
+ drm_dbg_core(filep->minor->dev,
+ "Failed to look up GEM BO %d\n", handle);
return -EINVAL;
}
diff --git a/drivers/gpu/drm/drm_hashtab.c b/drivers/gpu/drm/drm_hashtab.c
index a1ebf8e056c7..357f20d73b43 100644
--- a/drivers/gpu/drm/drm_hashtab.c
+++ b/drivers/gpu/drm/drm_hashtab.c
@@ -67,10 +67,12 @@ void drm_ht_verbose_list(struct drm_open_hash *ht, unsigned long key)
int count = 0;
hashed_key = hash_long(key, ht->order);
- DRM_DEBUG("Key is 0x%08lx, Hashed key is 0x%08x\n", key, hashed_key);
+ drm_dbg_core(NULL, "Key is 0x%08lx, Hashed key is 0x%08x\n",
+ key, hashed_key);
h_list = &ht->table[hashed_key];
hlist_for_each_entry(entry, h_list, head)
- DRM_DEBUG("count %d, key: 0x%08lx\n", count++, entry->key);
+ drm_dbg_core(NULL, "count %d, key: 0x%08lx\n",
+ count++, entry->key);
}
static struct hlist_node *drm_ht_find_key(struct drm_open_hash *ht,
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index d327638e15ee..e70d6975310c 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -78,7 +78,7 @@ static int drm_legacy_irq_install(struct drm_device *dev, int irq)
return -EBUSY;
dev->irq_enabled = true;
- DRM_DEBUG("irq=%d\n", irq);
+ drm_dbg_core(dev, "irq=%d\n", irq);
/* Before installing handler */
if (dev->driver->irq_preinstall)
@@ -146,7 +146,7 @@ int drm_legacy_irq_uninstall(struct drm_device *dev)
if (!irq_enabled)
return -EINVAL;
- DRM_DEBUG("irq=%d\n", dev->irq);
+ drm_dbg_core(dev, "irq=%d\n", dev->irq);
if (drm_core_check_feature(dev, DRIVER_LEGACY))
vga_client_unregister(to_pci_dev(dev->dev));
diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c
index 150fe1555068..af72fc38bb7c 100644
--- a/drivers/gpu/drm/drm_lease.c
+++ b/drivers/gpu/drm/drm_lease.c
@@ -677,7 +677,7 @@ int drm_mode_get_lease_ioctl(struct drm_device *dev,
count++;
}
- DRM_DEBUG("lease holds %d objects\n", count);
+ drm_dbg_core(dev, "lease holds %d objects\n", count);
if (ret == 0)
arg->count_objects = count;
diff --git a/drivers/gpu/drm/drm_legacy_misc.c b/drivers/gpu/drm/drm_legacy_misc.c
index d4c5434062d7..ad0eef292cb0 100644
--- a/drivers/gpu/drm/drm_legacy_misc.c
+++ b/drivers/gpu/drm/drm_legacy_misc.c
@@ -70,7 +70,7 @@ int drm_legacy_setup(struct drm_device * dev)
return ret;
- DRM_DEBUG("\n");
+ drm_dbg_core(dev, "\n");
return 0;
}
@@ -95,7 +95,7 @@ void drm_legacy_dev_reinit(struct drm_device *dev)
dev->last_context = 0;
dev->if_version = 0;
- DRM_DEBUG("lastclose completed\n");
+ drm_dbg_core(dev, "lastclose completed\n");
}
void drm_master_legacy_init(struct drm_master *master)
diff --git a/drivers/gpu/drm/drm_lock.c b/drivers/gpu/drm/drm_lock.c
index 411f75a1ee14..fea573dcb016 100644
--- a/drivers/gpu/drm/drm_lock.c
+++ b/drivers/gpu/drm/drm_lock.c
@@ -180,10 +180,10 @@ int drm_legacy_lock(struct drm_device *dev, void *data,
return -EINVAL;
}
- DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n",
- lock->context, task_pid_nr(current),
- master->lock.hw_lock ? master->lock.hw_lock->lock : -1,
- lock->flags);
+ drm_dbg_core(dev, "%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n",
+ lock->context, task_pid_nr(current),
+ master->lock.hw_lock ? master->lock.hw_lock->lock : -1,
+ lock->flags);
add_wait_queue(&master->lock.lock_queue, &entry);
spin_lock_bh(&master->lock.spinlock);
@@ -219,8 +219,8 @@ int drm_legacy_lock(struct drm_device *dev, void *data,
__set_current_state(TASK_RUNNING);
remove_wait_queue(&master->lock.lock_queue, &entry);
- DRM_DEBUG("%d %s\n", lock->context,
- ret ? "interrupted" : "has lock");
+ drm_dbg_core(dev, "%d %s\n", lock->context,
+ ret ? "interrupted" : "has lock");
if (ret) return ret;
/* don't set the block all signals on the master process for now
@@ -234,8 +234,8 @@ int drm_legacy_lock(struct drm_device *dev, void *data,
if (dev->driver->dma_quiescent && (lock->flags & _DRM_LOCK_QUIESCENT))
{
if (dev->driver->dma_quiescent(dev)) {
- DRM_DEBUG("%d waiting for DMA quiescent\n",
- lock->context);
+ drm_dbg_core(dev, "%d waiting for DMA quiescent\n",
+ lock->context);
return -EBUSY;
}
}
@@ -345,8 +345,8 @@ void drm_legacy_lock_release(struct drm_device *dev, struct file *filp)
return;
if (drm_legacy_i_have_hw_lock(dev, file_priv)) {
- DRM_DEBUG("File %p released, freeing lock for context %d\n",
- filp, _DRM_LOCKING_CONTEXT(file_priv->master->lock.hw_lock->lock));
+ drm_dbg_core(dev, "File %p released, freeing lock for context %d\n",
+ filp, _DRM_LOCKING_CONTEXT(file_priv->master->lock.hw_lock->lock));
drm_legacy_lock_free(&file_priv->master->lock,
_DRM_LOCKING_CONTEXT(file_priv->master->lock.hw_lock->lock));
}
diff --git a/drivers/gpu/drm/drm_mode_object.c b/drivers/gpu/drm/drm_mode_object.c
index ba1608effc0f..6e5a970043fc 100644
--- a/drivers/gpu/drm/drm_mode_object.c
+++ b/drivers/gpu/drm/drm_mode_object.c
@@ -192,7 +192,8 @@ EXPORT_SYMBOL(drm_mode_object_find);
void drm_mode_object_put(struct drm_mode_object *obj)
{
if (obj->free_cb) {
- DRM_DEBUG("OBJ ID: %d (%d)\n", obj->id, kref_read(&obj->refcount));
+ drm_dbg_core(NULL, "OBJ ID: %d (%d)\n", obj->id,
+ kref_read(&obj->refcount));
kref_put(&obj->refcount, obj->free_cb);
}
}
@@ -209,7 +210,8 @@ EXPORT_SYMBOL(drm_mode_object_put);
void drm_mode_object_get(struct drm_mode_object *obj)
{
if (obj->free_cb) {
- DRM_DEBUG("OBJ ID: %d (%d)\n", obj->id, kref_read(&obj->refcount));
+ drm_dbg_core(NULL, "OBJ ID: %d (%d)\n", obj->id,
+ kref_read(&obj->refcount));
kref_get(&obj->refcount);
}
}
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index 7dfb837d1325..485ec407a115 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -85,8 +85,8 @@ static int drm_legacy_pci_irq_by_busid(struct drm_device *dev, struct drm_irq_bu
p->irq = pdev->irq;
- DRM_DEBUG("%d:%d:%d => IRQ %d\n", p->busnum, p->devnum, p->funcnum,
- p->irq);
+ drm_dbg_core(dev, "%d:%d:%d => IRQ %d\n",
+ p->busnum, p->devnum, p->funcnum, p->irq);
return 0;
}
@@ -151,12 +151,12 @@ static int drm_legacy_get_pci_dev(struct pci_dev *pdev,
struct drm_device *dev;
int ret;
- DRM_DEBUG("\n");
-
dev = drm_dev_alloc(driver, &pdev->dev);
if (IS_ERR(dev))
return PTR_ERR(dev);
+ drm_dbg_core(dev, "\n");
+
ret = pci_enable_device(pdev);
if (ret)
goto err_free;
@@ -203,7 +203,7 @@ int drm_legacy_pci_init(const struct drm_driver *driver,
const struct pci_device_id *pid;
int i;
- DRM_DEBUG("\n");
+ drm_dbg_core(NULL, "\n");
if (WARN_ON(!(driver->driver_features & DRIVER_LEGACY)))
return -EINVAL;
@@ -247,7 +247,7 @@ void drm_legacy_pci_exit(const struct drm_driver *driver,
{
struct drm_device *dev, *tmp;
- DRM_DEBUG("\n");
+ drm_dbg_core(NULL, "\n");
if (!(driver->driver_features & DRIVER_LEGACY)) {
WARN_ON(1);
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index fc11efd5e560..1e8727b7bce9 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -1260,17 +1260,19 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
switch (page_flip->flags & DRM_MODE_PAGE_FLIP_TARGET) {
case DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE:
if ((int)(target_vblank - current_vblank) > 1) {
- DRM_DEBUG("Invalid absolute flip target %u, "
- "must be <= %u\n", target_vblank,
- current_vblank + 1);
+ drm_dbg_core(dev,
+ "Invalid absolute flip target %u, "
+ "must be <= %u\n", target_vblank,
+ current_vblank + 1);
drm_crtc_vblank_put(crtc);
return -EINVAL;
}
break;
case DRM_MODE_PAGE_FLIP_TARGET_RELATIVE:
if (target_vblank != 0 && target_vblank != 1) {
- DRM_DEBUG("Invalid relative flip target %u, "
- "must be 0 or 1\n", target_vblank);
+ drm_dbg_core(dev,
+ "Invalid relative flip target %u, "
+ "must be 0 or 1\n", target_vblank);
drm_crtc_vblank_put(crtc);
return -EINVAL;
}
diff --git a/drivers/gpu/drm/drm_scatter.c b/drivers/gpu/drm/drm_scatter.c
index 5b0b2140d535..08b3eb586484 100644
--- a/drivers/gpu/drm/drm_scatter.c
+++ b/drivers/gpu/drm/drm_scatter.c
@@ -82,7 +82,7 @@ int drm_legacy_sg_alloc(struct drm_device *dev, void *data,
struct drm_sg_mem *entry;
unsigned long pages, i, j;
- DRM_DEBUG("\n");
+ drm_dbg_core(dev, "\n");
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
return -EOPNOTSUPP;
@@ -101,7 +101,7 @@ int drm_legacy_sg_alloc(struct drm_device *dev, void *data,
return -ENOMEM;
pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE;
- DRM_DEBUG("size=%ld pages=%ld\n", request->size, pages);
+ drm_dbg_core(dev, "size=%ld pages=%ld\n", request->size, pages);
entry->pages = pages;
entry->pagelist = kcalloc(pages, sizeof(*entry->pagelist), GFP_KERNEL);
@@ -132,8 +132,8 @@ int drm_legacy_sg_alloc(struct drm_device *dev, void *data,
entry->handle = ScatterHandle((unsigned long)entry->virtual);
- DRM_DEBUG("handle = %08lx\n", entry->handle);
- DRM_DEBUG("virtual = %p\n", entry->virtual);
+ drm_dbg_core(dev, "handle = %08lx\n", entry->handle);
+ drm_dbg_core(dev, "virtual = %p\n", entry->virtual);
for (i = (unsigned long)entry->virtual, j = 0; j < pages;
i += PAGE_SIZE, j++) {
@@ -213,7 +213,7 @@ int drm_legacy_sg_free(struct drm_device *dev, void *data,
if (!entry || entry->handle != request->handle)
return -EINVAL;
- DRM_DEBUG("virtual = %p\n", entry->virtual);
+ drm_dbg_core(dev, "virtual = %p\n", entry->virtual);
drm_sg_cleanup(entry);
diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
index 0c2be8360525..e84957a0f319 100644
--- a/drivers/gpu/drm/drm_syncobj.c
+++ b/drivers/gpu/drm/drm_syncobj.c
@@ -298,7 +298,7 @@ void drm_syncobj_add_point(struct drm_syncobj *syncobj,
prev = drm_syncobj_fence_get(syncobj);
/* You are adding an unorder point to timeline, which could cause payload returned from query_ioctl is 0! */
if (prev && prev->seqno >= point)
- DRM_DEBUG("You are adding an unorder point to timeline!\n");
+ drm_dbg_core(NULL, "You are adding an unorder point to timeline!\n");
dma_fence_chain_init(chain, prev, fence, point);
rcu_assign_pointer(syncobj->fence, &chain->base);
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index f62767ff34b2..b7c6754b4688 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -383,8 +383,8 @@ int drm_sysfs_connector_add(struct drm_connector *connector)
if (r)
goto err_free;
- DRM_DEBUG("adding \"%s\" to sysfs\n",
- connector->name);
+ drm_dbg_core(dev, "adding \"%s\" to sysfs\n",
+ connector->name);
r = device_add(kdev);
if (r) {
@@ -422,8 +422,8 @@ void drm_sysfs_connector_remove(struct drm_connector *connector)
if (dev_fwnode(connector->kdev))
component_del(connector->kdev, &typec_connector_ops);
- DRM_DEBUG("removing \"%s\" from sysfs\n",
- connector->name);
+ drm_dbg_core(connector->dev, "removing \"%s\" from sysfs\n",
+ connector->name);
device_unregister(connector->kdev);
connector->kdev = NULL;
@@ -434,7 +434,7 @@ void drm_sysfs_lease_event(struct drm_device *dev)
char *event_string = "LEASE=1";
char *envp[] = { event_string, NULL };
- DRM_DEBUG("generating lease event\n");
+ drm_dbg_core(dev, "generating lease event\n");
kobject_uevent_env(&dev->primary->kdev->kobj, KOBJ_CHANGE, envp);
}
@@ -455,7 +455,7 @@ void drm_sysfs_hotplug_event(struct drm_device *dev)
char *event_string = "HOTPLUG=1";
char *envp[] = { event_string, NULL };
- DRM_DEBUG("generating hotplug event\n");
+ drm_dbg_core(dev, "generating hotplug event\n");
kobject_uevent_env(&dev->primary->kdev->kobj, KOBJ_CHANGE, envp);
}
@@ -511,7 +511,7 @@ void drm_sysfs_connector_status_event(struct drm_connector *connector,
snprintf(prop_id, ARRAY_SIZE(prop_id),
"PROPERTY=%u", property->base.id);
- DRM_DEBUG("generating connector status event\n");
+ drm_dbg_core(dev, "generating connector status event\n");
kobject_uevent_env(&dev->primary->kdev->kobj, KOBJ_CHANGE, envp);
}
diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c
index 03c0a4e6e77b..966ba9e46034 100644
--- a/drivers/gpu/drm/drm_vm.c
+++ b/drivers/gpu/drm/drm_vm.c
@@ -168,12 +168,11 @@ static vm_fault_t drm_vm_fault(struct vm_fault *vmf)
get_page(page);
vmf->page = page;
- DRM_DEBUG
- ("baddr = 0x%llx page = 0x%p, offset = 0x%llx, count=%d\n",
- (unsigned long long)baddr,
- agpmem->memory->pages[offset],
- (unsigned long long)offset,
- page_count(page));
+ drm_dbg_core(dev, "baddr = 0x%llx page = 0x%p, offset = 0x%llx, count=%d\n",
+ (unsigned long long)baddr,
+ agpmem->memory->pages[offset],
+ (unsigned long long)offset,
+ page_count(page));
return 0;
}
vm_fault_error:
@@ -215,7 +214,7 @@ static vm_fault_t drm_vm_shm_fault(struct vm_fault *vmf)
get_page(page);
vmf->page = page;
- DRM_DEBUG("shm_fault 0x%lx\n", offset);
+ drm_dbg_core(NULL, "shm_fault 0x%lx\n", offset);
return 0;
}
@@ -236,8 +235,8 @@ static void drm_vm_shm_close(struct vm_area_struct *vma)
struct drm_map_list *r_list;
int found_maps = 0;
- DRM_DEBUG("0x%08lx,0x%08lx\n",
- vma->vm_start, vma->vm_end - vma->vm_start);
+ drm_dbg_core(dev, "0x%08lx,0x%08lx\n",
+ vma->vm_start, vma->vm_end - vma->vm_start);
map = vma->vm_private_data;
@@ -319,7 +318,7 @@ static vm_fault_t drm_vm_dma_fault(struct vm_fault *vmf)
get_page(page);
vmf->page = page;
- DRM_DEBUG("dma_fault 0x%lx (page %lu)\n", offset, page_nr);
+ drm_dbg_core(dev, "dma_fault 0x%lx (page %lu)\n", offset, page_nr);
return 0;
}
@@ -391,8 +390,8 @@ static void drm_vm_open_locked(struct drm_device *dev,
{
struct drm_vma_entry *vma_entry;
- DRM_DEBUG("0x%08lx,0x%08lx\n",
- vma->vm_start, vma->vm_end - vma->vm_start);
+ drm_dbg_core(dev, "0x%08lx,0x%08lx\n",
+ vma->vm_start, vma->vm_end - vma->vm_start);
vma_entry = kmalloc(sizeof(*vma_entry), GFP_KERNEL);
if (vma_entry) {
@@ -417,8 +416,8 @@ static void drm_vm_close_locked(struct drm_device *dev,
{
struct drm_vma_entry *pt, *temp;
- DRM_DEBUG("0x%08lx,0x%08lx\n",
- vma->vm_start, vma->vm_end - vma->vm_start);
+ drm_dbg_core(dev, "0x%08lx,0x%08lx\n",
+ vma->vm_start, vma->vm_end - vma->vm_start);
list_for_each_entry_safe(pt, temp, &dev->vmalist, head) {
if (pt->vma == vma) {
@@ -466,8 +465,8 @@ static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
dev = priv->minor->dev;
dma = dev->dma;
- DRM_DEBUG("start = 0x%lx, end = 0x%lx, page offset = 0x%lx\n",
- vma->vm_start, vma->vm_end, vma->vm_pgoff);
+ drm_dbg_core(dev, "start = 0x%lx, end = 0x%lx, page offset = 0x%lx\n",
+ vma->vm_start, vma->vm_end, vma->vm_pgoff);
/* Length must match exact page count */
if (!dma || (length >> PAGE_SHIFT) != dma->page_count) {
@@ -528,8 +527,8 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
resource_size_t offset = 0;
struct drm_hash_item *hash;
- DRM_DEBUG("start = 0x%lx, end = 0x%lx, page offset = 0x%lx\n",
- vma->vm_start, vma->vm_end, vma->vm_pgoff);
+ drm_dbg_core(dev, "start = 0x%lx, end = 0x%lx, page offset = 0x%lx\n",
+ vma->vm_start, vma->vm_end, vma->vm_pgoff);
if (!priv->authenticated)
return -EACCES;
@@ -600,10 +599,10 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
vma->vm_end - vma->vm_start,
vma->vm_page_prot))
return -EAGAIN;
- DRM_DEBUG(" Type = %d; start = 0x%lx, end = 0x%lx,"
- " offset = 0x%llx\n",
- map->type,
- vma->vm_start, vma->vm_end, (unsigned long long)(map->offset + offset));
+ drm_dbg_core(dev,
+ " Type = %d; start = 0x%lx, end = 0x%lx, offset = 0x%llx\n",
+ map->type, vma->vm_start, vma->vm_end,
+ (unsigned long long)(map->offset + offset));
vma->vm_ops = &drm_vm_ops;
break;
--
2.39.2
On Tue, 06 Jun 2023, Siddh Raman Pant <[email protected]> wrote:
> This patchset aims to remove usages of deprecated DRM_* macros from the
> files residing in drivers/gpu/drm root.
>
> In process, I found out that NULL as first argument of drm_dbg_* wasn't
> working, but it was listed as the alternative in deprecation comment,
> so I fixed that before removing usages of DRM_DEBUG_* macros.
>
> Courtesy discussion on v1, I added support for NULL in drm_()* macros too.
>
> Courtesy discussion on v7, I removed generic macro stuff meant to accomodate
> stuff like mipi_dsi_host, and instead reverted a commit which used the
> drm_err() macro incorrectly by passing mipi_dsi_host.
>
> This patchset should be applied in order as changes might be dependent.
>
> Please review and let me know if any errors are there, and hopefully
> this gets accepted.
FWIW,
Acked-by: Jani Nikula <[email protected]>
>
> ---
>
> v8 -> v9 (today):
> - Rebased to drm-misc-next.
>
> v7 -> v8 (28 Feb 2023):
> - Reverted 1040e424353f ("drm: mipi-dsi: Convert logging to drm_* functions.")
> which used drm_err macro incorrectly by passing mipi_dsi_host.
> - Thus, removed _Generic and allow only drm_device.
>
> v6 -> v7 (26 Feb 2023):
> - Rebased to drm-misc-next, accounting for the merger of last 3 patches
> in the previous series (4665280990fa, fc2602b553c8, 7bd224b6625a),
> and 7428ff70a18 ("drm: initialize accel framework").
>
> v5 -> v6 (09 Jan 2023):
> - Move drm_device to default case in _Generic as it is the default behaviour.
> - Fix incorrect const drm_device handling in _Generic.
> - Minor positioning / comment changes.
>
> v4 -> v5 (07 Jan 2023):
> - Make separate function instead of using boolean in _Generic (sravn on IRC).
> - Also, simplified the Generic macro, and renamed the function and macro.
>
> v3 -> v4 (05 Jan 2023):
> - Fix commit message for DRM_NOTE erroneously mentioning DRM_INFO.
> - Rebased to drm-misc-next, as 723dad977acd added drm_dbg_core() to some
> files.
> - Move Generic out to a separate macro __drm_get_dev_ptr, so that interface
> of drm_dbg_*() is also same as other drm_*() macros.
> - Fix comment in __drm_get_dev_ptr (now ___drm_get_dev_ptr) to use correct
> name.
>
> v2 -> v3 (26 Dec 2022):
> - Added support for NULL in __drm_printk and thus by extension to drm_()*.
> - Thus, converted dropped pr_()* changes to drm_*(NULL, ...).
> - Rebased to drm-misc-next and resulting appropriate changes.
>
> v1 (20 Dec 2022) -> v2 (22 Dec 2022):
> - Removed conversions to pr_*() in DRM_INFO, DRM_NOTE, and DRM_ERROR changes.
> - Due to above, DRM_NOTE usage cannot be removed and the patch is dropped.
> - DRY: NULL support is now achieved by way of a separate function.
>
> Siddh Raman Pant (8):
> Revert "drm: mipi-dsi: Convert logging to drm_* functions."
> drm/print: Fix and add support for NULL as first argument in drm_*
> macros
> drm: Remove usage of deprecated DRM_INFO
> drm: Remove usage of deprecated DRM_NOTE
> drm: Remove usage of deprecated DRM_ERROR
> drm: Remove usage of deprecated DRM_DEBUG
> drm: Remove usage of deprecated DRM_DEBUG_DRIVER
> drm: Remove usage of deprecated DRM_DEBUG_KMS
>
> drivers/gpu/drm/drm_agpsupport.c | 4 +-
> drivers/gpu/drm/drm_bridge.c | 8 +-
> drivers/gpu/drm/drm_bufs.c | 122 ++++++++++++------------
> drivers/gpu/drm/drm_client_modeset.c | 118 +++++++++++++----------
> drivers/gpu/drm/drm_color_mgmt.c | 4 +-
> drivers/gpu/drm/drm_connector.c | 28 +++---
> drivers/gpu/drm/drm_context.c | 18 ++--
> drivers/gpu/drm/drm_crtc.c | 36 ++++---
> drivers/gpu/drm/drm_crtc_helper.c | 62 ++++++------
> drivers/gpu/drm/drm_debugfs_crc.c | 8 +-
> drivers/gpu/drm/drm_displayid.c | 6 +-
> drivers/gpu/drm/drm_dma.c | 10 +-
> drivers/gpu/drm/drm_drv.c | 28 +++---
> drivers/gpu/drm/drm_edid.c | 17 ++--
> drivers/gpu/drm/drm_flip_work.c | 2 +-
> drivers/gpu/drm/drm_framebuffer.c | 3 +-
> drivers/gpu/drm/drm_gem.c | 7 +-
> drivers/gpu/drm/drm_gem_dma_helper.c | 2 +-
> drivers/gpu/drm/drm_hashtab.c | 10 +-
> drivers/gpu/drm/drm_irq.c | 4 +-
> drivers/gpu/drm/drm_kms_helper_common.c | 2 +-
> drivers/gpu/drm/drm_lease.c | 4 +-
> drivers/gpu/drm/drm_legacy_misc.c | 4 +-
> drivers/gpu/drm/drm_lock.c | 36 +++----
> drivers/gpu/drm/drm_mipi_dbi.c | 19 ++--
> drivers/gpu/drm/drm_mipi_dsi.c | 15 +--
> drivers/gpu/drm/drm_mm.c | 8 +-
> drivers/gpu/drm/drm_mode_config.c | 2 +-
> drivers/gpu/drm/drm_mode_object.c | 6 +-
> drivers/gpu/drm/drm_modes.c | 36 +++----
> drivers/gpu/drm/drm_modeset_helper.c | 2 +-
> drivers/gpu/drm/drm_pci.c | 14 +--
> drivers/gpu/drm/drm_plane.c | 46 ++++-----
> drivers/gpu/drm/drm_probe_helper.c | 39 ++++----
> drivers/gpu/drm/drm_rect.c | 4 +-
> drivers/gpu/drm/drm_scatter.c | 19 ++--
> drivers/gpu/drm/drm_syncobj.c | 2 +-
> drivers/gpu/drm/drm_sysfs.c | 22 ++---
> drivers/gpu/drm/drm_vm.c | 45 +++++----
> include/drm/drm_print.h | 81 ++++++++++------
> 40 files changed, 480 insertions(+), 423 deletions(-)
--
Jani Nikula, Intel Open Source Graphics Center
On Tue, 06 Jun 2023, Laurent Pinchart <[email protected]> wrote:
> Hi Siddh,
>
> Thank you for the patch.
>
> On Tue, Jun 06, 2023 at 04:15:15PM +0530, Siddh Raman Pant wrote:
>> This reverts commit 1040e424353f5f4d39f6f3aa8723eb3bd6ea6446.
>>
>> It used an incorrect way to use drm_* functions. Only drm_device ptrs
>> should be passed, but the mentioned commit passed mipi_dsi_host ptr.
>> It worked by accident due to macro magic.
>>
>> Reported-by: Jani Nikula <[email protected]>
>> Reviewed-by: Jani Nikula <[email protected]>
>> Signed-off-by: Siddh Raman Pant <[email protected]>
>
> Reviewed-by: Laurent Pinchart <[email protected]>
>
> Any chance we could prevent this from happening by turning the macros
> into inline functions ?
Patch 2 adds static inline struct device *__drm_dev_ptr(const struct
drm_device *drm) which should tackle this.
BR,
Jani.
>
>> ---
>> drivers/gpu/drm/drm_mipi_dsi.c | 15 ++++++++-------
>> 1 file changed, 8 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
>> index 3fd6c733ff4e..a37af4edf394 100644
>> --- a/drivers/gpu/drm/drm_mipi_dsi.c
>> +++ b/drivers/gpu/drm/drm_mipi_dsi.c
>> @@ -33,7 +33,6 @@
>>
>> #include <drm/display/drm_dsc.h>
>> #include <drm/drm_mipi_dsi.h>
>> -#include <drm/drm_print.h>
>>
>> #include <video/mipi_display.h>
>>
>> @@ -156,18 +155,19 @@ static int mipi_dsi_device_add(struct mipi_dsi_device *dsi)
>> static struct mipi_dsi_device *
>> of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct device_node *node)
>> {
>> + struct device *dev = host->dev;
>> struct mipi_dsi_device_info info = { };
>> int ret;
>> u32 reg;
>>
>> if (of_alias_from_compatible(node, info.type, sizeof(info.type)) < 0) {
>> - drm_err(host, "modalias failure on %pOF\n", node);
>> + dev_err(dev, "modalias failure on %pOF\n", node);
>> return ERR_PTR(-EINVAL);
>> }
>>
>> ret = of_property_read_u32(node, "reg", ®);
>> if (ret) {
>> - drm_err(host, "device node %pOF has no valid reg property: %d\n",
>> + dev_err(dev, "device node %pOF has no valid reg property: %d\n",
>> node, ret);
>> return ERR_PTR(-EINVAL);
>> }
>> @@ -202,21 +202,22 @@ mipi_dsi_device_register_full(struct mipi_dsi_host *host,
>> const struct mipi_dsi_device_info *info)
>> {
>> struct mipi_dsi_device *dsi;
>> + struct device *dev = host->dev;
>> int ret;
>>
>> if (!info) {
>> - drm_err(host, "invalid mipi_dsi_device_info pointer\n");
>> + dev_err(dev, "invalid mipi_dsi_device_info pointer\n");
>> return ERR_PTR(-EINVAL);
>> }
>>
>> if (info->channel > 3) {
>> - drm_err(host, "invalid virtual channel: %u\n", info->channel);
>> + dev_err(dev, "invalid virtual channel: %u\n", info->channel);
>> return ERR_PTR(-EINVAL);
>> }
>>
>> dsi = mipi_dsi_device_alloc(host);
>> if (IS_ERR(dsi)) {
>> - drm_err(host, "failed to allocate DSI device %ld\n",
>> + dev_err(dev, "failed to allocate DSI device %ld\n",
>> PTR_ERR(dsi));
>> return dsi;
>> }
>> @@ -227,7 +228,7 @@ mipi_dsi_device_register_full(struct mipi_dsi_host *host,
>>
>> ret = mipi_dsi_device_add(dsi);
>> if (ret) {
>> - drm_err(host, "failed to add DSI device %d\n", ret);
>> + dev_err(dev, "failed to add DSI device %d\n", ret);
>> kfree(dsi);
>> return ERR_PTR(ret);
>> }
>>
--
Jani Nikula, Intel Open Source Graphics Center
Hi Siddh,
Thank you for the patch.
On Tue, Jun 06, 2023 at 04:15:15PM +0530, Siddh Raman Pant wrote:
> This reverts commit 1040e424353f5f4d39f6f3aa8723eb3bd6ea6446.
>
> It used an incorrect way to use drm_* functions. Only drm_device ptrs
> should be passed, but the mentioned commit passed mipi_dsi_host ptr.
> It worked by accident due to macro magic.
>
> Reported-by: Jani Nikula <[email protected]>
> Reviewed-by: Jani Nikula <[email protected]>
> Signed-off-by: Siddh Raman Pant <[email protected]>
Reviewed-by: Laurent Pinchart <[email protected]>
Any chance we could prevent this from happening by turning the macros
into inline functions ?
> ---
> drivers/gpu/drm/drm_mipi_dsi.c | 15 ++++++++-------
> 1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
> index 3fd6c733ff4e..a37af4edf394 100644
> --- a/drivers/gpu/drm/drm_mipi_dsi.c
> +++ b/drivers/gpu/drm/drm_mipi_dsi.c
> @@ -33,7 +33,6 @@
>
> #include <drm/display/drm_dsc.h>
> #include <drm/drm_mipi_dsi.h>
> -#include <drm/drm_print.h>
>
> #include <video/mipi_display.h>
>
> @@ -156,18 +155,19 @@ static int mipi_dsi_device_add(struct mipi_dsi_device *dsi)
> static struct mipi_dsi_device *
> of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct device_node *node)
> {
> + struct device *dev = host->dev;
> struct mipi_dsi_device_info info = { };
> int ret;
> u32 reg;
>
> if (of_alias_from_compatible(node, info.type, sizeof(info.type)) < 0) {
> - drm_err(host, "modalias failure on %pOF\n", node);
> + dev_err(dev, "modalias failure on %pOF\n", node);
> return ERR_PTR(-EINVAL);
> }
>
> ret = of_property_read_u32(node, "reg", ®);
> if (ret) {
> - drm_err(host, "device node %pOF has no valid reg property: %d\n",
> + dev_err(dev, "device node %pOF has no valid reg property: %d\n",
> node, ret);
> return ERR_PTR(-EINVAL);
> }
> @@ -202,21 +202,22 @@ mipi_dsi_device_register_full(struct mipi_dsi_host *host,
> const struct mipi_dsi_device_info *info)
> {
> struct mipi_dsi_device *dsi;
> + struct device *dev = host->dev;
> int ret;
>
> if (!info) {
> - drm_err(host, "invalid mipi_dsi_device_info pointer\n");
> + dev_err(dev, "invalid mipi_dsi_device_info pointer\n");
> return ERR_PTR(-EINVAL);
> }
>
> if (info->channel > 3) {
> - drm_err(host, "invalid virtual channel: %u\n", info->channel);
> + dev_err(dev, "invalid virtual channel: %u\n", info->channel);
> return ERR_PTR(-EINVAL);
> }
>
> dsi = mipi_dsi_device_alloc(host);
> if (IS_ERR(dsi)) {
> - drm_err(host, "failed to allocate DSI device %ld\n",
> + dev_err(dev, "failed to allocate DSI device %ld\n",
> PTR_ERR(dsi));
> return dsi;
> }
> @@ -227,7 +228,7 @@ mipi_dsi_device_register_full(struct mipi_dsi_host *host,
>
> ret = mipi_dsi_device_add(dsi);
> if (ret) {
> - drm_err(host, "failed to add DSI device %d\n", ret);
> + dev_err(dev, "failed to add DSI device %d\n", ret);
> kfree(dsi);
> return ERR_PTR(ret);
> }
>
--
Regards,
Laurent Pinchart
On Tue, 06 Jun 2023 18:25:37 +0530, Laurent Pinchart wrote:
> Hi Siddh,
>
> Thank you for the patch.
Anytime :)
> Any chance we could prevent this from happening by turning the macros
> into inline functions ?
The next patch in the series almost does that, with a function introduced
as Jani mentioned. The macros will call that function, so if the argument
is not drm_device there will be error.
Thanks,
Siddh
Hi Siddh,
Thank you for the patch.
On Tue, Jun 06, 2023 at 04:15:16PM +0530, Siddh Raman Pant wrote:
> Comments say macros DRM_DEBUG_* are deprecated in favor of
> drm_dbg_*(NULL, ...), but they have broken support for it,
> as the macro will result in `(NULL) ? (NULL)->dev : NULL`.
What's the problem there ?
> Thus, fix them by separating logic to get dev ptr in a new
> function, which will return the dev ptr if arg is not NULL.
> Use it in drm_dbg_*, and also in __DRM_DEFINE_DBG_RATELIMITED,
> where a similar (but correct) NULL check was in place.
>
> Also, add support for NULL in __drm_printk, so that all the
> drm_* macros will hence support NULL as the first argument.
> This also means that deprecation comments mentioning pr_()*
> can now be changed to the drm equivalents.
>
> Signed-off-by: Siddh Raman Pant <[email protected]>
> ---
> include/drm/drm_print.h | 79 +++++++++++++++++++++++++++--------------
> 1 file changed, 52 insertions(+), 27 deletions(-)
>
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> index a93a387f8a1a..4b8532cf2ae6 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -34,6 +34,7 @@
> #include <linux/dynamic_debug.h>
>
> #include <drm/drm.h>
> +#include <drm/drm_device.h>
>
> /* Do *not* use outside of drm_print.[ch]! */
> extern unsigned long __drm_debug;
> @@ -451,9 +452,32 @@ void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
> * Prefer drm_device based logging over device or prink based logging.
> */
>
> +/* Helpers for struct drm_device based logging. */
> +
> +/**
> + * __drm_dev_ptr - Helper function to get drm->dev pointer.
> + * @drm: struct drm_device pointer.
> + *
> + * RETURNS:
> + * The struct device pointer (NULL if @drm is NULL).
> + */
> +static inline struct device *__drm_dev_ptr(const struct drm_device *drm)
> +{
> + if (drm)
> + return drm->dev;
> +
> + return NULL;
> +}
> +
> /* Helper for struct drm_device based logging. */
> #define __drm_printk(drm, level, type, fmt, ...) \
> - dev_##level##type((drm)->dev, "[drm] " fmt, ##__VA_ARGS__)
> +({ \
> + struct device *__dev_ = __drm_dev_ptr(drm); \
> + if (__dev_) \
> + dev_##level##type(__dev_, "[drm] " fmt, ##__VA_ARGS__); \
> + else \
> + pr_##level##type("[drm] " fmt, ##__VA_ARGS__); \
If I recall correctly, dev_*() handle a NULL dev pointer just fine. Do
we need to manually fall back to pr_*() ?
> +})
>
>
> #define drm_info(drm, fmt, ...) \
> @@ -487,25 +511,25 @@ void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
>
>
> #define drm_dbg_core(drm, fmt, ...) \
> - drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_CORE, fmt, ##__VA_ARGS__)
> -#define drm_dbg_driver(drm, fmt, ...) \
> - drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
> + drm_dev_dbg(__drm_dev_ptr(drm), DRM_UT_CORE, fmt, ##__VA_ARGS__)
> +#define drm_dbg_driver(drm, fmt, ...) \
> + drm_dev_dbg(__drm_dev_ptr(drm), DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
> #define drm_dbg_kms(drm, fmt, ...) \
> - drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_KMS, fmt, ##__VA_ARGS__)
> + drm_dev_dbg(__drm_dev_ptr(drm), DRM_UT_KMS, fmt, ##__VA_ARGS__)
> #define drm_dbg_prime(drm, fmt, ...) \
> - drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
> + drm_dev_dbg(__drm_dev_ptr(drm), DRM_UT_PRIME, fmt, ##__VA_ARGS__)
> #define drm_dbg_atomic(drm, fmt, ...) \
> - drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
> + drm_dev_dbg(__drm_dev_ptr(drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
> #define drm_dbg_vbl(drm, fmt, ...) \
> - drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_VBL, fmt, ##__VA_ARGS__)
> + drm_dev_dbg(__drm_dev_ptr(drm), DRM_UT_VBL, fmt, ##__VA_ARGS__)
> #define drm_dbg_state(drm, fmt, ...) \
> - drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_STATE, fmt, ##__VA_ARGS__)
> + drm_dev_dbg(__drm_dev_ptr(drm), DRM_UT_STATE, fmt, ##__VA_ARGS__)
> #define drm_dbg_lease(drm, fmt, ...) \
> - drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_LEASE, fmt, ##__VA_ARGS__)
> + drm_dev_dbg(__drm_dev_ptr(drm), DRM_UT_LEASE, fmt, ##__VA_ARGS__)
> #define drm_dbg_dp(drm, fmt, ...) \
> - drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DP, fmt, ##__VA_ARGS__)
> + drm_dev_dbg(__drm_dev_ptr(drm), DRM_UT_DP, fmt, ##__VA_ARGS__)
> #define drm_dbg_drmres(drm, fmt, ...) \
> - drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DRMRES, fmt, ##__VA_ARGS__)
> + drm_dev_dbg(__drm_dev_ptr(drm), DRM_UT_DRMRES, fmt, ##__VA_ARGS__)
>
> #define drm_dbg(drm, fmt, ...) drm_dbg_driver(drm, fmt, ##__VA_ARGS__)
>
> @@ -533,31 +557,31 @@ void __drm_err(const char *format, ...);
> #define _DRM_PRINTK(once, level, fmt, ...) \
> printk##once(KERN_##level "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
>
> -/* NOTE: this is deprecated in favor of pr_info(). */
> +/* NOTE: this is deprecated in favor of drm_info(NULL, ...). */
> #define DRM_INFO(fmt, ...) \
> _DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
> -/* NOTE: this is deprecated in favor of pr_notice(). */
> +/* NOTE: this is deprecated in favor of drm_notice(NULL, ...). */
> #define DRM_NOTE(fmt, ...) \
> _DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
> -/* NOTE: this is deprecated in favor of pr_warn(). */
> +/* NOTE: this is deprecated in favor of drm_warn(NULL, ...). */
> #define DRM_WARN(fmt, ...) \
> _DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
>
> -/* NOTE: this is deprecated in favor of pr_info_once(). */
> +/* NOTE: this is deprecated in favor of drm_info_once(NULL, ...). */
> #define DRM_INFO_ONCE(fmt, ...) \
> _DRM_PRINTK(_once, INFO, fmt, ##__VA_ARGS__)
> -/* NOTE: this is deprecated in favor of pr_notice_once(). */
> +/* NOTE: this is deprecated in favor of drm_notice_once(NULL, ...). */
> #define DRM_NOTE_ONCE(fmt, ...) \
> _DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
> -/* NOTE: this is deprecated in favor of pr_warn_once(). */
> +/* NOTE: this is deprecated in favor of drm_warn_once(NULL, ...). */
> #define DRM_WARN_ONCE(fmt, ...) \
> _DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
>
> -/* NOTE: this is deprecated in favor of pr_err(). */
> +/* NOTE: this is deprecated in favor of drm_err(NULL, ...). */
> #define DRM_ERROR(fmt, ...) \
> __drm_err(fmt, ##__VA_ARGS__)
>
> -/* NOTE: this is deprecated in favor of pr_err_ratelimited(). */
> +/* NOTE: this is deprecated in favor of drm_err_ratelimited(NULL, ...). */
> #define DRM_ERROR_RATELIMITED(fmt, ...) \
> DRM_DEV_ERROR_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
>
> @@ -593,13 +617,14 @@ void __drm_err(const char *format, ...);
> #define DRM_DEBUG_DP(fmt, ...) \
> __drm_dbg(DRM_UT_DP, fmt, ## __VA_ARGS__)
>
> -#define __DRM_DEFINE_DBG_RATELIMITED(category, drm, fmt, ...) \
> -({ \
> - static DEFINE_RATELIMIT_STATE(rs_, DEFAULT_RATELIMIT_INTERVAL, DEFAULT_RATELIMIT_BURST);\
> - const struct drm_device *drm_ = (drm); \
> - \
> - if (drm_debug_enabled(DRM_UT_ ## category) && __ratelimit(&rs_)) \
> - drm_dev_printk(drm_ ? drm_->dev : NULL, KERN_DEBUG, fmt, ## __VA_ARGS__); \
> +#define __DRM_DEFINE_DBG_RATELIMITED(category, drm, fmt, ...) \
> +({ \
> + static DEFINE_RATELIMIT_STATE(rs_, DEFAULT_RATELIMIT_INTERVAL, \
> + DEFAULT_RATELIMIT_BURST); \
> + \
> + if (drm_debug_enabled(DRM_UT_ ## category) && __ratelimit(&rs_))\
> + drm_dev_printk(__drm_dev_ptr(drm), KERN_DEBUG, \
> + fmt, ## __VA_ARGS__); \
> })
>
> #define drm_dbg_kms_ratelimited(drm, fmt, ...) \
--
Regards,
Laurent Pinchart
Hi Siddh,
Thank you for the patch.
On Tue, Jun 06, 2023 at 04:15:17PM +0530, Siddh Raman Pant wrote:
> drm_print.h says DRM_INFO is deprecated in favor of drm_info().
>
> Signed-off-by: Siddh Raman Pant <[email protected]>
> ---
> drivers/gpu/drm/drm_client_modeset.c | 2 +-
> drivers/gpu/drm/drm_connector.c | 7 ++++---
> drivers/gpu/drm/drm_drv.c | 2 +-
> drivers/gpu/drm/drm_pci.c | 2 +-
Any plan to remove it from drivers as well ? If not you should mention
in the commit message (probably in the subject line itself) that you're
only addressing the DRM core.
Same comment for further patches in this series.
> 4 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c
> index 1b12a3c201a3..ae19734974b5 100644
> --- a/drivers/gpu/drm/drm_client_modeset.c
> +++ b/drivers/gpu/drm/drm_client_modeset.c
> @@ -331,7 +331,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");
> + drm_info(dev, "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 48df7a5ea503..dca8dd4ab93f 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -168,13 +168,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));
> + drm_info(connector->dev, "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",
> + drm_info(connector->dev,
> + "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 12687dd9e1ac..02eaa4c9344d 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -943,7 +943,7 @@ 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",
> + drm_info(dev, "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",
> diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
> index 39d35fc3a43b..7dfb837d1325 100644
> --- a/drivers/gpu/drm/drm_pci.c
> +++ b/drivers/gpu/drm/drm_pci.c
> @@ -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");
> + drm_info(NULL, "Module unloaded\n");
> }
> EXPORT_SYMBOL(drm_legacy_pci_exit);
>
--
Regards,
Laurent Pinchart
On Tue, 06 Jun 2023 19:35:12 +0530, Laurent Pinchart wrote:
> Hi Siddh,
>
> Thank you for the patch.
Anytime :)
> On Tue, Jun 06, 2023 at 04:15:16PM +0530, Siddh Raman Pant wrote:
> > Comments say macros DRM_DEBUG_* are deprecated in favor of
> > drm_dbg_*(NULL, ...), but they have broken support for it,
> > as the macro will result in `(NULL) ? (NULL)->dev : NULL`.
>
> What's the problem there ?
(NULL)->dev is invalid C. It's a macro, so preprocessor substitutes
that text directly, there is no evaluation. GCC will throw an error
regarding dereferencing a void* pointer.
> > /* Helper for struct drm_device based logging. */
> > #define __drm_printk(drm, level, type, fmt, ...) \
> > - dev_##level##type((drm)->dev, "[drm] " fmt, ##__VA_ARGS__)
> > +({ \
> > + struct device *__dev_ = __drm_dev_ptr(drm); \
> > + if (__dev_) \
> > + dev_##level##type(__dev_, "[drm] " fmt, ##__VA_ARGS__); \
> > + else \
> > + pr_##level##type("[drm] " fmt, ##__VA_ARGS__); \
>
> If I recall correctly, dev_*() handle a NULL dev pointer just fine. Do
> we need to manually fall back to pr_*() ?
I took drm_dev_printk (on line 261 of drm_print.c) as the reference,
wherein it uses a conditional for determining whether dev_printk or
printk should be called.
I suppose it is to avoid printing "(NULL device *)", which dev_printk
does if it gets a NULL device pointer (refer the definition on line
4831 of drivers/base/core.c). Though if I'm wrong, kindly let me know.
Thanks,
Siddh
On Tue, 06 Jun 2023 19:53:22 +0530, Laurent Pinchart wrote:
> Hi Siddh,
>
> Thank you for the patch.
Anytime :)
> Any plan to remove it from drivers as well ? If not you should mention
> in the commit message (probably in the subject line itself) that you're
> only addressing the DRM core.
>
> Same comment for further patches in this series.
Yeah, this patch set aims to replace just in drm core (as mentioned in
the cover).
I thought "drm" would suffice since I did not specify a specific driver
like i915. So the subject line should say "drm core: ..."?
Thanks,
Siddh
Hi Siddh,
On Tue, Jun 06, 2023 at 04:15:14PM +0530, Siddh Raman Pant wrote:
> This patchset aims to remove usages of deprecated DRM_* macros from the
> files residing in drivers/gpu/drm root.
>
> In process, I found out that NULL as first argument of drm_dbg_* wasn't
> working, but it was listed as the alternative in deprecation comment,
> so I fixed that before removing usages of DRM_DEBUG_* macros.
>
> Courtesy discussion on v1, I added support for NULL in drm_()* macros too.
>
> Courtesy discussion on v7, I removed generic macro stuff meant to accomodate
> stuff like mipi_dsi_host, and instead reverted a commit which used the
> drm_err() macro incorrectly by passing mipi_dsi_host.
>
> This patchset should be applied in order as changes might be dependent.
>
> Please review and let me know if any errors are there, and hopefully
> this gets accepted.
This is a nice series, thank you for working on that.
Now that the deprecated macros are used in drivers only, would it make
sense to move them to a drm_print_deprecated.h header, to make sure no
new driver uses them ?
> ---
>
> v8 -> v9 (today):
> - Rebased to drm-misc-next.
>
> v7 -> v8 (28 Feb 2023):
> - Reverted 1040e424353f ("drm: mipi-dsi: Convert logging to drm_* functions.")
> which used drm_err macro incorrectly by passing mipi_dsi_host.
> - Thus, removed _Generic and allow only drm_device.
>
> v6 -> v7 (26 Feb 2023):
> - Rebased to drm-misc-next, accounting for the merger of last 3 patches
> in the previous series (4665280990fa, fc2602b553c8, 7bd224b6625a),
> and 7428ff70a18 ("drm: initialize accel framework").
>
> v5 -> v6 (09 Jan 2023):
> - Move drm_device to default case in _Generic as it is the default behaviour.
> - Fix incorrect const drm_device handling in _Generic.
> - Minor positioning / comment changes.
>
> v4 -> v5 (07 Jan 2023):
> - Make separate function instead of using boolean in _Generic (sravn on IRC).
> - Also, simplified the Generic macro, and renamed the function and macro.
>
> v3 -> v4 (05 Jan 2023):
> - Fix commit message for DRM_NOTE erroneously mentioning DRM_INFO.
> - Rebased to drm-misc-next, as 723dad977acd added drm_dbg_core() to some
> files.
> - Move Generic out to a separate macro __drm_get_dev_ptr, so that interface
> of drm_dbg_*() is also same as other drm_*() macros.
> - Fix comment in __drm_get_dev_ptr (now ___drm_get_dev_ptr) to use correct
> name.
>
> v2 -> v3 (26 Dec 2022):
> - Added support for NULL in __drm_printk and thus by extension to drm_()*.
> - Thus, converted dropped pr_()* changes to drm_*(NULL, ...).
> - Rebased to drm-misc-next and resulting appropriate changes.
>
> v1 (20 Dec 2022) -> v2 (22 Dec 2022):
> - Removed conversions to pr_*() in DRM_INFO, DRM_NOTE, and DRM_ERROR changes.
> - Due to above, DRM_NOTE usage cannot be removed and the patch is dropped.
> - DRY: NULL support is now achieved by way of a separate function.
>
> Siddh Raman Pant (8):
> Revert "drm: mipi-dsi: Convert logging to drm_* functions."
> drm/print: Fix and add support for NULL as first argument in drm_*
> macros
> drm: Remove usage of deprecated DRM_INFO
> drm: Remove usage of deprecated DRM_NOTE
> drm: Remove usage of deprecated DRM_ERROR
> drm: Remove usage of deprecated DRM_DEBUG
> drm: Remove usage of deprecated DRM_DEBUG_DRIVER
> drm: Remove usage of deprecated DRM_DEBUG_KMS
>
> drivers/gpu/drm/drm_agpsupport.c | 4 +-
> drivers/gpu/drm/drm_bridge.c | 8 +-
> drivers/gpu/drm/drm_bufs.c | 122 ++++++++++++------------
> drivers/gpu/drm/drm_client_modeset.c | 118 +++++++++++++----------
> drivers/gpu/drm/drm_color_mgmt.c | 4 +-
> drivers/gpu/drm/drm_connector.c | 28 +++---
> drivers/gpu/drm/drm_context.c | 18 ++--
> drivers/gpu/drm/drm_crtc.c | 36 ++++---
> drivers/gpu/drm/drm_crtc_helper.c | 62 ++++++------
> drivers/gpu/drm/drm_debugfs_crc.c | 8 +-
> drivers/gpu/drm/drm_displayid.c | 6 +-
> drivers/gpu/drm/drm_dma.c | 10 +-
> drivers/gpu/drm/drm_drv.c | 28 +++---
> drivers/gpu/drm/drm_edid.c | 17 ++--
> drivers/gpu/drm/drm_flip_work.c | 2 +-
> drivers/gpu/drm/drm_framebuffer.c | 3 +-
> drivers/gpu/drm/drm_gem.c | 7 +-
> drivers/gpu/drm/drm_gem_dma_helper.c | 2 +-
> drivers/gpu/drm/drm_hashtab.c | 10 +-
> drivers/gpu/drm/drm_irq.c | 4 +-
> drivers/gpu/drm/drm_kms_helper_common.c | 2 +-
> drivers/gpu/drm/drm_lease.c | 4 +-
> drivers/gpu/drm/drm_legacy_misc.c | 4 +-
> drivers/gpu/drm/drm_lock.c | 36 +++----
> drivers/gpu/drm/drm_mipi_dbi.c | 19 ++--
> drivers/gpu/drm/drm_mipi_dsi.c | 15 +--
> drivers/gpu/drm/drm_mm.c | 8 +-
> drivers/gpu/drm/drm_mode_config.c | 2 +-
> drivers/gpu/drm/drm_mode_object.c | 6 +-
> drivers/gpu/drm/drm_modes.c | 36 +++----
> drivers/gpu/drm/drm_modeset_helper.c | 2 +-
> drivers/gpu/drm/drm_pci.c | 14 +--
> drivers/gpu/drm/drm_plane.c | 46 ++++-----
> drivers/gpu/drm/drm_probe_helper.c | 39 ++++----
> drivers/gpu/drm/drm_rect.c | 4 +-
> drivers/gpu/drm/drm_scatter.c | 19 ++--
> drivers/gpu/drm/drm_syncobj.c | 2 +-
> drivers/gpu/drm/drm_sysfs.c | 22 ++---
> drivers/gpu/drm/drm_vm.c | 45 +++++----
> include/drm/drm_print.h | 81 ++++++++++------
> 40 files changed, 480 insertions(+), 423 deletions(-)
--
Regards,
Laurent Pinchart
Hi Siddh,
Thank you for the patch.
On Tue, Jun 06, 2023 at 04:15:20PM +0530, Siddh Raman Pant wrote:
> drm_print.h says DRM_DEBUG is deprecated in favor of drm_dbg_core().
>
> Signed-off-by: Siddh Raman Pant <[email protected]>
> ---
> drivers/gpu/drm/drm_agpsupport.c | 4 +-
> drivers/gpu/drm/drm_bufs.c | 114 +++++++++++++++---------------
> drivers/gpu/drm/drm_context.c | 14 ++--
> drivers/gpu/drm/drm_dma.c | 10 +--
> drivers/gpu/drm/drm_drv.c | 10 +--
> drivers/gpu/drm/drm_gem.c | 5 +-
> drivers/gpu/drm/drm_hashtab.c | 6 +-
> drivers/gpu/drm/drm_irq.c | 4 +-
> drivers/gpu/drm/drm_lease.c | 2 +-
> drivers/gpu/drm/drm_legacy_misc.c | 4 +-
> drivers/gpu/drm/drm_lock.c | 20 +++---
> drivers/gpu/drm/drm_mode_object.c | 6 +-
> drivers/gpu/drm/drm_pci.c | 12 ++--
> drivers/gpu/drm/drm_plane.c | 12 ++--
> drivers/gpu/drm/drm_scatter.c | 10 +--
> drivers/gpu/drm/drm_syncobj.c | 2 +-
> drivers/gpu/drm/drm_sysfs.c | 14 ++--
> drivers/gpu/drm/drm_vm.c | 43 ++++++-----
> 18 files changed, 150 insertions(+), 142 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_agpsupport.c b/drivers/gpu/drm/drm_agpsupport.c
> index a4ad6fd13abc..d27686d6e82d 100644
> --- a/drivers/gpu/drm/drm_agpsupport.c
> +++ b/drivers/gpu/drm/drm_agpsupport.c
> @@ -315,8 +315,8 @@ int drm_legacy_agp_bind(struct drm_device *dev, struct drm_agp_binding *request)
> if (retcode)
> return retcode;
> entry->bound = dev->agp->base + (page << PAGE_SHIFT);
> - DRM_DEBUG("base = 0x%lx entry->bound = 0x%lx\n",
> - dev->agp->base, entry->bound);
> + drm_dbg_core(dev, "base = 0x%lx entry->bound = 0x%lx\n",
> + dev->agp->base, entry->bound);
> return 0;
> }
> EXPORT_SYMBOL(drm_legacy_agp_bind);
> diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
> index aa66fe16ea6e..a767f51c5369 100644
> --- a/drivers/gpu/drm/drm_bufs.c
> +++ b/drivers/gpu/drm/drm_bufs.c
> @@ -171,8 +171,8 @@ static int drm_addmap_core(struct drm_device *dev, resource_size_t offset,
> kfree(map);
> return -EINVAL;
> }
> - DRM_DEBUG("offset = 0x%08llx, size = 0x%08lx, type = %d\n",
> - (unsigned long long)map->offset, map->size, map->type);
> + drm_dbg_core(dev, "offset = 0x%08llx, size = 0x%08lx, type = %d\n",
> + (unsigned long long)map->offset, map->size, map->type);
>
> /* page-align _DRM_SHM maps. They are allocated here so there is no security
> * hole created by that and it works around various broken drivers that use
> @@ -205,10 +205,10 @@ static int drm_addmap_core(struct drm_device *dev, resource_size_t offset,
> list = drm_find_matching_map(dev, map);
> if (list != NULL) {
> if (list->map->size != map->size) {
> - DRM_DEBUG("Matching maps of type %d with "
> - "mismatched sizes, (%ld vs %ld)\n",
> - map->type, map->size,
> - list->map->size);
> + drm_dbg_core(dev, "Matching maps of type %d with "
> + "mismatched sizes, (%ld vs %ld)\n",
> + map->type, map->size,
> + list->map->size);
> list->map->size = map->size;
> }
>
> @@ -239,9 +239,9 @@ static int drm_addmap_core(struct drm_device *dev, resource_size_t offset,
> list = drm_find_matching_map(dev, map);
> if (list != NULL) {
> if (list->map->size != map->size) {
> - DRM_DEBUG("Matching maps of type %d with "
> - "mismatched sizes, (%ld vs %ld)\n",
> - map->type, map->size, list->map->size);
> + drm_dbg_core(dev, "Matching maps of type %d with "
> + "mismatched sizes, (%ld vs %ld)\n",
> + map->type, map->size, list->map->size);
> list->map->size = map->size;
> }
>
> @@ -250,8 +250,8 @@ static int drm_addmap_core(struct drm_device *dev, resource_size_t offset,
> return 0;
> }
> map->handle = vmalloc_user(map->size);
> - DRM_DEBUG("%lu %d %p\n",
> - map->size, order_base_2(map->size), map->handle);
> + drm_dbg_core(dev, "%lu %d %p\n",
> + map->size, order_base_2(map->size), map->handle);
> if (!map->handle) {
> kfree(map);
> return -ENOMEM;
> @@ -308,8 +308,8 @@ static int drm_addmap_core(struct drm_device *dev, resource_size_t offset,
> kfree(map);
> return -EPERM;
> }
> - DRM_DEBUG("AGP offset = 0x%08llx, size = 0x%08lx\n",
> - (unsigned long long)map->offset, map->size);
> + drm_dbg_core(dev, "AGP offset = 0x%08llx, size = 0x%08lx\n",
> + (unsigned long long)map->offset, map->size);
>
> break;
> }
> @@ -745,13 +745,13 @@ int drm_legacy_addbufs_agp(struct drm_device *dev,
> byte_count = 0;
> agp_offset = dev->agp->base + request->agp_start;
>
> - DRM_DEBUG("count: %d\n", count);
> - DRM_DEBUG("order: %d\n", order);
> - DRM_DEBUG("size: %d\n", size);
> - DRM_DEBUG("agp_offset: %lx\n", agp_offset);
> - DRM_DEBUG("alignment: %d\n", alignment);
> - DRM_DEBUG("page_order: %d\n", page_order);
> - DRM_DEBUG("total: %d\n", total);
> + drm_dbg_core(dev, "count: %d\n", count);
> + drm_dbg_core(dev, "order: %d\n", order);
> + drm_dbg_core(dev, "size: %d\n", size);
> + drm_dbg_core(dev, "agp_offset: %lx\n", agp_offset);
> + drm_dbg_core(dev, "alignment: %d\n", alignment);
> + drm_dbg_core(dev, "page_order: %d\n", page_order);
> + drm_dbg_core(dev, "total: %d\n", total);
>
> if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
> return -EINVAL;
> @@ -766,7 +766,7 @@ int drm_legacy_addbufs_agp(struct drm_device *dev,
> }
> }
> if (!list_empty(&dev->agp->memory) && !valid) {
> - DRM_DEBUG("zone invalid\n");
> + drm_dbg_core(dev, "zone invalid\n");
> return -EINVAL;
> }
> spin_lock(&dev->buf_lock);
> @@ -829,14 +829,15 @@ int drm_legacy_addbufs_agp(struct drm_device *dev,
> return -ENOMEM;
> }
>
> - DRM_DEBUG("buffer %d @ %p\n", entry->buf_count, buf->address);
> + drm_dbg_core(dev, "buffer %d @ %p\n", entry->buf_count,
> + buf->address);
>
> offset += alignment;
> entry->buf_count++;
> byte_count += PAGE_SIZE << page_order;
> }
>
> - DRM_DEBUG("byte_count: %d\n", byte_count);
> + drm_dbg_core(dev, "byte_count: %d\n", byte_count);
>
> temp_buflist = krealloc(dma->buflist,
> (dma->buf_count + entry->buf_count) *
> @@ -859,8 +860,8 @@ int drm_legacy_addbufs_agp(struct drm_device *dev,
> dma->page_count += byte_count >> PAGE_SHIFT;
> dma->byte_count += byte_count;
>
> - DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count);
> - DRM_DEBUG("entry->buf_count : %d\n", entry->buf_count);
> + drm_dbg_core(dev, "dma->buf_count : %d\n", dma->buf_count);
> + drm_dbg_core(dev, "entry->buf_count : %d\n", entry->buf_count);
>
> mutex_unlock(&dev->struct_mutex);
>
> @@ -908,8 +909,8 @@ int drm_legacy_addbufs_pci(struct drm_device *dev,
> order = order_base_2(request->size);
> size = 1 << order;
>
> - DRM_DEBUG("count=%d, size=%d (%d), order=%d\n",
> - request->count, request->size, size, order);
> + drm_dbg_core(dev, "count=%d, size=%d (%d), order=%d\n",
> + request->count, request->size, size, order);
>
> if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
> return -EINVAL;
> @@ -971,8 +972,8 @@ int drm_legacy_addbufs_pci(struct drm_device *dev,
> }
> memcpy(temp_pagelist,
> dma->pagelist, dma->page_count * sizeof(*dma->pagelist));
> - DRM_DEBUG("pagelist: %d entries\n",
> - dma->page_count + (count << page_order));
> + drm_dbg_core(dev, "pagelist: %d entries\n",
> + dma->page_count + (count << page_order));
>
> entry->buf_size = size;
> entry->page_order = page_order;
> @@ -1011,9 +1012,9 @@ int drm_legacy_addbufs_pci(struct drm_device *dev,
> }
> entry->seglist[entry->seg_count++] = dmah;
> for (i = 0; i < (1 << page_order); i++) {
> - DRM_DEBUG("page %d @ 0x%08lx\n",
> - dma->page_count + page_count,
> - (unsigned long)dmah->vaddr + PAGE_SIZE * i);
> + drm_dbg_core(dev, "page %d @ 0x%08lx\n",
> + dma->page_count + page_count,
> + (unsigned long)dmah->vaddr + PAGE_SIZE * i);
> temp_pagelist[dma->page_count + page_count++]
> = (unsigned long)dmah->vaddr + PAGE_SIZE * i;
> }
> @@ -1047,8 +1048,8 @@ int drm_legacy_addbufs_pci(struct drm_device *dev,
> return -ENOMEM;
> }
>
> - DRM_DEBUG("buffer %d @ %p\n",
> - entry->buf_count, buf->address);
> + drm_dbg_core(dev, "buffer %d @ %p\n",
> + entry->buf_count, buf->address);
> }
> byte_count += PAGE_SIZE << page_order;
> }
> @@ -1136,13 +1137,13 @@ static int drm_legacy_addbufs_sg(struct drm_device *dev,
> byte_count = 0;
> agp_offset = request->agp_start;
>
> - DRM_DEBUG("count: %d\n", count);
> - DRM_DEBUG("order: %d\n", order);
> - DRM_DEBUG("size: %d\n", size);
> - DRM_DEBUG("agp_offset: %lu\n", agp_offset);
> - DRM_DEBUG("alignment: %d\n", alignment);
> - DRM_DEBUG("page_order: %d\n", page_order);
> - DRM_DEBUG("total: %d\n", total);
> + drm_dbg_core(dev, "count: %d\n", count);
> + drm_dbg_core(dev, "order: %d\n", order);
> + drm_dbg_core(dev, "size: %d\n", size);
> + drm_dbg_core(dev, "agp_offset: %lu\n", agp_offset);
> + drm_dbg_core(dev, "alignment: %d\n", alignment);
> + drm_dbg_core(dev, "page_order: %d\n", page_order);
> + drm_dbg_core(dev, "total: %d\n", total);
>
> if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
> return -EINVAL;
> @@ -1208,14 +1209,15 @@ static int drm_legacy_addbufs_sg(struct drm_device *dev,
> return -ENOMEM;
> }
>
> - DRM_DEBUG("buffer %d @ %p\n", entry->buf_count, buf->address);
> + drm_dbg_core(dev, "buffer %d @ %p\n", entry->buf_count,
> + buf->address);
>
> offset += alignment;
> entry->buf_count++;
> byte_count += PAGE_SIZE << page_order;
> }
>
> - DRM_DEBUG("byte_count: %d\n", byte_count);
> + drm_dbg_core(dev, "byte_count: %d\n", byte_count);
>
> temp_buflist = krealloc(dma->buflist,
> (dma->buf_count + entry->buf_count) *
> @@ -1238,8 +1240,8 @@ static int drm_legacy_addbufs_sg(struct drm_device *dev,
> dma->page_count += byte_count >> PAGE_SHIFT;
> dma->byte_count += byte_count;
>
> - DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count);
> - DRM_DEBUG("entry->buf_count : %d\n", entry->buf_count);
> + drm_dbg_core(dev, "dma->buf_count : %d\n", dma->buf_count);
> + drm_dbg_core(dev, "entry->buf_count : %d\n", entry->buf_count);
>
> mutex_unlock(&dev->struct_mutex);
>
> @@ -1340,7 +1342,7 @@ int __drm_legacy_infobufs(struct drm_device *dev,
> ++count;
> }
>
> - DRM_DEBUG("count = %d\n", count);
> + drm_dbg_core(dev, "count = %d\n", count);
>
> if (*p >= count) {
> for (i = 0, count = 0; i < DRM_MAX_ORDER + 1; i++) {
> @@ -1349,12 +1351,12 @@ int __drm_legacy_infobufs(struct drm_device *dev,
> if (from->buf_count) {
> if (f(data, count, from) < 0)
> return -EFAULT;
> - DRM_DEBUG("%d %d %d %d %d\n",
> - i,
> - dma->bufs[i].buf_count,
> - dma->bufs[i].buf_size,
> - dma->bufs[i].low_mark,
> - dma->bufs[i].high_mark);
> + drm_dbg_core(dev, "%d %d %d %d %d\n",
> + i,
> + dma->bufs[i].buf_count,
> + dma->bufs[i].buf_size,
> + dma->bufs[i].low_mark,
> + dma->bufs[i].high_mark);
> ++count;
> }
> }
> @@ -1417,8 +1419,8 @@ int drm_legacy_markbufs(struct drm_device *dev, void *data,
> if (!dma)
> return -EINVAL;
>
> - DRM_DEBUG("%d, %d, %d\n",
> - request->size, request->low_mark, request->high_mark);
> + drm_dbg_core(dev, "%d, %d, %d\n",
> + request->size, request->low_mark, request->high_mark);
> order = order_base_2(request->size);
> if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
> return -EINVAL;
> @@ -1465,7 +1467,7 @@ int drm_legacy_freebufs(struct drm_device *dev, void *data,
> if (!dma)
> return -EINVAL;
>
> - DRM_DEBUG("%d\n", request->count);
> + drm_dbg_core(dev, "%d\n", request->count);
> for (i = 0; i < request->count; i++) {
> if (copy_from_user(&idx, &request->list[i], sizeof(idx)))
> return -EFAULT;
> @@ -1565,7 +1567,7 @@ int __drm_legacy_mapbufs(struct drm_device *dev, void *data, int *p,
> }
> done:
> *p = dma->buf_count;
> - DRM_DEBUG("%d buffers, retcode = %d\n", *p, retcode);
> + drm_dbg_core(dev, "%d buffers, retcode = %d\n", *p, retcode);
>
> return retcode;
> }
> diff --git a/drivers/gpu/drm/drm_context.c b/drivers/gpu/drm/drm_context.c
> index bf1fc8bb97de..8b7b925aee97 100644
> --- a/drivers/gpu/drm/drm_context.c
> +++ b/drivers/gpu/drm/drm_context.c
> @@ -274,7 +274,7 @@ static int drm_context_switch(struct drm_device * dev, int old, int new)
> return -EBUSY;
> }
>
> - DRM_DEBUG("Context switch from %d to %d\n", old, new);
> + drm_dbg_core(dev, "Context switch from %d to %d\n", old, new);
>
> if (new == dev->last_context) {
> clear_bit(0, &dev->context_flag);
> @@ -371,9 +371,9 @@ int drm_legacy_addctx(struct drm_device *dev, void *data,
> /* Skip kernel's context and get a new one. */
> tmp_handle = drm_legacy_ctxbitmap_next(dev);
> }
> - DRM_DEBUG("%d\n", tmp_handle);
> + drm_dbg_core(dev, "%d\n", tmp_handle);
> if (tmp_handle < 0) {
> - DRM_DEBUG("Not enough free contexts.\n");
> + drm_dbg_core(dev, "Not enough free contexts.\n");
> /* Should this return -EBUSY instead? */
> return tmp_handle;
> }
> @@ -382,7 +382,7 @@ int drm_legacy_addctx(struct drm_device *dev, void *data,
>
> ctx_entry = kmalloc(sizeof(*ctx_entry), GFP_KERNEL);
> if (!ctx_entry) {
> - DRM_DEBUG("out of memory\n");
> + drm_dbg_core(dev, "out of memory\n");
This message could also be dropped.
> return -ENOMEM;
> }
>
> @@ -439,7 +439,7 @@ int drm_legacy_switchctx(struct drm_device *dev, void *data,
> if (!drm_core_check_feature(dev, DRIVER_LEGACY))
> return -EOPNOTSUPP;
>
> - DRM_DEBUG("%d\n", ctx->handle);
> + drm_dbg_core(dev, "%d\n", ctx->handle);
> return drm_context_switch(dev, dev->last_context, ctx->handle);
> }
>
> @@ -462,7 +462,7 @@ int drm_legacy_newctx(struct drm_device *dev, void *data,
> if (!drm_core_check_feature(dev, DRIVER_LEGACY))
> return -EOPNOTSUPP;
>
> - DRM_DEBUG("%d\n", ctx->handle);
> + drm_dbg_core(dev, "%d\n", ctx->handle);
> drm_context_switch_complete(dev, file_priv, ctx->handle);
>
> return 0;
> @@ -487,7 +487,7 @@ int drm_legacy_rmctx(struct drm_device *dev, void *data,
> if (!drm_core_check_feature(dev, DRIVER_LEGACY))
> return -EOPNOTSUPP;
>
> - DRM_DEBUG("%d\n", ctx->handle);
> + drm_dbg_core(dev, "%d\n", ctx->handle);
> if (ctx->handle != DRM_KERNEL_CONTEXT) {
> if (dev->driver->context_dtor)
> dev->driver->context_dtor(dev, ctx->handle);
> diff --git a/drivers/gpu/drm/drm_dma.c b/drivers/gpu/drm/drm_dma.c
> index eb6b741a6f99..dac137072c33 100644
> --- a/drivers/gpu/drm/drm_dma.c
> +++ b/drivers/gpu/drm/drm_dma.c
> @@ -94,11 +94,11 @@ void drm_legacy_dma_takedown(struct drm_device *dev)
> /* Clear dma buffers */
> for (i = 0; i <= DRM_MAX_ORDER; i++) {
> if (dma->bufs[i].seg_count) {
> - DRM_DEBUG("order %d: buf_count = %d,"
> - " seg_count = %d\n",
> - i,
> - dma->bufs[i].buf_count,
> - dma->bufs[i].seg_count);
> + drm_dbg_core(dev, "order %d: buf_count = %d,"
> + " seg_count = %d\n",
> + i,
> + dma->bufs[i].buf_count,
> + dma->bufs[i].seg_count);
> for (j = 0; j < dma->bufs[i].seg_count; j++) {
> if (dma->bufs[i].seglist[j]) {
> dmah = dma->bufs[i].seglist[j];
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 04246afc934f..7adf10cc6e67 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -166,7 +166,7 @@ static int drm_minor_register(struct drm_device *dev, unsigned int type)
> unsigned long flags;
> int ret;
>
> - DRM_DEBUG("\n");
> + drm_dbg_core(dev, "\n");
This message seems of dubious value :-) Maybe you could drop it in a
patch on top of this series ?
>
> minor = *drm_minor_get_slot(dev, type);
> if (!minor)
> @@ -195,7 +195,7 @@ static int drm_minor_register(struct drm_device *dev, unsigned int type)
> spin_unlock_irqrestore(&drm_minor_lock, flags);
> }
>
> - DRM_DEBUG("new minor registered %d\n", minor->index);
> + drm_dbg_core(dev, "new minor registered %d\n", minor->index);
> return 0;
>
> err_debugfs:
> @@ -422,7 +422,7 @@ void drm_minor_release(struct drm_minor *minor)
> */
> void drm_put_dev(struct drm_device *dev)
> {
> - DRM_DEBUG("\n");
> + drm_dbg_core(NULL, "\n");
This is even worse :-) The next two messages are also fairly useless,
they should be expanded, or dropped.
>
> if (!dev) {
> drm_err(NULL, "cleanup called no dev\n");
> @@ -1030,7 +1030,7 @@ static int drm_stub_open(struct inode *inode, struct file *filp)
> struct drm_minor *minor;
> int err;
>
> - DRM_DEBUG("\n");
> + drm_dbg_core(NULL, "\n");
>
> minor = drm_minor_acquire(iminor(inode));
> if (IS_ERR(minor))
> @@ -1099,7 +1099,7 @@ static int __init drm_core_init(void)
>
> drm_core_init_complete = true;
>
> - DRM_DEBUG("Initialized\n");
> + drm_dbg_core(NULL, "Initialized\n");
> return 0;
>
> error:
> diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
> index e0d52e69df15..3d88f0483fdf 100644
> --- a/drivers/gpu/drm/drm_gem.c
> +++ b/drivers/gpu/drm/drm_gem.c
> @@ -705,7 +705,7 @@ int drm_gem_objects_lookup(struct drm_file *filp, void __user *bo_handles,
>
> if (copy_from_user(handles, bo_handles, count * sizeof(u32))) {
> ret = -EFAULT;
> - DRM_DEBUG("Failed to copy in GEM handles\n");
> + drm_dbg_core(filp->minor->dev, "Failed to copy in GEM handles\n");
> goto out;
> }
>
> @@ -760,7 +760,8 @@ long drm_gem_dma_resv_wait(struct drm_file *filep, u32 handle,
>
> obj = drm_gem_object_lookup(filep, handle);
> if (!obj) {
> - DRM_DEBUG("Failed to look up GEM BO %d\n", handle);
> + drm_dbg_core(filep->minor->dev,
> + "Failed to look up GEM BO %d\n", handle);
> return -EINVAL;
> }
>
> diff --git a/drivers/gpu/drm/drm_hashtab.c b/drivers/gpu/drm/drm_hashtab.c
> index a1ebf8e056c7..357f20d73b43 100644
> --- a/drivers/gpu/drm/drm_hashtab.c
> +++ b/drivers/gpu/drm/drm_hashtab.c
> @@ -67,10 +67,12 @@ void drm_ht_verbose_list(struct drm_open_hash *ht, unsigned long key)
> int count = 0;
>
> hashed_key = hash_long(key, ht->order);
> - DRM_DEBUG("Key is 0x%08lx, Hashed key is 0x%08x\n", key, hashed_key);
> + drm_dbg_core(NULL, "Key is 0x%08lx, Hashed key is 0x%08x\n",
> + key, hashed_key);
> h_list = &ht->table[hashed_key];
> hlist_for_each_entry(entry, h_list, head)
> - DRM_DEBUG("count %d, key: 0x%08lx\n", count++, entry->key);
> + drm_dbg_core(NULL, "count %d, key: 0x%08lx\n",
> + count++, entry->key);
> }
>
> static struct hlist_node *drm_ht_find_key(struct drm_open_hash *ht,
> diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
> index d327638e15ee..e70d6975310c 100644
> --- a/drivers/gpu/drm/drm_irq.c
> +++ b/drivers/gpu/drm/drm_irq.c
> @@ -78,7 +78,7 @@ static int drm_legacy_irq_install(struct drm_device *dev, int irq)
> return -EBUSY;
> dev->irq_enabled = true;
>
> - DRM_DEBUG("irq=%d\n", irq);
> + drm_dbg_core(dev, "irq=%d\n", irq);
>
> /* Before installing handler */
> if (dev->driver->irq_preinstall)
> @@ -146,7 +146,7 @@ int drm_legacy_irq_uninstall(struct drm_device *dev)
> if (!irq_enabled)
> return -EINVAL;
>
> - DRM_DEBUG("irq=%d\n", dev->irq);
> + drm_dbg_core(dev, "irq=%d\n", dev->irq);
>
> if (drm_core_check_feature(dev, DRIVER_LEGACY))
> vga_client_unregister(to_pci_dev(dev->dev));
> diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c
> index 150fe1555068..af72fc38bb7c 100644
> --- a/drivers/gpu/drm/drm_lease.c
> +++ b/drivers/gpu/drm/drm_lease.c
> @@ -677,7 +677,7 @@ int drm_mode_get_lease_ioctl(struct drm_device *dev,
> count++;
> }
>
> - DRM_DEBUG("lease holds %d objects\n", count);
> + drm_dbg_core(dev, "lease holds %d objects\n", count);
> if (ret == 0)
> arg->count_objects = count;
>
> diff --git a/drivers/gpu/drm/drm_legacy_misc.c b/drivers/gpu/drm/drm_legacy_misc.c
> index d4c5434062d7..ad0eef292cb0 100644
> --- a/drivers/gpu/drm/drm_legacy_misc.c
> +++ b/drivers/gpu/drm/drm_legacy_misc.c
> @@ -70,7 +70,7 @@ int drm_legacy_setup(struct drm_device * dev)
> return ret;
>
>
> - DRM_DEBUG("\n");
> + drm_dbg_core(dev, "\n");
Ditto.
> return 0;
> }
>
> @@ -95,7 +95,7 @@ void drm_legacy_dev_reinit(struct drm_device *dev)
> dev->last_context = 0;
> dev->if_version = 0;
>
> - DRM_DEBUG("lastclose completed\n");
> + drm_dbg_core(dev, "lastclose completed\n");
> }
>
> void drm_master_legacy_init(struct drm_master *master)
> diff --git a/drivers/gpu/drm/drm_lock.c b/drivers/gpu/drm/drm_lock.c
> index 411f75a1ee14..fea573dcb016 100644
> --- a/drivers/gpu/drm/drm_lock.c
> +++ b/drivers/gpu/drm/drm_lock.c
> @@ -180,10 +180,10 @@ int drm_legacy_lock(struct drm_device *dev, void *data,
> return -EINVAL;
> }
>
> - DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n",
> - lock->context, task_pid_nr(current),
> - master->lock.hw_lock ? master->lock.hw_lock->lock : -1,
> - lock->flags);
> + drm_dbg_core(dev, "%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n",
> + lock->context, task_pid_nr(current),
> + master->lock.hw_lock ? master->lock.hw_lock->lock : -1,
> + lock->flags);
>
> add_wait_queue(&master->lock.lock_queue, &entry);
> spin_lock_bh(&master->lock.spinlock);
> @@ -219,8 +219,8 @@ int drm_legacy_lock(struct drm_device *dev, void *data,
> __set_current_state(TASK_RUNNING);
> remove_wait_queue(&master->lock.lock_queue, &entry);
>
> - DRM_DEBUG("%d %s\n", lock->context,
> - ret ? "interrupted" : "has lock");
> + drm_dbg_core(dev, "%d %s\n", lock->context,
> + ret ? "interrupted" : "has lock");
> if (ret) return ret;
>
> /* don't set the block all signals on the master process for now
> @@ -234,8 +234,8 @@ int drm_legacy_lock(struct drm_device *dev, void *data,
> if (dev->driver->dma_quiescent && (lock->flags & _DRM_LOCK_QUIESCENT))
> {
> if (dev->driver->dma_quiescent(dev)) {
> - DRM_DEBUG("%d waiting for DMA quiescent\n",
> - lock->context);
> + drm_dbg_core(dev, "%d waiting for DMA quiescent\n",
> + lock->context);
> return -EBUSY;
> }
> }
> @@ -345,8 +345,8 @@ void drm_legacy_lock_release(struct drm_device *dev, struct file *filp)
> return;
>
> if (drm_legacy_i_have_hw_lock(dev, file_priv)) {
> - DRM_DEBUG("File %p released, freeing lock for context %d\n",
> - filp, _DRM_LOCKING_CONTEXT(file_priv->master->lock.hw_lock->lock));
> + drm_dbg_core(dev, "File %p released, freeing lock for context %d\n",
> + filp, _DRM_LOCKING_CONTEXT(file_priv->master->lock.hw_lock->lock));
> drm_legacy_lock_free(&file_priv->master->lock,
> _DRM_LOCKING_CONTEXT(file_priv->master->lock.hw_lock->lock));
> }
> diff --git a/drivers/gpu/drm/drm_mode_object.c b/drivers/gpu/drm/drm_mode_object.c
> index ba1608effc0f..6e5a970043fc 100644
> --- a/drivers/gpu/drm/drm_mode_object.c
> +++ b/drivers/gpu/drm/drm_mode_object.c
> @@ -192,7 +192,8 @@ EXPORT_SYMBOL(drm_mode_object_find);
> void drm_mode_object_put(struct drm_mode_object *obj)
> {
> if (obj->free_cb) {
> - DRM_DEBUG("OBJ ID: %d (%d)\n", obj->id, kref_read(&obj->refcount));
> + drm_dbg_core(NULL, "OBJ ID: %d (%d)\n", obj->id,
> + kref_read(&obj->refcount));
> kref_put(&obj->refcount, obj->free_cb);
> }
> }
> @@ -209,7 +210,8 @@ EXPORT_SYMBOL(drm_mode_object_put);
> void drm_mode_object_get(struct drm_mode_object *obj)
> {
> if (obj->free_cb) {
> - DRM_DEBUG("OBJ ID: %d (%d)\n", obj->id, kref_read(&obj->refcount));
> + drm_dbg_core(NULL, "OBJ ID: %d (%d)\n", obj->id,
> + kref_read(&obj->refcount));
> kref_get(&obj->refcount);
> }
> }
> diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
> index 7dfb837d1325..485ec407a115 100644
> --- a/drivers/gpu/drm/drm_pci.c
> +++ b/drivers/gpu/drm/drm_pci.c
> @@ -85,8 +85,8 @@ static int drm_legacy_pci_irq_by_busid(struct drm_device *dev, struct drm_irq_bu
>
> p->irq = pdev->irq;
>
> - DRM_DEBUG("%d:%d:%d => IRQ %d\n", p->busnum, p->devnum, p->funcnum,
> - p->irq);
> + drm_dbg_core(dev, "%d:%d:%d => IRQ %d\n",
> + p->busnum, p->devnum, p->funcnum, p->irq);
> return 0;
> }
>
> @@ -151,12 +151,12 @@ static int drm_legacy_get_pci_dev(struct pci_dev *pdev,
> struct drm_device *dev;
> int ret;
>
> - DRM_DEBUG("\n");
> -
> dev = drm_dev_alloc(driver, &pdev->dev);
> if (IS_ERR(dev))
> return PTR_ERR(dev);
>
> + drm_dbg_core(dev, "\n");
> +
Same, and the two messages below too.
> ret = pci_enable_device(pdev);
> if (ret)
> goto err_free;
> @@ -203,7 +203,7 @@ int drm_legacy_pci_init(const struct drm_driver *driver,
> const struct pci_device_id *pid;
> int i;
>
> - DRM_DEBUG("\n");
> + drm_dbg_core(NULL, "\n");
>
> if (WARN_ON(!(driver->driver_features & DRIVER_LEGACY)))
> return -EINVAL;
> @@ -247,7 +247,7 @@ void drm_legacy_pci_exit(const struct drm_driver *driver,
> {
> struct drm_device *dev, *tmp;
>
> - DRM_DEBUG("\n");
> + drm_dbg_core(NULL, "\n");
>
> if (!(driver->driver_features & DRIVER_LEGACY)) {
> WARN_ON(1);
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index fc11efd5e560..1e8727b7bce9 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -1260,17 +1260,19 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
> switch (page_flip->flags & DRM_MODE_PAGE_FLIP_TARGET) {
> case DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE:
> if ((int)(target_vblank - current_vblank) > 1) {
> - DRM_DEBUG("Invalid absolute flip target %u, "
> - "must be <= %u\n", target_vblank,
> - current_vblank + 1);
> + drm_dbg_core(dev,
> + "Invalid absolute flip target %u, "
> + "must be <= %u\n", target_vblank,
> + current_vblank + 1);
> drm_crtc_vblank_put(crtc);
> return -EINVAL;
> }
> break;
> case DRM_MODE_PAGE_FLIP_TARGET_RELATIVE:
> if (target_vblank != 0 && target_vblank != 1) {
> - DRM_DEBUG("Invalid relative flip target %u, "
> - "must be 0 or 1\n", target_vblank);
> + drm_dbg_core(dev,
> + "Invalid relative flip target %u, "
> + "must be 0 or 1\n", target_vblank);
> drm_crtc_vblank_put(crtc);
> return -EINVAL;
> }
> diff --git a/drivers/gpu/drm/drm_scatter.c b/drivers/gpu/drm/drm_scatter.c
> index 5b0b2140d535..08b3eb586484 100644
> --- a/drivers/gpu/drm/drm_scatter.c
> +++ b/drivers/gpu/drm/drm_scatter.c
> @@ -82,7 +82,7 @@ int drm_legacy_sg_alloc(struct drm_device *dev, void *data,
> struct drm_sg_mem *entry;
> unsigned long pages, i, j;
>
> - DRM_DEBUG("\n");
> + drm_dbg_core(dev, "\n");
Here too.
With the commit subject fixed,
Reviewed-by: Laurent Pinchart <[email protected]>
>
> if (!drm_core_check_feature(dev, DRIVER_LEGACY))
> return -EOPNOTSUPP;
> @@ -101,7 +101,7 @@ int drm_legacy_sg_alloc(struct drm_device *dev, void *data,
> return -ENOMEM;
>
> pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE;
> - DRM_DEBUG("size=%ld pages=%ld\n", request->size, pages);
> + drm_dbg_core(dev, "size=%ld pages=%ld\n", request->size, pages);
>
> entry->pages = pages;
> entry->pagelist = kcalloc(pages, sizeof(*entry->pagelist), GFP_KERNEL);
> @@ -132,8 +132,8 @@ int drm_legacy_sg_alloc(struct drm_device *dev, void *data,
>
> entry->handle = ScatterHandle((unsigned long)entry->virtual);
>
> - DRM_DEBUG("handle = %08lx\n", entry->handle);
> - DRM_DEBUG("virtual = %p\n", entry->virtual);
> + drm_dbg_core(dev, "handle = %08lx\n", entry->handle);
> + drm_dbg_core(dev, "virtual = %p\n", entry->virtual);
>
> for (i = (unsigned long)entry->virtual, j = 0; j < pages;
> i += PAGE_SIZE, j++) {
> @@ -213,7 +213,7 @@ int drm_legacy_sg_free(struct drm_device *dev, void *data,
> if (!entry || entry->handle != request->handle)
> return -EINVAL;
>
> - DRM_DEBUG("virtual = %p\n", entry->virtual);
> + drm_dbg_core(dev, "virtual = %p\n", entry->virtual);
>
> drm_sg_cleanup(entry);
>
> diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
> index 0c2be8360525..e84957a0f319 100644
> --- a/drivers/gpu/drm/drm_syncobj.c
> +++ b/drivers/gpu/drm/drm_syncobj.c
> @@ -298,7 +298,7 @@ void drm_syncobj_add_point(struct drm_syncobj *syncobj,
> prev = drm_syncobj_fence_get(syncobj);
> /* You are adding an unorder point to timeline, which could cause payload returned from query_ioctl is 0! */
> if (prev && prev->seqno >= point)
> - DRM_DEBUG("You are adding an unorder point to timeline!\n");
> + drm_dbg_core(NULL, "You are adding an unorder point to timeline!\n");
> dma_fence_chain_init(chain, prev, fence, point);
> rcu_assign_pointer(syncobj->fence, &chain->base);
>
> diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
> index f62767ff34b2..b7c6754b4688 100644
> --- a/drivers/gpu/drm/drm_sysfs.c
> +++ b/drivers/gpu/drm/drm_sysfs.c
> @@ -383,8 +383,8 @@ int drm_sysfs_connector_add(struct drm_connector *connector)
> if (r)
> goto err_free;
>
> - DRM_DEBUG("adding \"%s\" to sysfs\n",
> - connector->name);
> + drm_dbg_core(dev, "adding \"%s\" to sysfs\n",
> + connector->name);
>
> r = device_add(kdev);
> if (r) {
> @@ -422,8 +422,8 @@ void drm_sysfs_connector_remove(struct drm_connector *connector)
> if (dev_fwnode(connector->kdev))
> component_del(connector->kdev, &typec_connector_ops);
>
> - DRM_DEBUG("removing \"%s\" from sysfs\n",
> - connector->name);
> + drm_dbg_core(connector->dev, "removing \"%s\" from sysfs\n",
> + connector->name);
>
> device_unregister(connector->kdev);
> connector->kdev = NULL;
> @@ -434,7 +434,7 @@ void drm_sysfs_lease_event(struct drm_device *dev)
> char *event_string = "LEASE=1";
> char *envp[] = { event_string, NULL };
>
> - DRM_DEBUG("generating lease event\n");
> + drm_dbg_core(dev, "generating lease event\n");
>
> kobject_uevent_env(&dev->primary->kdev->kobj, KOBJ_CHANGE, envp);
> }
> @@ -455,7 +455,7 @@ void drm_sysfs_hotplug_event(struct drm_device *dev)
> char *event_string = "HOTPLUG=1";
> char *envp[] = { event_string, NULL };
>
> - DRM_DEBUG("generating hotplug event\n");
> + drm_dbg_core(dev, "generating hotplug event\n");
>
> kobject_uevent_env(&dev->primary->kdev->kobj, KOBJ_CHANGE, envp);
> }
> @@ -511,7 +511,7 @@ void drm_sysfs_connector_status_event(struct drm_connector *connector,
> snprintf(prop_id, ARRAY_SIZE(prop_id),
> "PROPERTY=%u", property->base.id);
>
> - DRM_DEBUG("generating connector status event\n");
> + drm_dbg_core(dev, "generating connector status event\n");
>
> kobject_uevent_env(&dev->primary->kdev->kobj, KOBJ_CHANGE, envp);
> }
> diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c
> index 03c0a4e6e77b..966ba9e46034 100644
> --- a/drivers/gpu/drm/drm_vm.c
> +++ b/drivers/gpu/drm/drm_vm.c
> @@ -168,12 +168,11 @@ static vm_fault_t drm_vm_fault(struct vm_fault *vmf)
> get_page(page);
> vmf->page = page;
>
> - DRM_DEBUG
> - ("baddr = 0x%llx page = 0x%p, offset = 0x%llx, count=%d\n",
> - (unsigned long long)baddr,
> - agpmem->memory->pages[offset],
> - (unsigned long long)offset,
> - page_count(page));
> + drm_dbg_core(dev, "baddr = 0x%llx page = 0x%p, offset = 0x%llx, count=%d\n",
> + (unsigned long long)baddr,
> + agpmem->memory->pages[offset],
> + (unsigned long long)offset,
> + page_count(page));
> return 0;
> }
> vm_fault_error:
> @@ -215,7 +214,7 @@ static vm_fault_t drm_vm_shm_fault(struct vm_fault *vmf)
> get_page(page);
> vmf->page = page;
>
> - DRM_DEBUG("shm_fault 0x%lx\n", offset);
> + drm_dbg_core(NULL, "shm_fault 0x%lx\n", offset);
> return 0;
> }
>
> @@ -236,8 +235,8 @@ static void drm_vm_shm_close(struct vm_area_struct *vma)
> struct drm_map_list *r_list;
> int found_maps = 0;
>
> - DRM_DEBUG("0x%08lx,0x%08lx\n",
> - vma->vm_start, vma->vm_end - vma->vm_start);
> + drm_dbg_core(dev, "0x%08lx,0x%08lx\n",
> + vma->vm_start, vma->vm_end - vma->vm_start);
>
> map = vma->vm_private_data;
>
> @@ -319,7 +318,7 @@ static vm_fault_t drm_vm_dma_fault(struct vm_fault *vmf)
> get_page(page);
> vmf->page = page;
>
> - DRM_DEBUG("dma_fault 0x%lx (page %lu)\n", offset, page_nr);
> + drm_dbg_core(dev, "dma_fault 0x%lx (page %lu)\n", offset, page_nr);
> return 0;
> }
>
> @@ -391,8 +390,8 @@ static void drm_vm_open_locked(struct drm_device *dev,
> {
> struct drm_vma_entry *vma_entry;
>
> - DRM_DEBUG("0x%08lx,0x%08lx\n",
> - vma->vm_start, vma->vm_end - vma->vm_start);
> + drm_dbg_core(dev, "0x%08lx,0x%08lx\n",
> + vma->vm_start, vma->vm_end - vma->vm_start);
>
> vma_entry = kmalloc(sizeof(*vma_entry), GFP_KERNEL);
> if (vma_entry) {
> @@ -417,8 +416,8 @@ static void drm_vm_close_locked(struct drm_device *dev,
> {
> struct drm_vma_entry *pt, *temp;
>
> - DRM_DEBUG("0x%08lx,0x%08lx\n",
> - vma->vm_start, vma->vm_end - vma->vm_start);
> + drm_dbg_core(dev, "0x%08lx,0x%08lx\n",
> + vma->vm_start, vma->vm_end - vma->vm_start);
>
> list_for_each_entry_safe(pt, temp, &dev->vmalist, head) {
> if (pt->vma == vma) {
> @@ -466,8 +465,8 @@ static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
>
> dev = priv->minor->dev;
> dma = dev->dma;
> - DRM_DEBUG("start = 0x%lx, end = 0x%lx, page offset = 0x%lx\n",
> - vma->vm_start, vma->vm_end, vma->vm_pgoff);
> + drm_dbg_core(dev, "start = 0x%lx, end = 0x%lx, page offset = 0x%lx\n",
> + vma->vm_start, vma->vm_end, vma->vm_pgoff);
>
> /* Length must match exact page count */
> if (!dma || (length >> PAGE_SHIFT) != dma->page_count) {
> @@ -528,8 +527,8 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
> resource_size_t offset = 0;
> struct drm_hash_item *hash;
>
> - DRM_DEBUG("start = 0x%lx, end = 0x%lx, page offset = 0x%lx\n",
> - vma->vm_start, vma->vm_end, vma->vm_pgoff);
> + drm_dbg_core(dev, "start = 0x%lx, end = 0x%lx, page offset = 0x%lx\n",
> + vma->vm_start, vma->vm_end, vma->vm_pgoff);
>
> if (!priv->authenticated)
> return -EACCES;
> @@ -600,10 +599,10 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
> vma->vm_end - vma->vm_start,
> vma->vm_page_prot))
> return -EAGAIN;
> - DRM_DEBUG(" Type = %d; start = 0x%lx, end = 0x%lx,"
> - " offset = 0x%llx\n",
> - map->type,
> - vma->vm_start, vma->vm_end, (unsigned long long)(map->offset + offset));
> + drm_dbg_core(dev,
> + " Type = %d; start = 0x%lx, end = 0x%lx, offset = 0x%llx\n",
> + map->type, vma->vm_start, vma->vm_end,
> + (unsigned long long)(map->offset + offset));
>
> vma->vm_ops = &drm_vm_ops;
> break;
--
Regards,
Laurent Pinchart
On Tue, Jun 06, 2023 at 08:04:39PM +0530, Siddh Raman Pant wrote:
> On Tue, 06 Jun 2023 19:35:12 +0530, Laurent Pinchart wrote:
> > Hi Siddh,
> >
> > Thank you for the patch.
>
> Anytime :)
>
> > On Tue, Jun 06, 2023 at 04:15:16PM +0530, Siddh Raman Pant wrote:
> > > Comments say macros DRM_DEBUG_* are deprecated in favor of
> > > drm_dbg_*(NULL, ...), but they have broken support for it,
> > > as the macro will result in `(NULL) ? (NULL)->dev : NULL`.
> >
> > What's the problem there ?
>
> (NULL)->dev is invalid C. It's a macro, so preprocessor substitutes
> that text directly, there is no evaluation. GCC will throw an error
> regarding dereferencing a void* pointer.
>
> > > /* Helper for struct drm_device based logging. */
> > > #define __drm_printk(drm, level, type, fmt, ...) \
> > > - dev_##level##type((drm)->dev, "[drm] " fmt, ##__VA_ARGS__)
> > > +({ \
> > > + struct device *__dev_ = __drm_dev_ptr(drm); \
> > > + if (__dev_) \
> > > + dev_##level##type(__dev_, "[drm] " fmt, ##__VA_ARGS__); \
> > > + else \
> > > + pr_##level##type("[drm] " fmt, ##__VA_ARGS__); \
> >
> > If I recall correctly, dev_*() handle a NULL dev pointer just fine. Do
> > we need to manually fall back to pr_*() ?
>
> I took drm_dev_printk (on line 261 of drm_print.c) as the reference,
> wherein it uses a conditional for determining whether dev_printk or
> printk should be called.
>
> I suppose it is to avoid printing "(NULL device *)", which dev_printk
> does if it gets a NULL device pointer (refer the definition on line
> 4831 of drivers/base/core.c). Though if I'm wrong, kindly let me know.
You're right, it's probably best to avoid the "(NULL device *)".
Reviewed-by: Laurent Pinchart <[email protected]>
--
Regards,
Laurent Pinchart
On Tue, Jun 06, 2023 at 08:08:27PM +0530, Siddh Raman Pant wrote:
> On Tue, 06 Jun 2023 19:53:22 +0530, Laurent Pinchart wrote:
> > Hi Siddh,
> >
> > Thank you for the patch.
>
> Anytime :)
>
> > Any plan to remove it from drivers as well ? If not you should mention
> > in the commit message (probably in the subject line itself) that you're
> > only addressing the DRM core.
> >
> > Same comment for further patches in this series.
>
> Yeah, this patch set aims to replace just in drm core (as mentioned in
> the cover).
>
> I thought "drm" would suffice since I did not specify a specific driver
> like i915. So the subject line should say "drm core: ..."?
I would write
drm: Remove usage of deprecated DRM_INFO in DRM core
The "drm: " prefix doesn't imply you're touching the core only, you
could do a tree-wide change that also touches all drivers.
--
Regards,
Laurent Pinchart
Hi Siddh,
Thank you for the patch.
On Tue, Jun 06, 2023 at 04:15:22PM +0530, Siddh Raman Pant wrote:
> drm_print.h says DRM_DEBUG_KMS is deprecated in favor of
> drm_dbg_kms().
> ---
> drivers/gpu/drm/drm_client_modeset.c | 112 +++++++++++++++------------
> drivers/gpu/drm/drm_color_mgmt.c | 4 +-
> drivers/gpu/drm/drm_connector.c | 21 ++---
> drivers/gpu/drm/drm_crtc.c | 36 ++++-----
> drivers/gpu/drm/drm_crtc_helper.c | 54 ++++++-------
> drivers/gpu/drm/drm_debugfs_crc.c | 5 +-
> drivers/gpu/drm/drm_displayid.c | 4 +-
> drivers/gpu/drm/drm_edid.c | 17 ++--
> drivers/gpu/drm/drm_lease.c | 2 +-
> drivers/gpu/drm/drm_mipi_dbi.c | 7 +-
> drivers/gpu/drm/drm_modes.c | 10 +--
> drivers/gpu/drm/drm_plane.c | 32 ++++----
> drivers/gpu/drm/drm_probe_helper.c | 39 +++++-----
> drivers/gpu/drm/drm_rect.c | 4 +-
> drivers/gpu/drm/drm_sysfs.c | 8 +-
> 15 files changed, 187 insertions(+), 168 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c
> index e2403b8c6347..4e08ae688b83 100644
> --- a/drivers/gpu/drm/drm_client_modeset.c
> +++ b/drivers/gpu/drm/drm_client_modeset.c
> @@ -242,8 +242,9 @@ static void drm_client_connectors_enabled(struct drm_connector **connectors,
> for (i = 0; i < connector_count; i++) {
> connector = connectors[i];
> enabled[i] = drm_connector_enabled(connector, true);
> - DRM_DEBUG_KMS("connector %d enabled? %s\n", connector->base.id,
> - connector->display_info.non_desktop ? "non desktop" : str_yes_no(enabled[i]));
> + drm_dbg_kms(connector->dev, "connector %d enabled? %s\n",
> + connector->base.id,
> + connector->display_info.non_desktop ? "non desktop" : str_yes_no(enabled[i]));
>
> any_enabled |= enabled[i];
> }
> @@ -303,7 +304,7 @@ static bool drm_client_target_cloned(struct drm_device *dev,
> }
>
> if (can_clone) {
> - DRM_DEBUG_KMS("can clone using command line\n");
> + drm_dbg_kms(dev, "can clone using command line\n");
> return true;
> }
>
> @@ -328,7 +329,7 @@ static bool drm_client_target_cloned(struct drm_device *dev,
> }
>
> if (can_clone) {
> - DRM_DEBUG_KMS("can clone using 1024x768\n");
> + drm_dbg_kms(dev, "can clone using 1024x768\n");
> return true;
> }
> drm_info(dev, "kms: can't enable cloning when we probably wanted to.\n");
> @@ -352,8 +353,9 @@ static int drm_client_get_tile_offsets(struct drm_connector **connectors,
> continue;
>
> if (!modes[i] && (h_idx || v_idx)) {
> - DRM_DEBUG_KMS("no modes for connector tiled %d %d\n", i,
> - connector->base.id);
> + drm_dbg_kms(connector->dev,
> + "no modes for connector tiled %d %d\n",
> + i, connector->base.id);
> continue;
> }
> if (connector->tile_h_loc < h_idx)
> @@ -364,7 +366,8 @@ static int drm_client_get_tile_offsets(struct drm_connector **connectors,
> }
> offsets[idx].x = hoffset;
> offsets[idx].y = voffset;
> - DRM_DEBUG_KMS("returned %d %d for %d %d\n", hoffset, voffset, h_idx, v_idx);
> + drm_dbg_kms(NULL, "returned %d %d for %d %d\n",
> + hoffset, voffset, h_idx, v_idx);
> return 0;
> }
>
> @@ -421,14 +424,16 @@ static bool drm_client_target_preferred(struct drm_connector **connectors,
> drm_client_get_tile_offsets(connectors, connector_count, modes, offsets, i,
> connector->tile_h_loc, connector->tile_v_loc);
> }
> - DRM_DEBUG_KMS("looking for cmdline mode on connector %d\n",
> - connector->base.id);
> + drm_dbg_kms(connector->dev,
> + "looking for cmdline mode on connector %d\n",
> + connector->base.id);
>
> /* got for command line mode first */
> modes[i] = drm_connector_pick_cmdline_mode(connector);
> if (!modes[i]) {
> - DRM_DEBUG_KMS("looking for preferred mode on connector %d %d\n",
> - connector->base.id, connector->tile_group ? connector->tile_group->id : 0);
> + drm_dbg_kms(connector->dev,
> + "looking for preferred mode on connector %d %d\n",
> + connector->base.id, connector->tile_group ? connector->tile_group->id : 0);
> modes[i] = drm_connector_has_preferred_mode(connector, width, height);
> }
> /* No preferred modes, pick one off the list */
> @@ -450,16 +455,17 @@ static bool drm_client_target_preferred(struct drm_connector **connectors,
> (connector->tile_h_loc == 0 &&
> connector->tile_v_loc == 0 &&
> !drm_connector_get_tiled_mode(connector))) {
> - DRM_DEBUG_KMS("Falling back to non tiled mode on Connector %d\n",
> - connector->base.id);
> + drm_dbg_kms(connector->dev,
> + "Falling back to non tiled mode on Connector %d\n",
> + connector->base.id);
> modes[i] = drm_connector_fallback_non_tiled_mode(connector);
> } else {
> modes[i] = drm_connector_get_tiled_mode(connector);
> }
> }
>
> - DRM_DEBUG_KMS("found mode %s\n", modes[i] ? modes[i]->name :
> - "none");
> + drm_dbg_kms(connector->dev, "found mode %s\n",
> + modes[i] ? modes[i]->name : "none");
> conn_configured |= BIT_ULL(i);
> }
>
> @@ -619,15 +625,17 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
> num_connectors_detected++;
>
> if (!enabled[i]) {
> - DRM_DEBUG_KMS("connector %s not enabled, skipping\n",
> - connector->name);
> + drm_dbg_kms(connector->dev,
> + "connector %s not enabled, skipping\n",
> + connector->name);
> conn_configured |= BIT(i);
> continue;
> }
>
> if (connector->force == DRM_FORCE_OFF) {
> - DRM_DEBUG_KMS("connector %s is disabled by user, skipping\n",
> - connector->name);
> + drm_dbg_kms(connector->dev,
> + "connector %s is disabled by user, skipping\n",
> + connector->name);
> enabled[i] = false;
> continue;
> }
> @@ -637,8 +645,9 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
> if (connector->force > DRM_FORCE_OFF)
> goto bail;
>
> - DRM_DEBUG_KMS("connector %s has no encoder or crtc, skipping\n",
> - connector->name);
> + drm_dbg_kms(connector->dev,
> + "connector %s has no encoder or crtc, skipping\n",
> + connector->name);
> enabled[i] = false;
> conn_configured |= BIT(i);
> continue;
> @@ -655,28 +664,32 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
> */
> for (j = 0; j < count; j++) {
> if (crtcs[j] == new_crtc) {
> - DRM_DEBUG_KMS("fallback: cloned configuration\n");
> + drm_dbg_kms(connector->dev,
> + "fallback: cloned configuration\n");
> goto bail;
> }
> }
>
> - DRM_DEBUG_KMS("looking for cmdline mode on connector %s\n",
> - connector->name);
> + drm_dbg_kms(connector->dev,
> + "looking for cmdline mode on connector %s\n",
> + connector->name);
>
> /* go for command line mode first */
> modes[i] = drm_connector_pick_cmdline_mode(connector);
>
> /* try for preferred next */
> if (!modes[i]) {
> - DRM_DEBUG_KMS("looking for preferred mode on connector %s %d\n",
> - connector->name, connector->has_tile);
> + drm_dbg_kms(connector->dev,
> + "looking for preferred mode on connector %s %d\n",
> + connector->name, connector->has_tile);
> modes[i] = drm_connector_has_preferred_mode(connector, width, height);
> }
>
> /* No preferred mode marked by the EDID? Are there any modes? */
> if (!modes[i] && !list_empty(&connector->modes)) {
> - DRM_DEBUG_KMS("using first mode listed on connector %s\n",
> - connector->name);
> + drm_dbg_kms(connector->dev,
> + "using first mode listed on connector %s\n",
> + connector->name);
> modes[i] = list_first_entry(&connector->modes,
> struct drm_display_mode,
> head);
> @@ -695,8 +708,9 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
> * This is crtc->mode and not crtc->state->mode for the
> * fastboot check to work correctly.
> */
> - DRM_DEBUG_KMS("looking for current mode on connector %s\n",
> - connector->name);
> + drm_dbg_kms(connector->dev,
> + "looking for current mode on connector %s\n",
> + connector->name);
> modes[i] = &connector->state->crtc->mode;
> }
> /*
> @@ -705,18 +719,20 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
> */
> if (connector->has_tile &&
> num_tiled_conns < connector->num_h_tile * connector->num_v_tile) {
> - DRM_DEBUG_KMS("Falling back to non tiled mode on Connector %d\n",
> - connector->base.id);
> + drm_dbg_kms(connector->dev,
> + "Falling back to non tiled mode on Connector %d\n",
> + connector->base.id);
> modes[i] = drm_connector_fallback_non_tiled_mode(connector);
> }
> crtcs[i] = new_crtc;
>
> - DRM_DEBUG_KMS("connector %s on [CRTC:%d:%s]: %dx%d%s\n",
> - connector->name,
> - connector->state->crtc->base.id,
> - connector->state->crtc->name,
> - modes[i]->hdisplay, modes[i]->vdisplay,
> - modes[i]->flags & DRM_MODE_FLAG_INTERLACE ? "i" : "");
> + drm_dbg_kms(connector->dev,
> + "connector %s on [CRTC:%d:%s]: %dx%d%s\n",
> + connector->name,
> + connector->state->crtc->base.id,
> + connector->state->crtc->name,
> + modes[i]->hdisplay, modes[i]->vdisplay,
> + modes[i]->flags & DRM_MODE_FLAG_INTERLACE ? "i" : "");
>
> fallback = false;
> conn_configured |= BIT(i);
> @@ -732,15 +748,15 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
> */
> if (num_connectors_enabled != num_connectors_detected &&
> num_connectors_enabled < dev->mode_config.num_crtc) {
> - DRM_DEBUG_KMS("fallback: Not all outputs enabled\n");
> - DRM_DEBUG_KMS("Enabled: %i, detected: %i\n", num_connectors_enabled,
> - num_connectors_detected);
> + drm_dbg_kms(NULL, "fallback: Not all outputs enabled\n");
> + drm_dbg_kms(NULL, "Enabled: %i, detected: %i\n",
> + num_connectors_enabled, num_connectors_detected);
> fallback = true;
> }
>
> if (fallback) {
> bail:
> - DRM_DEBUG_KMS("Not using firmware configuration\n");
> + drm_dbg_kms(NULL, "Not using firmware configuration\n");
> memcpy(enabled, save_enabled, count);
> ret = false;
> }
> @@ -777,7 +793,7 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width,
> int i, ret = 0;
> bool *enabled;
>
> - DRM_DEBUG_KMS("\n");
> + drm_dbg_kms(dev, "\n");
This message is pretty useless, it could be dropped on top of this
series.
>
> if (!width)
> width = dev->mode_config.max_width;
> @@ -819,7 +835,7 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width,
> for (i = 0; i < connector_count; i++)
> total_modes_count += connectors[i]->funcs->fill_modes(connectors[i], width, height);
> if (!total_modes_count)
> - DRM_DEBUG_KMS("No connectors reported connected with modes\n");
> + drm_dbg_kms(dev, "No connectors reported connected with modes\n");
> drm_client_connectors_enabled(connectors, connector_count, enabled);
>
> if (!drm_client_firmware_config(client, connectors, connector_count, crtcs,
> @@ -834,8 +850,8 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width,
> offsets, enabled, width, height))
> drm_err(client->dev, "Unable to find initial modes\n");
>
> - DRM_DEBUG_KMS("picking CRTCs for %dx%d config\n",
> - width, height);
> + drm_dbg_kms(dev, "picking CRTCs for %dx%d config\n",
> + width, height);
>
> drm_client_pick_crtcs(client, connectors, connector_count,
> crtcs, modes, 0, width, height);
> @@ -853,8 +869,8 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width,
> struct drm_mode_set *modeset = drm_client_find_modeset(client, crtc);
> struct drm_connector *connector = connectors[i];
>
> - DRM_DEBUG_KMS("desired mode %s set on crtc %d (%d,%d)\n",
> - mode->name, crtc->base.id, offset->x, offset->y);
> + drm_dbg_kms(dev, "desired mode %s set on crtc %d (%d,%d)\n",
> + mode->name, crtc->base.id, offset->x, offset->y);
>
> if (WARN_ON_ONCE(modeset->num_connectors == DRM_CLIENT_MAX_CLONED_CONNECTORS ||
> (dev->mode_config.num_crtc > 1 && modeset->num_connectors == 1))) {
> diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c
> index d021497841b8..a2761a6ce11f 100644
> --- a/drivers/gpu/drm/drm_color_mgmt.c
> +++ b/drivers/gpu/drm/drm_color_mgmt.c
> @@ -612,7 +612,7 @@ int drm_color_lut_check(const struct drm_property_blob *lut, u32 tests)
> if (tests & DRM_COLOR_LUT_EQUAL_CHANNELS) {
> if (entry[i].red != entry[i].blue ||
> entry[i].red != entry[i].green) {
> - DRM_DEBUG_KMS("All LUT entries must have equal r/g/b\n");
> + drm_dbg_kms(NULL, "All LUT entries must have equal r/g/b\n");
> return -EINVAL;
> }
> }
> @@ -621,7 +621,7 @@ int drm_color_lut_check(const struct drm_property_blob *lut, u32 tests)
> if (entry[i].red < entry[i - 1].red ||
> entry[i].green < entry[i - 1].green ||
> entry[i].blue < entry[i - 1].blue) {
> - DRM_DEBUG_KMS("LUT entries must never decrease.\n");
> + drm_dbg_kms(NULL, "LUT entries must never decrease.\n");
> return -EINVAL;
> }
> }
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index dca8dd4ab93f..adedaf05418a 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -181,13 +181,14 @@ static void drm_connector_get_cmdline_mode(struct drm_connector *connector)
> mode->panel_orientation);
> }
>
> - DRM_DEBUG_KMS("cmdline mode for connector %s %s %dx%d@%dHz%s%s%s\n",
> - connector->name, mode->name,
> - mode->xres, mode->yres,
> - mode->refresh_specified ? mode->refresh : 60,
> - mode->rb ? " reduced blanking" : "",
> - mode->margins ? " with margins" : "",
> - mode->interlace ? " interlaced" : "");
> + drm_dbg_kms(connector->dev,
> + "cmdline mode for connector %s %s %dx%d@%dHz%s%s%s\n",
> + connector->name, mode->name,
> + mode->xres, mode->yres,
> + mode->refresh_specified ? mode->refresh : 60,
> + mode->rb ? " reduced blanking" : "",
> + mode->margins ? " with margins" : "",
> + mode->interlace ? " interlaced" : "");
> }
>
> static void drm_connector_free(struct kref *kref)
> @@ -247,9 +248,9 @@ static int __drm_connector_init(struct drm_device *dev,
> /* connector index is used with 32bit bitmasks */
> ret = ida_alloc_max(&config->connector_ida, 31, GFP_KERNEL);
> if (ret < 0) {
> - DRM_DEBUG_KMS("Failed to allocate %s connector index: %d\n",
> - drm_connector_enum_list[connector_type].name,
> - ret);
> + drm_dbg_kms(dev, "Failed to allocate %s connector index: %d\n",
> + drm_connector_enum_list[connector_type].name,
> + ret);
> goto out_put;
> }
> connector->index = ret;
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index df9bf3c9206e..adc426561e17 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -730,10 +730,10 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
>
> crtc = drm_crtc_find(dev, file_priv, crtc_req->crtc_id);
> if (!crtc) {
> - DRM_DEBUG_KMS("Unknown CRTC ID %d\n", crtc_req->crtc_id);
> + drm_dbg_kms(dev, "Unknown CRTC ID %d\n", crtc_req->crtc_id);
> return -ENOENT;
> }
> - DRM_DEBUG_KMS("[CRTC:%d:%s]\n", crtc->base.id, crtc->name);
> + drm_dbg_kms(dev, "[CRTC:%d:%s]\n", crtc->base.id, crtc->name);
>
> plane = crtc->primary;
>
> @@ -756,7 +756,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
> old_fb = plane->fb;
>
> if (!old_fb) {
> - DRM_DEBUG_KMS("CRTC doesn't have current FB\n");
> + drm_dbg_kms(dev, "CRTC doesn't have current FB\n");
> ret = -EINVAL;
> goto out;
> }
> @@ -767,8 +767,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
> } else {
> fb = drm_framebuffer_lookup(dev, file_priv, crtc_req->fb_id);
> if (!fb) {
> - DRM_DEBUG_KMS("Unknown FB ID%d\n",
> - crtc_req->fb_id);
> + drm_dbg_kms(dev, "Unknown FB ID%d\n", crtc_req->fb_id);
> ret = -ENOENT;
> goto out;
> }
> @@ -781,7 +780,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
> }
> if (!file_priv->aspect_ratio_allowed &&
> (crtc_req->mode.flags & DRM_MODE_FLAG_PIC_AR_MASK) != DRM_MODE_FLAG_PIC_AR_NONE) {
> - DRM_DEBUG_KMS("Unexpected aspect-ratio flag bits\n");
> + drm_dbg_kms(dev, "Unexpected aspect-ratio flag bits\n");
> ret = -EINVAL;
> goto out;
> }
> @@ -789,8 +788,8 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
>
> ret = drm_mode_convert_umode(dev, mode, &crtc_req->mode);
> if (ret) {
> - DRM_DEBUG_KMS("Invalid mode (ret=%d, status=%s)\n",
> - ret, drm_get_mode_status_name(mode->status));
> + drm_dbg_kms(dev, "Invalid mode (ret=%d, status=%s)\n",
> + ret, drm_get_mode_status_name(mode->status));
> drm_mode_debug_printmodeline(mode);
> goto out;
> }
> @@ -807,9 +806,8 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
> fb->format->format,
> fb->modifier);
> if (ret) {
> - DRM_DEBUG_KMS("Invalid pixel format %p4cc, modifier 0x%llx\n",
> - &fb->format->format,
> - fb->modifier);
> + drm_dbg_kms(dev, "Invalid pixel format %p4cc, modifier 0x%llx\n",
> + &fb->format->format, fb->modifier);
> goto out;
> }
> }
> @@ -822,14 +820,14 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
> }
>
> if (crtc_req->count_connectors == 0 && mode) {
> - DRM_DEBUG_KMS("Count connectors is 0 but mode set\n");
> + drm_dbg_kms(dev, "Count connectors is 0 but mode set\n");
> ret = -EINVAL;
> goto out;
> }
>
> if (crtc_req->count_connectors > 0 && (!mode || !fb)) {
> - DRM_DEBUG_KMS("Count connectors is %d but no mode or fb set\n",
> - crtc_req->count_connectors);
> + drm_dbg_kms(dev, "Count connectors is %d but no mode or fb set\n",
> + crtc_req->count_connectors);
> ret = -EINVAL;
> goto out;
> }
> @@ -861,14 +859,14 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
>
> connector = drm_connector_lookup(dev, file_priv, out_id);
> if (!connector) {
> - DRM_DEBUG_KMS("Connector id %d unknown\n",
> - out_id);
> + drm_dbg_kms(dev, "Connector id %d unknown\n",
> + out_id);
> ret = -ENOENT;
> goto out;
> }
> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
> - connector->base.id,
> - connector->name);
> + drm_dbg_kms(dev, "[CONNECTOR:%d:%s]\n",
> + connector->base.id,
> + connector->name);
>
> connector_set[i] = connector;
> }
> diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
> index b74b4301a471..59e7b86eab93 100644
> --- a/drivers/gpu/drm/drm_crtc_helper.c
> +++ b/drivers/gpu/drm/drm_crtc_helper.c
> @@ -338,7 +338,7 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
> if (encoder_funcs->mode_fixup) {
> if (!(ret = encoder_funcs->mode_fixup(encoder, mode,
> adjusted_mode))) {
> - DRM_DEBUG_KMS("Encoder fixup failed\n");
> + drm_dbg_kms(dev, "Encoder fixup failed\n");
> goto done;
> }
> }
> @@ -347,11 +347,11 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
> if (crtc_funcs->mode_fixup) {
> if (!(ret = crtc_funcs->mode_fixup(crtc, mode,
> adjusted_mode))) {
> - DRM_DEBUG_KMS("CRTC fixup failed\n");
> + drm_dbg_kms(dev, "CRTC fixup failed\n");
> goto done;
> }
> }
> - DRM_DEBUG_KMS("[CRTC:%d:%s]\n", crtc->base.id, crtc->name);
> + drm_dbg_kms(dev, "[CRTC:%d:%s]\n", crtc->base.id, crtc->name);
>
> drm_mode_copy(&crtc->hwmode, adjusted_mode);
>
> @@ -390,8 +390,8 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
> if (!encoder_funcs)
> continue;
>
> - DRM_DEBUG_KMS("[ENCODER:%d:%s] set [MODE:%s]\n",
> - encoder->base.id, encoder->name, mode->name);
> + drm_dbg_kms(dev, "[ENCODER:%d:%s] set [MODE:%s]\n",
> + encoder->base.id, encoder->name, mode->name);
> if (encoder_funcs->mode_set)
> encoder_funcs->mode_set(encoder, mode, adjusted_mode);
> }
> @@ -567,7 +567,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
> int ret;
> int i;
>
> - DRM_DEBUG_KMS("\n");
> + drm_dbg_kms(NULL, "\n");
Same.
>
> BUG_ON(!set);
> BUG_ON(!set->crtc);
> @@ -586,13 +586,13 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
> set->fb = NULL;
>
> if (set->fb) {
> - DRM_DEBUG_KMS("[CRTC:%d:%s] [FB:%d] #connectors=%d (x y) (%i %i)\n",
> - set->crtc->base.id, set->crtc->name,
> - set->fb->base.id,
> - (int)set->num_connectors, set->x, set->y);
> + drm_dbg_kms(dev, "[CRTC:%d:%s] [FB:%d] #connectors=%d (x y) (%i %i)\n",
> + set->crtc->base.id, set->crtc->name,
> + set->fb->base.id,
> + (int)set->num_connectors, set->x, set->y);
> } else {
> - DRM_DEBUG_KMS("[CRTC:%d:%s] [NOFB]\n",
> - set->crtc->base.id, set->crtc->name);
> + drm_dbg_kms(dev, "[CRTC:%d:%s] [NOFB]\n",
> + set->crtc->base.id, set->crtc->name);
> drm_crtc_helper_disable(set->crtc);
> return 0;
> }
> @@ -642,7 +642,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
> if (set->crtc->primary->fb != set->fb) {
> /* If we have no fb then treat it as a full mode set */
> if (set->crtc->primary->fb == NULL) {
> - DRM_DEBUG_KMS("crtc has no fb, full mode set\n");
> + drm_dbg_kms(dev, "crtc has no fb, full mode set\n");
> mode_changed = true;
> } else if (set->fb->format != set->crtc->primary->fb->format) {
> mode_changed = true;
> @@ -654,7 +654,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
> fb_changed = true;
>
> if (!drm_mode_equal(set->mode, &set->crtc->mode)) {
> - DRM_DEBUG_KMS("modes are different, full mode set\n");
> + drm_dbg_kms(dev, "modes are different, full mode set\n");
> drm_mode_debug_printmodeline(&set->crtc->mode);
> drm_mode_debug_printmodeline(set->mode);
> mode_changed = true;
> @@ -690,7 +690,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
> fail = 1;
>
> if (connector->dpms != DRM_MODE_DPMS_ON) {
> - DRM_DEBUG_KMS("connector dpms not on, full mode switch\n");
> + drm_dbg_kms(dev, "connector dpms not on, full mode switch\n");
> mode_changed = true;
> }
>
> @@ -699,7 +699,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
> }
>
> if (new_encoder != connector->encoder) {
> - DRM_DEBUG_KMS("encoder changed, full mode switch\n");
> + drm_dbg_kms(dev, "encoder changed, full mode switch\n");
> mode_changed = true;
> /* If the encoder is reused for another connector, then
> * the appropriate crtc will be set later.
> @@ -740,17 +740,17 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
> goto fail;
> }
> if (new_crtc != connector->encoder->crtc) {
> - DRM_DEBUG_KMS("crtc changed, full mode switch\n");
> + drm_dbg_kms(dev, "crtc changed, full mode switch\n");
> mode_changed = true;
> connector->encoder->crtc = new_crtc;
> }
> if (new_crtc) {
> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s] to [CRTC:%d:%s]\n",
> - connector->base.id, connector->name,
> - new_crtc->base.id, new_crtc->name);
> + drm_dbg_kms(dev, "[CONNECTOR:%d:%s] to [CRTC:%d:%s]\n",
> + connector->base.id, connector->name,
> + new_crtc->base.id, new_crtc->name);
> } else {
> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s] to [NOCRTC]\n",
> - connector->base.id, connector->name);
> + drm_dbg_kms(dev, "[CONNECTOR:%d:%s] to [NOCRTC]\n",
> + connector->base.id, connector->name);
> }
> }
> drm_connector_list_iter_end(&conn_iter);
> @@ -761,8 +761,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
>
> if (mode_changed) {
> if (drm_helper_crtc_in_use(set->crtc)) {
> - DRM_DEBUG_KMS("attempting to set mode from"
> - " userspace\n");
> + drm_dbg_kms(dev, "attempting to set mode from userspace\n");
> drm_mode_debug_printmodeline(set->mode);
> set->crtc->primary->fb = set->fb;
> if (!drm_crtc_helper_set_mode(set->crtc, set->mode,
> @@ -774,10 +773,11 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
> ret = -EINVAL;
> goto fail;
> }
> - DRM_DEBUG_KMS("Setting connector DPMS state to on\n");
> + drm_dbg_kms(dev, "Setting connector DPMS state to on\n");
> for (i = 0; i < set->num_connectors; i++) {
> - DRM_DEBUG_KMS("\t[CONNECTOR:%d:%s] set DPMS on\n", set->connectors[i]->base.id,
> - set->connectors[i]->name);
> + drm_dbg_kms(dev, "\t[CONNECTOR:%d:%s] set DPMS on\n",
> + set->connectors[i]->base.id,
> + set->connectors[i]->name);
> set->connectors[i]->funcs->dpms(set->connectors[i], DRM_MODE_DPMS_ON);
> }
> }
> diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c
> index a59ef3f0e4a1..f29d286f4760 100644
> --- a/drivers/gpu/drm/drm_debugfs_crc.c
> +++ b/drivers/gpu/drm/drm_debugfs_crc.c
> @@ -131,8 +131,9 @@ static ssize_t crc_control_write(struct file *file, const char __user *ubuf,
> return 0;
>
> if (len > PAGE_SIZE - 1) {
> - DRM_DEBUG_KMS("Expected < %lu bytes into crtc crc control\n",
> - PAGE_SIZE);
> + drm_dbg_kms(crtc->dev,
> + "Expected < %lu bytes into crtc crc control\n",
> + PAGE_SIZE);
> return -E2BIG;
> }
>
> diff --git a/drivers/gpu/drm/drm_displayid.c b/drivers/gpu/drm/drm_displayid.c
> index 27ffeee09e4f..7e591bc0883f 100644
> --- a/drivers/gpu/drm/drm_displayid.c
> +++ b/drivers/gpu/drm/drm_displayid.c
> @@ -31,8 +31,8 @@ validate_displayid(const u8 *displayid, int length, int idx)
> if (IS_ERR(base))
> return base;
>
> - DRM_DEBUG_KMS("base revision 0x%x, length %d, %d %d\n",
> - base->rev, base->bytes, base->prod_id, base->ext_count);
> + drm_dbg_kms(NULL, "base revision 0x%x, length %d, %d %d\n",
> + base->rev, base->bytes, base->prod_id, base->ext_count);
>
> /* +1 for DispID checksum */
> dispid_length = sizeof(*base) + base->bytes + 1;
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 0454da505687..791152c4afd4 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -1986,7 +1986,7 @@ bool drm_edid_block_valid(u8 *_block, int block_num, bool print_bad_edid,
>
> status = edid_block_check(block, is_base_block);
> if (status == EDID_BLOCK_HEADER_REPAIR) {
> - DRM_DEBUG_KMS("Fixing EDID header, your hardware may be failing\n");
> + drm_dbg_kms(NULL, "Fixing EDID header, your hardware may be failing\n");
> edid_header_fix(block);
>
> /* Retry with fixed header, update status if that worked. */
> @@ -2172,8 +2172,9 @@ drm_do_probe_ddc_edid(void *data, u8 *buf, unsigned int block, size_t len)
> ret = i2c_transfer(adapter, &msgs[3 - xfers], xfers);
>
> if (ret == -ENXIO) {
> - DRM_DEBUG_KMS("drm: skipping non-existent adapter %s\n",
> - adapter->name);
> + drm_dbg_kms(NULL,
> + "drm: skipping non-existent adapter %s\n",
> + adapter->name);
> break;
> }
> } while (ret != xfers && --retries);
> @@ -5589,7 +5590,7 @@ static int _drm_edid_to_sad(const struct drm_edid *drm_edid,
> }
> cea_db_iter_end(&iter);
>
> - DRM_DEBUG_KMS("Found %d Short Audio Descriptors\n", count);
> + drm_dbg_kms(NULL, "Found %d Short Audio Descriptors\n", count);
>
> return count;
> }
> @@ -5634,7 +5635,7 @@ static int _drm_edid_to_speaker_allocation(const struct drm_edid *drm_edid,
> }
> cea_db_iter_end(&iter);
>
> - DRM_DEBUG_KMS("Found %d Speaker Allocation Data Blocks\n", count);
> + drm_dbg_kms(NULL, "Found %d Speaker Allocation Data Blocks\n", count);
>
> return count;
> }
> @@ -5761,7 +5762,7 @@ static bool _drm_detect_monitor_audio(const struct drm_edid *drm_edid)
> drm_edid_iter_end(&edid_iter);
>
> if (has_audio) {
> - DRM_DEBUG_KMS("Monitor has basic audio support\n");
> + drm_dbg_kms(NULL, "Monitor has basic audio support\n");
> goto end;
> }
>
> @@ -5772,8 +5773,8 @@ static bool _drm_detect_monitor_audio(const struct drm_edid *drm_edid)
> int i;
>
> for (i = 0; i < cea_db_payload_len(db); i += 3)
> - DRM_DEBUG_KMS("CEA audio format %d\n",
> - (data[i] >> 3) & 0xf);
> + drm_dbg_kms(NULL, "CEA audio format %d\n",
> + (data[i] >> 3) & 0xf);
> has_audio = true;
> break;
> }
> diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c
> index af72fc38bb7c..c1b8717b5794 100644
> --- a/drivers/gpu/drm/drm_lease.c
> +++ b/drivers/gpu/drm/drm_lease.c
> @@ -403,7 +403,7 @@ static int fill_object_idr(struct drm_device *dev,
> }
>
> if (!drm_mode_object_lease_required(objects[o]->type)) {
> - DRM_DEBUG_KMS("invalid object for lease\n");
> + drm_dbg_kms(dev, "invalid object for lease\n");
> ret = -EINVAL;
> goto out_free_objects;
> }
> diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c
> index ab5dd5933a1a..793fdd7da1d0 100644
> --- a/drivers/gpu/drm/drm_mipi_dbi.c
> +++ b/drivers/gpu/drm/drm_mipi_dbi.c
> @@ -265,7 +265,8 @@ static void mipi_dbi_fb_dirty(struct iosys_map *src, struct drm_framebuffer *fb,
>
> full = width == fb->width && height == fb->height;
>
> - DRM_DEBUG_KMS("Flushing [FB:%d] " DRM_RECT_FMT "\n", fb->base.id, DRM_RECT_ARG(rect));
> + drm_dbg_kms(fb->dev, "Flushing [FB:%d] " DRM_RECT_FMT "\n",
> + fb->base.id, DRM_RECT_ARG(rect));
>
> if (!dbi->dc || !full || swap ||
> fb->format->format == DRM_FORMAT_XRGB8888) {
> @@ -408,7 +409,7 @@ void mipi_dbi_pipe_disable(struct drm_simple_display_pipe *pipe)
> {
> struct mipi_dbi_dev *dbidev = drm_to_mipi_dbi_dev(pipe->crtc.dev);
>
> - DRM_DEBUG_KMS("\n");
> + drm_dbg_kms(&dbidev->drm, "\n");
Same.
With the commit subject fixed,
Reviewed-by: Laurent Pinchart <[email protected]>
>
> if (dbidev->backlight)
> backlight_disable(dbidev->backlight);
> @@ -627,7 +628,7 @@ int mipi_dbi_dev_init_with_formats(struct mipi_dbi_dev *dbidev,
> drm->mode_config.max_height = dbidev->mode.vdisplay;
> dbidev->rotation = rotation;
>
> - DRM_DEBUG_KMS("rotation = %u\n", rotation);
> + drm_dbg_kms(drm, "rotation = %u\n", rotation);
>
> return 0;
> }
> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> index f5171bf91eae..440e3b015cc6 100644
> --- a/drivers/gpu/drm/drm_modes.c
> +++ b/drivers/gpu/drm/drm_modes.c
> @@ -53,11 +53,11 @@
> * drm_mode_debug_printmodeline - print a mode to dmesg
> * @mode: mode to print
> *
> - * Describe @mode using DRM_DEBUG.
> + * Describe @mode using drm_dbg_kms().
> */
> void drm_mode_debug_printmodeline(const struct drm_display_mode *mode)
> {
> - DRM_DEBUG_KMS("Modeline " DRM_MODE_FMT "\n", DRM_MODE_ARG(mode));
> + drm_dbg_kms(NULL, "Modeline " DRM_MODE_FMT "\n", DRM_MODE_ARG(mode));
> }
> EXPORT_SYMBOL(drm_mode_debug_printmodeline);
>
> @@ -1813,9 +1813,9 @@ void drm_mode_prune_invalid(struct drm_device *dev,
> }
> if (verbose) {
> drm_mode_debug_printmodeline(mode);
> - DRM_DEBUG_KMS("Not using %s mode: %s\n",
> - mode->name,
> - drm_get_mode_status_name(mode->status));
> + drm_dbg_kms(dev, "Not using %s mode: %s\n",
> + mode->name,
> + drm_get_mode_status_name(mode->status));
> }
> drm_mode_destroy(dev, mode);
> }
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index 1e8727b7bce9..12fed5f812a1 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -275,7 +275,7 @@ static int __drm_universal_plane_init(struct drm_device *dev,
> plane->format_types = kmalloc_array(format_count, sizeof(uint32_t),
> GFP_KERNEL);
> if (!plane->format_types) {
> - DRM_DEBUG_KMS("out of memory when allocating plane\n");
> + drm_dbg_kms(dev, "out of memory when allocating plane\n");
> drm_mode_object_unregister(dev, &plane->base);
> return -ENOMEM;
> }
> @@ -302,7 +302,7 @@ static int __drm_universal_plane_init(struct drm_device *dev,
> GFP_KERNEL);
>
> if (format_modifier_count && !plane->modifiers) {
> - DRM_DEBUG_KMS("out of memory when allocating plane\n");
> + drm_dbg_kms(dev, "out of memory when allocating plane\n");
> kfree(plane->format_types);
> drm_mode_object_unregister(dev, &plane->base);
> return -ENOMEM;
> @@ -786,7 +786,7 @@ static int __setplane_check(struct drm_plane *plane,
>
> /* Check whether this plane is usable on this CRTC */
> if (!(plane->possible_crtcs & drm_crtc_mask(crtc))) {
> - DRM_DEBUG_KMS("Invalid crtc for plane\n");
> + drm_dbg_kms(plane->dev, "Invalid crtc for plane\n");
> return -EINVAL;
> }
>
> @@ -794,8 +794,9 @@ static int __setplane_check(struct drm_plane *plane,
> ret = drm_plane_check_pixel_format(plane, fb->format->format,
> fb->modifier);
> if (ret) {
> - DRM_DEBUG_KMS("Invalid pixel format %p4cc, modifier 0x%llx\n",
> - &fb->format->format, fb->modifier);
> + drm_dbg_kms(fb->dev,
> + "Invalid pixel format %p4cc, modifier 0x%llx\n",
> + &fb->format->format, fb->modifier);
> return ret;
> }
>
> @@ -804,8 +805,8 @@ static int __setplane_check(struct drm_plane *plane,
> crtc_x > INT_MAX - (int32_t) crtc_w ||
> crtc_h > INT_MAX ||
> crtc_y > INT_MAX - (int32_t) crtc_h) {
> - DRM_DEBUG_KMS("Invalid CRTC coordinates %ux%u+%d+%d\n",
> - crtc_w, crtc_h, crtc_x, crtc_y);
> + drm_dbg_kms(crtc->dev, "Invalid CRTC coordinates %ux%u+%d+%d\n",
> + crtc_w, crtc_h, crtc_x, crtc_y);
> return -ERANGE;
> }
>
> @@ -982,24 +983,23 @@ int drm_mode_setplane(struct drm_device *dev, void *data,
> */
> plane = drm_plane_find(dev, file_priv, plane_req->plane_id);
> if (!plane) {
> - DRM_DEBUG_KMS("Unknown plane ID %d\n",
> - plane_req->plane_id);
> + drm_dbg_kms(dev, "Unknown plane ID %d\n", plane_req->plane_id);
> return -ENOENT;
> }
>
> if (plane_req->fb_id) {
> fb = drm_framebuffer_lookup(dev, file_priv, plane_req->fb_id);
> if (!fb) {
> - DRM_DEBUG_KMS("Unknown framebuffer ID %d\n",
> - plane_req->fb_id);
> + drm_dbg_kms(dev, "Unknown framebuffer ID %d\n",
> + plane_req->fb_id);
> return -ENOENT;
> }
>
> crtc = drm_crtc_find(dev, file_priv, plane_req->crtc_id);
> if (!crtc) {
> drm_framebuffer_put(fb);
> - DRM_DEBUG_KMS("Unknown crtc ID %d\n",
> - plane_req->crtc_id);
> + drm_dbg_kms(dev, "Unknown crtc ID %d\n",
> + plane_req->crtc_id);
> return -ENOENT;
> }
> }
> @@ -1048,7 +1048,7 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc,
> if (req->handle) {
> fb = drm_internal_framebuffer_create(dev, &fbreq, file_priv);
> if (IS_ERR(fb)) {
> - DRM_DEBUG_KMS("failed to wrap cursor buffer in drm framebuffer\n");
> + drm_dbg_kms(dev, "failed to wrap cursor buffer in drm framebuffer\n");
> return PTR_ERR(fb);
> }
>
> @@ -1119,7 +1119,7 @@ static int drm_mode_cursor_common(struct drm_device *dev,
>
> crtc = drm_crtc_find(dev, file_priv, req->crtc_id);
> if (!crtc) {
> - DRM_DEBUG_KMS("Unknown CRTC ID %d\n", req->crtc_id);
> + drm_dbg_kms(dev, "Unknown CRTC ID %d\n", req->crtc_id);
> return -ENOENT;
> }
>
> @@ -1340,7 +1340,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
> * to modifier changes.
> */
> if (old_fb->format->format != fb->format->format) {
> - DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
> + drm_dbg_kms(dev, "Page flip is not allowed to change frame buffer format.\n");
> ret = -EINVAL;
> goto out;
> }
> diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
> index 2fb9bf901a2c..6cdaf84735cd 100644
> --- a/drivers/gpu/drm/drm_probe_helper.c
> +++ b/drivers/gpu/drm/drm_probe_helper.c
> @@ -532,8 +532,8 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
>
> drm_modeset_acquire_init(&ctx, 0);
>
> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id,
> - connector->name);
> + drm_dbg_kms(dev, "[CONNECTOR:%d:%s]\n", connector->base.id,
> + connector->name);
>
> retry:
> ret = drm_modeset_lock(&dev->mode_config.connection_mutex, &ctx);
> @@ -576,11 +576,12 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
> * check here, and if anything changed start the hotplug code.
> */
> if (old_status != connector->status) {
> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to %s\n",
> - connector->base.id,
> - connector->name,
> - drm_get_connector_status_name(old_status),
> - drm_get_connector_status_name(connector->status));
> + drm_dbg_kms(dev,
> + "[CONNECTOR:%d:%s] status updated from %s to %s\n",
> + connector->base.id,
> + connector->name,
> + drm_get_connector_status_name(old_status),
> + drm_get_connector_status_name(connector->status));
>
> /*
> * The hotplug event code might call into the fb
> @@ -599,8 +600,8 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
> drm_kms_helper_poll_enable(dev);
>
> if (connector->status == connector_status_disconnected) {
> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s] disconnected\n",
> - connector->base.id, connector->name);
> + drm_dbg_kms(dev, "[CONNECTOR:%d:%s] disconnected\n",
> + connector->base.id, connector->name);
> drm_connector_update_edid_property(connector, NULL);
> drm_mode_prune_invalid(dev, &connector->modes, false);
> goto exit;
> @@ -658,8 +659,8 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
>
> drm_mode_sort(&connector->modes);
>
> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s] probed modes :\n", connector->base.id,
> - connector->name);
> + drm_dbg_kms(dev, "[CONNECTOR:%d:%s] probed modes :\n",
> + connector->base.id, connector->name);
> list_for_each_entry(mode, &connector->modes, head) {
> drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
> drm_mode_debug_printmodeline(mode);
> @@ -793,14 +794,14 @@ static void output_poll_execute(struct work_struct *work)
> old = drm_get_connector_status_name(old_status);
> new = drm_get_connector_status_name(connector->status);
>
> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s] "
> - "status updated from %s to %s\n",
> - connector->base.id,
> - connector->name,
> - old, new);
> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s] epoch counter %llu -> %llu\n",
> - connector->base.id, connector->name,
> - old_epoch_counter, connector->epoch_counter);
> + drm_dbg_kms(dev, "[CONNECTOR:%d:%s] "
> + "status updated from %s to %s\n",
> + connector->base.id,
> + connector->name,
> + old, new);
> + drm_dbg_kms(dev, "[CONNECTOR:%d:%s] epoch counter %llu -> %llu\n",
> + connector->base.id, connector->name,
> + old_epoch_counter, connector->epoch_counter);
>
> changed = true;
> }
> diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c
> index 85c79a38c13a..8f4abcb1cbd8 100644
> --- a/drivers/gpu/drm/drm_rect.c
> +++ b/drivers/gpu/drm/drm_rect.c
> @@ -228,9 +228,9 @@ EXPORT_SYMBOL(drm_rect_calc_vscale);
> void drm_rect_debug_print(const char *prefix, const struct drm_rect *r, bool fixed_point)
> {
> if (fixed_point)
> - DRM_DEBUG_KMS("%s" DRM_RECT_FP_FMT "\n", prefix, DRM_RECT_FP_ARG(r));
> + drm_dbg_kms(NULL, "%s" DRM_RECT_FP_FMT "\n", prefix, DRM_RECT_FP_ARG(r));
> else
> - DRM_DEBUG_KMS("%s" DRM_RECT_FMT "\n", prefix, DRM_RECT_ARG(r));
> + drm_dbg_kms(NULL, "%s" DRM_RECT_FMT "\n", prefix, DRM_RECT_ARG(r));
> }
> EXPORT_SYMBOL(drm_rect_debug_print);
>
> diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
> index b7c6754b4688..0edd0df29cb3 100644
> --- a/drivers/gpu/drm/drm_sysfs.c
> +++ b/drivers/gpu/drm/drm_sysfs.c
> @@ -209,10 +209,10 @@ static ssize_t status_store(struct device *device,
> ret = -EINVAL;
>
> if (old_force != connector->force || !connector->force) {
> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s] force updated from %d to %d or reprobing\n",
> - connector->base.id,
> - connector->name,
> - old_force, connector->force);
> + drm_dbg_kms(dev, "[CONNECTOR:%d:%s] force updated from %d to %d or reprobing\n",
> + connector->base.id,
> + connector->name,
> + old_force, connector->force);
>
> connector->funcs->fill_modes(connector,
> dev->mode_config.max_width,
--
Regards,
Laurent Pinchart
Hi Siddh,
Thank you for the patch.
On Tue, Jun 06, 2023 at 04:15:21PM +0530, Siddh Raman Pant wrote:
> drm_print.h says DRM_DEBUG_DRIVER is deprecated.
> Thus, use newer drm_dbg_driver().
>
> Also fix the deprecation comment in drm_print.h which
> mentions drm_dbg() instead of drm_dbg_driver().
>
> Signed-off-by: Siddh Raman Pant <[email protected]>
> ---
> drivers/gpu/drm/drm_mipi_dbi.c | 10 +++++-----
> include/drm/drm_print.h | 2 +-
> 2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c
> index 58ff9503a403..ab5dd5933a1a 100644
> --- a/drivers/gpu/drm/drm_mipi_dbi.c
> +++ b/drivers/gpu/drm/drm_mipi_dbi.c
> @@ -70,11 +70,11 @@
> #define MIPI_DBI_DEBUG_COMMAND(cmd, data, len) \
> ({ \
> if (!len) \
> - DRM_DEBUG_DRIVER("cmd=%02x\n", cmd); \
> + drm_dbg_driver(NULL, "cmd=%02x\n", cmd); \
> else if (len <= 32) \
> - DRM_DEBUG_DRIVER("cmd=%02x, par=%*ph\n", cmd, (int)len, data);\
> + drm_dbg_driver(NULL, "cmd=%02x, par=%*ph\n", cmd, (int)len, data);\
> else \
> - DRM_DEBUG_DRIVER("cmd=%02x, len=%zu\n", cmd, len); \
> + drm_dbg_driver(NULL, "cmd=%02x, len=%zu\n", cmd, len); \
> })
>
> static const u8 mipi_dbi_dcs_read_commands[] = {
> @@ -708,7 +708,7 @@ bool mipi_dbi_display_is_on(struct mipi_dbi *dbi)
> DCS_POWER_MODE_DISPLAY_NORMAL_MODE | DCS_POWER_MODE_SLEEP_MODE))
> return false;
>
> - DRM_DEBUG_DRIVER("Display is ON\n");
> + drm_dbg_driver(NULL, "Display is ON\n");
> return true;
> }
> @@ -1256,7 +1256,7 @@ int mipi_dbi_spi_init(struct spi_device *spi, struct mipi_dbi *dbi,
>
> mutex_init(&dbi->cmdlock);
>
> - DRM_DEBUG_DRIVER("SPI speed: %uMHz\n", spi->max_speed_hz / 1000000);
> + drm_dbg_driver(NULL, "SPI speed: %uMHz\n", spi->max_speed_hz / 1000000);
We don't have access to a struct drm_device pointer here, but we have
access to a struct device through spi_device. It's quite annoying to be
forced by drm_dbg_driver() to use NULL. This isn't a regression, so I'm
fine with this patch, but it probably shows that the drm_print macros
are not always good fits and that API improvements are needed.
With the commit message fixed as mentioned in the review of an earlier
patch in this series,
Reviewed-by: Laurent Pinchart <[email protected]>
>
> return 0;
> }
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> index 4b8532cf2ae6..2bac5e8fd550 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -589,7 +589,7 @@ void __drm_err(const char *format, ...);
> #define DRM_DEBUG(fmt, ...) \
> __drm_dbg(DRM_UT_CORE, fmt, ##__VA_ARGS__)
>
> -/* NOTE: this is deprecated in favor of drm_dbg(NULL, ...). */
> +/* NOTE: this is deprecated in favor of drm_dbg_driver(NULL, ...). */
> #define DRM_DEBUG_DRIVER(fmt, ...) \
> __drm_dbg(DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
>
--
Regards,
Laurent Pinchart
On Tue, 06 Jun 2023 20:16:25 +0530, Laurent Pinchart wrote:
> I would write
>
> drm: Remove usage of deprecated DRM_INFO in DRM core
>
> The "drm: " prefix doesn't imply you're touching the core only, you
> could do a tree-wide change that also touches all drivers.
Okay, will send a v10 with the change after resolving discussions in
other emails, if any.
Thanks,
Siddh
On Tue, 06 Jun 2023 20:27:06 +0530, Laurent Pinchart wrote:
> Hi Siddh,
>
> Thank you for the patch.
Anytime :)
> > if (!ctx_entry) {
> > - DRM_DEBUG("out of memory\n");
> > + drm_dbg_core(dev, "out of memory\n");
>
> This message could also be dropped.
Okay.
> > - DRM_DEBUG("\n");
> > + drm_dbg_core(dev, "\n");
>
> This message seems of dubious value :-) Maybe you could drop it in a
> patch on top of this series ?
Okay.
> > - DRM_DEBUG("\n");
> > + drm_dbg_core(NULL, "\n");
>
> This is even worse :-) The next two messages are also fairly useless,
> they should be expanded, or dropped.
Okay.
> > - DRM_DEBUG("\n");
> > + drm_dbg_core(dev, "\n");
>
> Ditto.
Okay.
> > + drm_dbg_core(dev, "\n");
> > +
>
> Same, and the two messages below too.
Okay.
> > - DRM_DEBUG("\n");
> > + drm_dbg_core(dev, "\n");
>
> Here too.
Okay.
> With the commit subject fixed,
>
> Reviewed-by: Laurent Pinchart [email protected]>
Thanks,
Siddh
On Tue, 06 Jun 2023 20:34:19 +0530, Laurent Pinchart wrote:
> Hi Siddh,
>
> Thank you for the patch.
Anytime :)
> > - DRM_DEBUG_KMS("\n");
> > + drm_dbg_kms(dev, "\n");
>
> This message is pretty useless, it could be dropped on top of this
> series.
Okay.
> > - DRM_DEBUG_KMS("\n");
> > + drm_dbg_kms(NULL, "\n");
>
> Same.
Okay.
> > - DRM_DEBUG_KMS("\n");
> > + drm_dbg_kms(&dbidev->drm, "\n");
>
> Same.
Okay.
> With the commit subject fixed,
>
> Reviewed-by: Laurent Pinchart [email protected]>
Thanks,
Siddh
On Tue, Jun 06, 2023 at 10:59:14PM +0530, Siddh Raman Pant wrote:
> On Tue, 06 Jun 2023 20:35:45 +0530, Laurent Pinchart wrote:
> > This is a nice series, thank you for working on that.
> >
> > Now that the deprecated macros are used in drivers only, would it make
> > sense to move them to a drm_print_deprecated.h header, to make sure no
> > new driver uses them ?
>
> Sure, but then should that header be included wherever drm_print.h is
> included with a find and replace, to avoid breakage?
The idea would be to include the drm_print_deprecated.h header in
drivers that still use the deprecated macros.
> Not every file can be seen at a case-by-case basis or by coccinelle
> as far as I understand its usage. Consider the following:
>
> DRM_INFO is used on line 210 of amd/amdgpu/amdgpu_acpi.c, but the
> file does not even include drm_print.h directly. It includes the
> amdgpu.h header, which includes the amdgpu_ring.h header, which
> finally has the "#include <drm/drm_print.h>" line.
>
> If a simple find and replace has to be done, then that can be added
> at the end of the series.
Maybe a simple grep for the deprecated macros would be enough to
identify all the files that still use them ?
--
Regards,
Laurent Pinchart
On Tue, 06 Jun 2023 20:35:45 +0530, Laurent Pinchart wrote:
> This is a nice series, thank you for working on that.
>
> Now that the deprecated macros are used in drivers only, would it make
> sense to move them to a drm_print_deprecated.h header, to make sure no
> new driver uses them ?
Sure, but then should that header be included wherever drm_print.h is
included with a find and replace, to avoid breakage?
Not every file can be seen at a case-by-case basis or by coccinelle
as far as I understand its usage. Consider the following:
DRM_INFO is used on line 210 of amd/amdgpu/amdgpu_acpi.c, but the
file does not even include drm_print.h directly. It includes the
amdgpu.h header, which includes the amdgpu_ring.h header, which
finally has the "#include <drm/drm_print.h>" line.
If a simple find and replace has to be done, then that can be added
at the end of the series.
Thanks,
Siddh
On Tue, 06 Jun 2023 23:19:28 +0530, Laurent Pinchart wrote:
> The idea would be to include the drm_print_deprecated.h header in
> drivers that still use the deprecated macros.
Yeah, what I meant was in a "first pass" kind of sense.
> > Not every file can be seen at a case-by-case basis or by coccinelle
> > as far as I understand its usage. Consider the following:
> >
> > DRM_INFO is used on line 210 of amd/amdgpu/amdgpu_acpi.c, but the
> > file does not even include drm_print.h directly. It includes the
> > amdgpu.h header, which includes the amdgpu_ring.h header, which
> > finally has the "#include " line.
> >
> > If a simple find and replace has to be done, then that can be added
> > at the end of the series.
>
> Maybe a simple grep for the deprecated macros would be enough to
> identify all the files that still use them ?
Hmm, so the drm_print_deprecated.h should be included individually on
all the files, regardless of whether they include drm_print.h directly
or not?
Actually that makes sense, so further inclusion of top-level header
would not automatically include the deprecated macros.
Since this needs some thought, I will be sending v10 without this.
This change can be sent later separately, as it will anyways be a
huge patch, and 10 is already a big enough revision number.
Thanks,
Siddh
On Tue, 06 Jun 2023, Laurent Pinchart <[email protected]> wrote:
> Hi Siddh,
>
> Thank you for the patch.
>
> On Tue, Jun 06, 2023 at 04:15:22PM +0530, Siddh Raman Pant wrote:
>> drm_print.h says DRM_DEBUG_KMS is deprecated in favor of
>> drm_dbg_kms().
>> ---
>> drivers/gpu/drm/drm_client_modeset.c | 112 +++++++++++++++------------
>> drivers/gpu/drm/drm_color_mgmt.c | 4 +-
>> drivers/gpu/drm/drm_connector.c | 21 ++---
>> drivers/gpu/drm/drm_crtc.c | 36 ++++-----
>> drivers/gpu/drm/drm_crtc_helper.c | 54 ++++++-------
>> drivers/gpu/drm/drm_debugfs_crc.c | 5 +-
>> drivers/gpu/drm/drm_displayid.c | 4 +-
>> drivers/gpu/drm/drm_edid.c | 17 ++--
>> drivers/gpu/drm/drm_lease.c | 2 +-
>> drivers/gpu/drm/drm_mipi_dbi.c | 7 +-
>> drivers/gpu/drm/drm_modes.c | 10 +--
>> drivers/gpu/drm/drm_plane.c | 32 ++++----
>> drivers/gpu/drm/drm_probe_helper.c | 39 +++++-----
>> drivers/gpu/drm/drm_rect.c | 4 +-
>> drivers/gpu/drm/drm_sysfs.c | 8 +-
>> 15 files changed, 187 insertions(+), 168 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c
>> index e2403b8c6347..4e08ae688b83 100644
>> --- a/drivers/gpu/drm/drm_client_modeset.c
>> +++ b/drivers/gpu/drm/drm_client_modeset.c
>> @@ -242,8 +242,9 @@ static void drm_client_connectors_enabled(struct drm_connector **connectors,
>> for (i = 0; i < connector_count; i++) {
>> connector = connectors[i];
>> enabled[i] = drm_connector_enabled(connector, true);
>> - DRM_DEBUG_KMS("connector %d enabled? %s\n", connector->base.id,
>> - connector->display_info.non_desktop ? "non desktop" : str_yes_no(enabled[i]));
>> + drm_dbg_kms(connector->dev, "connector %d enabled? %s\n",
>> + connector->base.id,
>> + connector->display_info.non_desktop ? "non desktop" : str_yes_no(enabled[i]));
>>
>> any_enabled |= enabled[i];
>> }
>> @@ -303,7 +304,7 @@ static bool drm_client_target_cloned(struct drm_device *dev,
>> }
>>
>> if (can_clone) {
>> - DRM_DEBUG_KMS("can clone using command line\n");
>> + drm_dbg_kms(dev, "can clone using command line\n");
>> return true;
>> }
>>
>> @@ -328,7 +329,7 @@ static bool drm_client_target_cloned(struct drm_device *dev,
>> }
>>
>> if (can_clone) {
>> - DRM_DEBUG_KMS("can clone using 1024x768\n");
>> + drm_dbg_kms(dev, "can clone using 1024x768\n");
>> return true;
>> }
>> drm_info(dev, "kms: can't enable cloning when we probably wanted to.\n");
>> @@ -352,8 +353,9 @@ static int drm_client_get_tile_offsets(struct drm_connector **connectors,
>> continue;
>>
>> if (!modes[i] && (h_idx || v_idx)) {
>> - DRM_DEBUG_KMS("no modes for connector tiled %d %d\n", i,
>> - connector->base.id);
>> + drm_dbg_kms(connector->dev,
>> + "no modes for connector tiled %d %d\n",
>> + i, connector->base.id);
>> continue;
>> }
>> if (connector->tile_h_loc < h_idx)
>> @@ -364,7 +366,8 @@ static int drm_client_get_tile_offsets(struct drm_connector **connectors,
>> }
>> offsets[idx].x = hoffset;
>> offsets[idx].y = voffset;
>> - DRM_DEBUG_KMS("returned %d %d for %d %d\n", hoffset, voffset, h_idx, v_idx);
>> + drm_dbg_kms(NULL, "returned %d %d for %d %d\n",
>> + hoffset, voffset, h_idx, v_idx);
>> return 0;
>> }
>>
>> @@ -421,14 +424,16 @@ static bool drm_client_target_preferred(struct drm_connector **connectors,
>> drm_client_get_tile_offsets(connectors, connector_count, modes, offsets, i,
>> connector->tile_h_loc, connector->tile_v_loc);
>> }
>> - DRM_DEBUG_KMS("looking for cmdline mode on connector %d\n",
>> - connector->base.id);
>> + drm_dbg_kms(connector->dev,
>> + "looking for cmdline mode on connector %d\n",
>> + connector->base.id);
>>
>> /* got for command line mode first */
>> modes[i] = drm_connector_pick_cmdline_mode(connector);
>> if (!modes[i]) {
>> - DRM_DEBUG_KMS("looking for preferred mode on connector %d %d\n",
>> - connector->base.id, connector->tile_group ? connector->tile_group->id : 0);
>> + drm_dbg_kms(connector->dev,
>> + "looking for preferred mode on connector %d %d\n",
>> + connector->base.id, connector->tile_group ? connector->tile_group->id : 0);
>> modes[i] = drm_connector_has_preferred_mode(connector, width, height);
>> }
>> /* No preferred modes, pick one off the list */
>> @@ -450,16 +455,17 @@ static bool drm_client_target_preferred(struct drm_connector **connectors,
>> (connector->tile_h_loc == 0 &&
>> connector->tile_v_loc == 0 &&
>> !drm_connector_get_tiled_mode(connector))) {
>> - DRM_DEBUG_KMS("Falling back to non tiled mode on Connector %d\n",
>> - connector->base.id);
>> + drm_dbg_kms(connector->dev,
>> + "Falling back to non tiled mode on Connector %d\n",
>> + connector->base.id);
>> modes[i] = drm_connector_fallback_non_tiled_mode(connector);
>> } else {
>> modes[i] = drm_connector_get_tiled_mode(connector);
>> }
>> }
>>
>> - DRM_DEBUG_KMS("found mode %s\n", modes[i] ? modes[i]->name :
>> - "none");
>> + drm_dbg_kms(connector->dev, "found mode %s\n",
>> + modes[i] ? modes[i]->name : "none");
>> conn_configured |= BIT_ULL(i);
>> }
>>
>> @@ -619,15 +625,17 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
>> num_connectors_detected++;
>>
>> if (!enabled[i]) {
>> - DRM_DEBUG_KMS("connector %s not enabled, skipping\n",
>> - connector->name);
>> + drm_dbg_kms(connector->dev,
>> + "connector %s not enabled, skipping\n",
>> + connector->name);
>> conn_configured |= BIT(i);
>> continue;
>> }
>>
>> if (connector->force == DRM_FORCE_OFF) {
>> - DRM_DEBUG_KMS("connector %s is disabled by user, skipping\n",
>> - connector->name);
>> + drm_dbg_kms(connector->dev,
>> + "connector %s is disabled by user, skipping\n",
>> + connector->name);
>> enabled[i] = false;
>> continue;
>> }
>> @@ -637,8 +645,9 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
>> if (connector->force > DRM_FORCE_OFF)
>> goto bail;
>>
>> - DRM_DEBUG_KMS("connector %s has no encoder or crtc, skipping\n",
>> - connector->name);
>> + drm_dbg_kms(connector->dev,
>> + "connector %s has no encoder or crtc, skipping\n",
>> + connector->name);
>> enabled[i] = false;
>> conn_configured |= BIT(i);
>> continue;
>> @@ -655,28 +664,32 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
>> */
>> for (j = 0; j < count; j++) {
>> if (crtcs[j] == new_crtc) {
>> - DRM_DEBUG_KMS("fallback: cloned configuration\n");
>> + drm_dbg_kms(connector->dev,
>> + "fallback: cloned configuration\n");
>> goto bail;
>> }
>> }
>>
>> - DRM_DEBUG_KMS("looking for cmdline mode on connector %s\n",
>> - connector->name);
>> + drm_dbg_kms(connector->dev,
>> + "looking for cmdline mode on connector %s\n",
>> + connector->name);
>>
>> /* go for command line mode first */
>> modes[i] = drm_connector_pick_cmdline_mode(connector);
>>
>> /* try for preferred next */
>> if (!modes[i]) {
>> - DRM_DEBUG_KMS("looking for preferred mode on connector %s %d\n",
>> - connector->name, connector->has_tile);
>> + drm_dbg_kms(connector->dev,
>> + "looking for preferred mode on connector %s %d\n",
>> + connector->name, connector->has_tile);
>> modes[i] = drm_connector_has_preferred_mode(connector, width, height);
>> }
>>
>> /* No preferred mode marked by the EDID? Are there any modes? */
>> if (!modes[i] && !list_empty(&connector->modes)) {
>> - DRM_DEBUG_KMS("using first mode listed on connector %s\n",
>> - connector->name);
>> + drm_dbg_kms(connector->dev,
>> + "using first mode listed on connector %s\n",
>> + connector->name);
>> modes[i] = list_first_entry(&connector->modes,
>> struct drm_display_mode,
>> head);
>> @@ -695,8 +708,9 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
>> * This is crtc->mode and not crtc->state->mode for the
>> * fastboot check to work correctly.
>> */
>> - DRM_DEBUG_KMS("looking for current mode on connector %s\n",
>> - connector->name);
>> + drm_dbg_kms(connector->dev,
>> + "looking for current mode on connector %s\n",
>> + connector->name);
>> modes[i] = &connector->state->crtc->mode;
>> }
>> /*
>> @@ -705,18 +719,20 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
>> */
>> if (connector->has_tile &&
>> num_tiled_conns < connector->num_h_tile * connector->num_v_tile) {
>> - DRM_DEBUG_KMS("Falling back to non tiled mode on Connector %d\n",
>> - connector->base.id);
>> + drm_dbg_kms(connector->dev,
>> + "Falling back to non tiled mode on Connector %d\n",
>> + connector->base.id);
>> modes[i] = drm_connector_fallback_non_tiled_mode(connector);
>> }
>> crtcs[i] = new_crtc;
>>
>> - DRM_DEBUG_KMS("connector %s on [CRTC:%d:%s]: %dx%d%s\n",
>> - connector->name,
>> - connector->state->crtc->base.id,
>> - connector->state->crtc->name,
>> - modes[i]->hdisplay, modes[i]->vdisplay,
>> - modes[i]->flags & DRM_MODE_FLAG_INTERLACE ? "i" : "");
>> + drm_dbg_kms(connector->dev,
>> + "connector %s on [CRTC:%d:%s]: %dx%d%s\n",
>> + connector->name,
>> + connector->state->crtc->base.id,
>> + connector->state->crtc->name,
>> + modes[i]->hdisplay, modes[i]->vdisplay,
>> + modes[i]->flags & DRM_MODE_FLAG_INTERLACE ? "i" : "");
>>
>> fallback = false;
>> conn_configured |= BIT(i);
>> @@ -732,15 +748,15 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
>> */
>> if (num_connectors_enabled != num_connectors_detected &&
>> num_connectors_enabled < dev->mode_config.num_crtc) {
>> - DRM_DEBUG_KMS("fallback: Not all outputs enabled\n");
>> - DRM_DEBUG_KMS("Enabled: %i, detected: %i\n", num_connectors_enabled,
>> - num_connectors_detected);
>> + drm_dbg_kms(NULL, "fallback: Not all outputs enabled\n");
>> + drm_dbg_kms(NULL, "Enabled: %i, detected: %i\n",
>> + num_connectors_enabled, num_connectors_detected);
>> fallback = true;
>> }
>>
>> if (fallback) {
>> bail:
>> - DRM_DEBUG_KMS("Not using firmware configuration\n");
>> + drm_dbg_kms(NULL, "Not using firmware configuration\n");
>> memcpy(enabled, save_enabled, count);
>> ret = false;
>> }
>> @@ -777,7 +793,7 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width,
>> int i, ret = 0;
>> bool *enabled;
>>
>> - DRM_DEBUG_KMS("\n");
>> + drm_dbg_kms(dev, "\n");
>
> This message is pretty useless, it could be dropped on top of this
> series.
They do debug log the function being called.
BR,
Jani.
>
>>
>> if (!width)
>> width = dev->mode_config.max_width;
>> @@ -819,7 +835,7 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width,
>> for (i = 0; i < connector_count; i++)
>> total_modes_count += connectors[i]->funcs->fill_modes(connectors[i], width, height);
>> if (!total_modes_count)
>> - DRM_DEBUG_KMS("No connectors reported connected with modes\n");
>> + drm_dbg_kms(dev, "No connectors reported connected with modes\n");
>> drm_client_connectors_enabled(connectors, connector_count, enabled);
>>
>> if (!drm_client_firmware_config(client, connectors, connector_count, crtcs,
>> @@ -834,8 +850,8 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width,
>> offsets, enabled, width, height))
>> drm_err(client->dev, "Unable to find initial modes\n");
>>
>> - DRM_DEBUG_KMS("picking CRTCs for %dx%d config\n",
>> - width, height);
>> + drm_dbg_kms(dev, "picking CRTCs for %dx%d config\n",
>> + width, height);
>>
>> drm_client_pick_crtcs(client, connectors, connector_count,
>> crtcs, modes, 0, width, height);
>> @@ -853,8 +869,8 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width,
>> struct drm_mode_set *modeset = drm_client_find_modeset(client, crtc);
>> struct drm_connector *connector = connectors[i];
>>
>> - DRM_DEBUG_KMS("desired mode %s set on crtc %d (%d,%d)\n",
>> - mode->name, crtc->base.id, offset->x, offset->y);
>> + drm_dbg_kms(dev, "desired mode %s set on crtc %d (%d,%d)\n",
>> + mode->name, crtc->base.id, offset->x, offset->y);
>>
>> if (WARN_ON_ONCE(modeset->num_connectors == DRM_CLIENT_MAX_CLONED_CONNECTORS ||
>> (dev->mode_config.num_crtc > 1 && modeset->num_connectors == 1))) {
>> diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c
>> index d021497841b8..a2761a6ce11f 100644
>> --- a/drivers/gpu/drm/drm_color_mgmt.c
>> +++ b/drivers/gpu/drm/drm_color_mgmt.c
>> @@ -612,7 +612,7 @@ int drm_color_lut_check(const struct drm_property_blob *lut, u32 tests)
>> if (tests & DRM_COLOR_LUT_EQUAL_CHANNELS) {
>> if (entry[i].red != entry[i].blue ||
>> entry[i].red != entry[i].green) {
>> - DRM_DEBUG_KMS("All LUT entries must have equal r/g/b\n");
>> + drm_dbg_kms(NULL, "All LUT entries must have equal r/g/b\n");
>> return -EINVAL;
>> }
>> }
>> @@ -621,7 +621,7 @@ int drm_color_lut_check(const struct drm_property_blob *lut, u32 tests)
>> if (entry[i].red < entry[i - 1].red ||
>> entry[i].green < entry[i - 1].green ||
>> entry[i].blue < entry[i - 1].blue) {
>> - DRM_DEBUG_KMS("LUT entries must never decrease.\n");
>> + drm_dbg_kms(NULL, "LUT entries must never decrease.\n");
>> return -EINVAL;
>> }
>> }
>> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
>> index dca8dd4ab93f..adedaf05418a 100644
>> --- a/drivers/gpu/drm/drm_connector.c
>> +++ b/drivers/gpu/drm/drm_connector.c
>> @@ -181,13 +181,14 @@ static void drm_connector_get_cmdline_mode(struct drm_connector *connector)
>> mode->panel_orientation);
>> }
>>
>> - DRM_DEBUG_KMS("cmdline mode for connector %s %s %dx%d@%dHz%s%s%s\n",
>> - connector->name, mode->name,
>> - mode->xres, mode->yres,
>> - mode->refresh_specified ? mode->refresh : 60,
>> - mode->rb ? " reduced blanking" : "",
>> - mode->margins ? " with margins" : "",
>> - mode->interlace ? " interlaced" : "");
>> + drm_dbg_kms(connector->dev,
>> + "cmdline mode for connector %s %s %dx%d@%dHz%s%s%s\n",
>> + connector->name, mode->name,
>> + mode->xres, mode->yres,
>> + mode->refresh_specified ? mode->refresh : 60,
>> + mode->rb ? " reduced blanking" : "",
>> + mode->margins ? " with margins" : "",
>> + mode->interlace ? " interlaced" : "");
>> }
>>
>> static void drm_connector_free(struct kref *kref)
>> @@ -247,9 +248,9 @@ static int __drm_connector_init(struct drm_device *dev,
>> /* connector index is used with 32bit bitmasks */
>> ret = ida_alloc_max(&config->connector_ida, 31, GFP_KERNEL);
>> if (ret < 0) {
>> - DRM_DEBUG_KMS("Failed to allocate %s connector index: %d\n",
>> - drm_connector_enum_list[connector_type].name,
>> - ret);
>> + drm_dbg_kms(dev, "Failed to allocate %s connector index: %d\n",
>> + drm_connector_enum_list[connector_type].name,
>> + ret);
>> goto out_put;
>> }
>> connector->index = ret;
>> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
>> index df9bf3c9206e..adc426561e17 100644
>> --- a/drivers/gpu/drm/drm_crtc.c
>> +++ b/drivers/gpu/drm/drm_crtc.c
>> @@ -730,10 +730,10 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
>>
>> crtc = drm_crtc_find(dev, file_priv, crtc_req->crtc_id);
>> if (!crtc) {
>> - DRM_DEBUG_KMS("Unknown CRTC ID %d\n", crtc_req->crtc_id);
>> + drm_dbg_kms(dev, "Unknown CRTC ID %d\n", crtc_req->crtc_id);
>> return -ENOENT;
>> }
>> - DRM_DEBUG_KMS("[CRTC:%d:%s]\n", crtc->base.id, crtc->name);
>> + drm_dbg_kms(dev, "[CRTC:%d:%s]\n", crtc->base.id, crtc->name);
>>
>> plane = crtc->primary;
>>
>> @@ -756,7 +756,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
>> old_fb = plane->fb;
>>
>> if (!old_fb) {
>> - DRM_DEBUG_KMS("CRTC doesn't have current FB\n");
>> + drm_dbg_kms(dev, "CRTC doesn't have current FB\n");
>> ret = -EINVAL;
>> goto out;
>> }
>> @@ -767,8 +767,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
>> } else {
>> fb = drm_framebuffer_lookup(dev, file_priv, crtc_req->fb_id);
>> if (!fb) {
>> - DRM_DEBUG_KMS("Unknown FB ID%d\n",
>> - crtc_req->fb_id);
>> + drm_dbg_kms(dev, "Unknown FB ID%d\n", crtc_req->fb_id);
>> ret = -ENOENT;
>> goto out;
>> }
>> @@ -781,7 +780,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
>> }
>> if (!file_priv->aspect_ratio_allowed &&
>> (crtc_req->mode.flags & DRM_MODE_FLAG_PIC_AR_MASK) != DRM_MODE_FLAG_PIC_AR_NONE) {
>> - DRM_DEBUG_KMS("Unexpected aspect-ratio flag bits\n");
>> + drm_dbg_kms(dev, "Unexpected aspect-ratio flag bits\n");
>> ret = -EINVAL;
>> goto out;
>> }
>> @@ -789,8 +788,8 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
>>
>> ret = drm_mode_convert_umode(dev, mode, &crtc_req->mode);
>> if (ret) {
>> - DRM_DEBUG_KMS("Invalid mode (ret=%d, status=%s)\n",
>> - ret, drm_get_mode_status_name(mode->status));
>> + drm_dbg_kms(dev, "Invalid mode (ret=%d, status=%s)\n",
>> + ret, drm_get_mode_status_name(mode->status));
>> drm_mode_debug_printmodeline(mode);
>> goto out;
>> }
>> @@ -807,9 +806,8 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
>> fb->format->format,
>> fb->modifier);
>> if (ret) {
>> - DRM_DEBUG_KMS("Invalid pixel format %p4cc, modifier 0x%llx\n",
>> - &fb->format->format,
>> - fb->modifier);
>> + drm_dbg_kms(dev, "Invalid pixel format %p4cc, modifier 0x%llx\n",
>> + &fb->format->format, fb->modifier);
>> goto out;
>> }
>> }
>> @@ -822,14 +820,14 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
>> }
>>
>> if (crtc_req->count_connectors == 0 && mode) {
>> - DRM_DEBUG_KMS("Count connectors is 0 but mode set\n");
>> + drm_dbg_kms(dev, "Count connectors is 0 but mode set\n");
>> ret = -EINVAL;
>> goto out;
>> }
>>
>> if (crtc_req->count_connectors > 0 && (!mode || !fb)) {
>> - DRM_DEBUG_KMS("Count connectors is %d but no mode or fb set\n",
>> - crtc_req->count_connectors);
>> + drm_dbg_kms(dev, "Count connectors is %d but no mode or fb set\n",
>> + crtc_req->count_connectors);
>> ret = -EINVAL;
>> goto out;
>> }
>> @@ -861,14 +859,14 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
>>
>> connector = drm_connector_lookup(dev, file_priv, out_id);
>> if (!connector) {
>> - DRM_DEBUG_KMS("Connector id %d unknown\n",
>> - out_id);
>> + drm_dbg_kms(dev, "Connector id %d unknown\n",
>> + out_id);
>> ret = -ENOENT;
>> goto out;
>> }
>> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
>> - connector->base.id,
>> - connector->name);
>> + drm_dbg_kms(dev, "[CONNECTOR:%d:%s]\n",
>> + connector->base.id,
>> + connector->name);
>>
>> connector_set[i] = connector;
>> }
>> diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
>> index b74b4301a471..59e7b86eab93 100644
>> --- a/drivers/gpu/drm/drm_crtc_helper.c
>> +++ b/drivers/gpu/drm/drm_crtc_helper.c
>> @@ -338,7 +338,7 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
>> if (encoder_funcs->mode_fixup) {
>> if (!(ret = encoder_funcs->mode_fixup(encoder, mode,
>> adjusted_mode))) {
>> - DRM_DEBUG_KMS("Encoder fixup failed\n");
>> + drm_dbg_kms(dev, "Encoder fixup failed\n");
>> goto done;
>> }
>> }
>> @@ -347,11 +347,11 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
>> if (crtc_funcs->mode_fixup) {
>> if (!(ret = crtc_funcs->mode_fixup(crtc, mode,
>> adjusted_mode))) {
>> - DRM_DEBUG_KMS("CRTC fixup failed\n");
>> + drm_dbg_kms(dev, "CRTC fixup failed\n");
>> goto done;
>> }
>> }
>> - DRM_DEBUG_KMS("[CRTC:%d:%s]\n", crtc->base.id, crtc->name);
>> + drm_dbg_kms(dev, "[CRTC:%d:%s]\n", crtc->base.id, crtc->name);
>>
>> drm_mode_copy(&crtc->hwmode, adjusted_mode);
>>
>> @@ -390,8 +390,8 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
>> if (!encoder_funcs)
>> continue;
>>
>> - DRM_DEBUG_KMS("[ENCODER:%d:%s] set [MODE:%s]\n",
>> - encoder->base.id, encoder->name, mode->name);
>> + drm_dbg_kms(dev, "[ENCODER:%d:%s] set [MODE:%s]\n",
>> + encoder->base.id, encoder->name, mode->name);
>> if (encoder_funcs->mode_set)
>> encoder_funcs->mode_set(encoder, mode, adjusted_mode);
>> }
>> @@ -567,7 +567,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
>> int ret;
>> int i;
>>
>> - DRM_DEBUG_KMS("\n");
>> + drm_dbg_kms(NULL, "\n");
>
> Same.
>
>>
>> BUG_ON(!set);
>> BUG_ON(!set->crtc);
>> @@ -586,13 +586,13 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
>> set->fb = NULL;
>>
>> if (set->fb) {
>> - DRM_DEBUG_KMS("[CRTC:%d:%s] [FB:%d] #connectors=%d (x y) (%i %i)\n",
>> - set->crtc->base.id, set->crtc->name,
>> - set->fb->base.id,
>> - (int)set->num_connectors, set->x, set->y);
>> + drm_dbg_kms(dev, "[CRTC:%d:%s] [FB:%d] #connectors=%d (x y) (%i %i)\n",
>> + set->crtc->base.id, set->crtc->name,
>> + set->fb->base.id,
>> + (int)set->num_connectors, set->x, set->y);
>> } else {
>> - DRM_DEBUG_KMS("[CRTC:%d:%s] [NOFB]\n",
>> - set->crtc->base.id, set->crtc->name);
>> + drm_dbg_kms(dev, "[CRTC:%d:%s] [NOFB]\n",
>> + set->crtc->base.id, set->crtc->name);
>> drm_crtc_helper_disable(set->crtc);
>> return 0;
>> }
>> @@ -642,7 +642,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
>> if (set->crtc->primary->fb != set->fb) {
>> /* If we have no fb then treat it as a full mode set */
>> if (set->crtc->primary->fb == NULL) {
>> - DRM_DEBUG_KMS("crtc has no fb, full mode set\n");
>> + drm_dbg_kms(dev, "crtc has no fb, full mode set\n");
>> mode_changed = true;
>> } else if (set->fb->format != set->crtc->primary->fb->format) {
>> mode_changed = true;
>> @@ -654,7 +654,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
>> fb_changed = true;
>>
>> if (!drm_mode_equal(set->mode, &set->crtc->mode)) {
>> - DRM_DEBUG_KMS("modes are different, full mode set\n");
>> + drm_dbg_kms(dev, "modes are different, full mode set\n");
>> drm_mode_debug_printmodeline(&set->crtc->mode);
>> drm_mode_debug_printmodeline(set->mode);
>> mode_changed = true;
>> @@ -690,7 +690,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
>> fail = 1;
>>
>> if (connector->dpms != DRM_MODE_DPMS_ON) {
>> - DRM_DEBUG_KMS("connector dpms not on, full mode switch\n");
>> + drm_dbg_kms(dev, "connector dpms not on, full mode switch\n");
>> mode_changed = true;
>> }
>>
>> @@ -699,7 +699,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
>> }
>>
>> if (new_encoder != connector->encoder) {
>> - DRM_DEBUG_KMS("encoder changed, full mode switch\n");
>> + drm_dbg_kms(dev, "encoder changed, full mode switch\n");
>> mode_changed = true;
>> /* If the encoder is reused for another connector, then
>> * the appropriate crtc will be set later.
>> @@ -740,17 +740,17 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
>> goto fail;
>> }
>> if (new_crtc != connector->encoder->crtc) {
>> - DRM_DEBUG_KMS("crtc changed, full mode switch\n");
>> + drm_dbg_kms(dev, "crtc changed, full mode switch\n");
>> mode_changed = true;
>> connector->encoder->crtc = new_crtc;
>> }
>> if (new_crtc) {
>> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s] to [CRTC:%d:%s]\n",
>> - connector->base.id, connector->name,
>> - new_crtc->base.id, new_crtc->name);
>> + drm_dbg_kms(dev, "[CONNECTOR:%d:%s] to [CRTC:%d:%s]\n",
>> + connector->base.id, connector->name,
>> + new_crtc->base.id, new_crtc->name);
>> } else {
>> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s] to [NOCRTC]\n",
>> - connector->base.id, connector->name);
>> + drm_dbg_kms(dev, "[CONNECTOR:%d:%s] to [NOCRTC]\n",
>> + connector->base.id, connector->name);
>> }
>> }
>> drm_connector_list_iter_end(&conn_iter);
>> @@ -761,8 +761,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
>>
>> if (mode_changed) {
>> if (drm_helper_crtc_in_use(set->crtc)) {
>> - DRM_DEBUG_KMS("attempting to set mode from"
>> - " userspace\n");
>> + drm_dbg_kms(dev, "attempting to set mode from userspace\n");
>> drm_mode_debug_printmodeline(set->mode);
>> set->crtc->primary->fb = set->fb;
>> if (!drm_crtc_helper_set_mode(set->crtc, set->mode,
>> @@ -774,10 +773,11 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
>> ret = -EINVAL;
>> goto fail;
>> }
>> - DRM_DEBUG_KMS("Setting connector DPMS state to on\n");
>> + drm_dbg_kms(dev, "Setting connector DPMS state to on\n");
>> for (i = 0; i < set->num_connectors; i++) {
>> - DRM_DEBUG_KMS("\t[CONNECTOR:%d:%s] set DPMS on\n", set->connectors[i]->base.id,
>> - set->connectors[i]->name);
>> + drm_dbg_kms(dev, "\t[CONNECTOR:%d:%s] set DPMS on\n",
>> + set->connectors[i]->base.id,
>> + set->connectors[i]->name);
>> set->connectors[i]->funcs->dpms(set->connectors[i], DRM_MODE_DPMS_ON);
>> }
>> }
>> diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c
>> index a59ef3f0e4a1..f29d286f4760 100644
>> --- a/drivers/gpu/drm/drm_debugfs_crc.c
>> +++ b/drivers/gpu/drm/drm_debugfs_crc.c
>> @@ -131,8 +131,9 @@ static ssize_t crc_control_write(struct file *file, const char __user *ubuf,
>> return 0;
>>
>> if (len > PAGE_SIZE - 1) {
>> - DRM_DEBUG_KMS("Expected < %lu bytes into crtc crc control\n",
>> - PAGE_SIZE);
>> + drm_dbg_kms(crtc->dev,
>> + "Expected < %lu bytes into crtc crc control\n",
>> + PAGE_SIZE);
>> return -E2BIG;
>> }
>>
>> diff --git a/drivers/gpu/drm/drm_displayid.c b/drivers/gpu/drm/drm_displayid.c
>> index 27ffeee09e4f..7e591bc0883f 100644
>> --- a/drivers/gpu/drm/drm_displayid.c
>> +++ b/drivers/gpu/drm/drm_displayid.c
>> @@ -31,8 +31,8 @@ validate_displayid(const u8 *displayid, int length, int idx)
>> if (IS_ERR(base))
>> return base;
>>
>> - DRM_DEBUG_KMS("base revision 0x%x, length %d, %d %d\n",
>> - base->rev, base->bytes, base->prod_id, base->ext_count);
>> + drm_dbg_kms(NULL, "base revision 0x%x, length %d, %d %d\n",
>> + base->rev, base->bytes, base->prod_id, base->ext_count);
>>
>> /* +1 for DispID checksum */
>> dispid_length = sizeof(*base) + base->bytes + 1;
>> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
>> index 0454da505687..791152c4afd4 100644
>> --- a/drivers/gpu/drm/drm_edid.c
>> +++ b/drivers/gpu/drm/drm_edid.c
>> @@ -1986,7 +1986,7 @@ bool drm_edid_block_valid(u8 *_block, int block_num, bool print_bad_edid,
>>
>> status = edid_block_check(block, is_base_block);
>> if (status == EDID_BLOCK_HEADER_REPAIR) {
>> - DRM_DEBUG_KMS("Fixing EDID header, your hardware may be failing\n");
>> + drm_dbg_kms(NULL, "Fixing EDID header, your hardware may be failing\n");
>> edid_header_fix(block);
>>
>> /* Retry with fixed header, update status if that worked. */
>> @@ -2172,8 +2172,9 @@ drm_do_probe_ddc_edid(void *data, u8 *buf, unsigned int block, size_t len)
>> ret = i2c_transfer(adapter, &msgs[3 - xfers], xfers);
>>
>> if (ret == -ENXIO) {
>> - DRM_DEBUG_KMS("drm: skipping non-existent adapter %s\n",
>> - adapter->name);
>> + drm_dbg_kms(NULL,
>> + "drm: skipping non-existent adapter %s\n",
>> + adapter->name);
>> break;
>> }
>> } while (ret != xfers && --retries);
>> @@ -5589,7 +5590,7 @@ static int _drm_edid_to_sad(const struct drm_edid *drm_edid,
>> }
>> cea_db_iter_end(&iter);
>>
>> - DRM_DEBUG_KMS("Found %d Short Audio Descriptors\n", count);
>> + drm_dbg_kms(NULL, "Found %d Short Audio Descriptors\n", count);
>>
>> return count;
>> }
>> @@ -5634,7 +5635,7 @@ static int _drm_edid_to_speaker_allocation(const struct drm_edid *drm_edid,
>> }
>> cea_db_iter_end(&iter);
>>
>> - DRM_DEBUG_KMS("Found %d Speaker Allocation Data Blocks\n", count);
>> + drm_dbg_kms(NULL, "Found %d Speaker Allocation Data Blocks\n", count);
>>
>> return count;
>> }
>> @@ -5761,7 +5762,7 @@ static bool _drm_detect_monitor_audio(const struct drm_edid *drm_edid)
>> drm_edid_iter_end(&edid_iter);
>>
>> if (has_audio) {
>> - DRM_DEBUG_KMS("Monitor has basic audio support\n");
>> + drm_dbg_kms(NULL, "Monitor has basic audio support\n");
>> goto end;
>> }
>>
>> @@ -5772,8 +5773,8 @@ static bool _drm_detect_monitor_audio(const struct drm_edid *drm_edid)
>> int i;
>>
>> for (i = 0; i < cea_db_payload_len(db); i += 3)
>> - DRM_DEBUG_KMS("CEA audio format %d\n",
>> - (data[i] >> 3) & 0xf);
>> + drm_dbg_kms(NULL, "CEA audio format %d\n",
>> + (data[i] >> 3) & 0xf);
>> has_audio = true;
>> break;
>> }
>> diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c
>> index af72fc38bb7c..c1b8717b5794 100644
>> --- a/drivers/gpu/drm/drm_lease.c
>> +++ b/drivers/gpu/drm/drm_lease.c
>> @@ -403,7 +403,7 @@ static int fill_object_idr(struct drm_device *dev,
>> }
>>
>> if (!drm_mode_object_lease_required(objects[o]->type)) {
>> - DRM_DEBUG_KMS("invalid object for lease\n");
>> + drm_dbg_kms(dev, "invalid object for lease\n");
>> ret = -EINVAL;
>> goto out_free_objects;
>> }
>> diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c
>> index ab5dd5933a1a..793fdd7da1d0 100644
>> --- a/drivers/gpu/drm/drm_mipi_dbi.c
>> +++ b/drivers/gpu/drm/drm_mipi_dbi.c
>> @@ -265,7 +265,8 @@ static void mipi_dbi_fb_dirty(struct iosys_map *src, struct drm_framebuffer *fb,
>>
>> full = width == fb->width && height == fb->height;
>>
>> - DRM_DEBUG_KMS("Flushing [FB:%d] " DRM_RECT_FMT "\n", fb->base.id, DRM_RECT_ARG(rect));
>> + drm_dbg_kms(fb->dev, "Flushing [FB:%d] " DRM_RECT_FMT "\n",
>> + fb->base.id, DRM_RECT_ARG(rect));
>>
>> if (!dbi->dc || !full || swap ||
>> fb->format->format == DRM_FORMAT_XRGB8888) {
>> @@ -408,7 +409,7 @@ void mipi_dbi_pipe_disable(struct drm_simple_display_pipe *pipe)
>> {
>> struct mipi_dbi_dev *dbidev = drm_to_mipi_dbi_dev(pipe->crtc.dev);
>>
>> - DRM_DEBUG_KMS("\n");
>> + drm_dbg_kms(&dbidev->drm, "\n");
>
> Same.
>
> With the commit subject fixed,
>
> Reviewed-by: Laurent Pinchart <[email protected]>
>
>>
>> if (dbidev->backlight)
>> backlight_disable(dbidev->backlight);
>> @@ -627,7 +628,7 @@ int mipi_dbi_dev_init_with_formats(struct mipi_dbi_dev *dbidev,
>> drm->mode_config.max_height = dbidev->mode.vdisplay;
>> dbidev->rotation = rotation;
>>
>> - DRM_DEBUG_KMS("rotation = %u\n", rotation);
>> + drm_dbg_kms(drm, "rotation = %u\n", rotation);
>>
>> return 0;
>> }
>> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
>> index f5171bf91eae..440e3b015cc6 100644
>> --- a/drivers/gpu/drm/drm_modes.c
>> +++ b/drivers/gpu/drm/drm_modes.c
>> @@ -53,11 +53,11 @@
>> * drm_mode_debug_printmodeline - print a mode to dmesg
>> * @mode: mode to print
>> *
>> - * Describe @mode using DRM_DEBUG.
>> + * Describe @mode using drm_dbg_kms().
>> */
>> void drm_mode_debug_printmodeline(const struct drm_display_mode *mode)
>> {
>> - DRM_DEBUG_KMS("Modeline " DRM_MODE_FMT "\n", DRM_MODE_ARG(mode));
>> + drm_dbg_kms(NULL, "Modeline " DRM_MODE_FMT "\n", DRM_MODE_ARG(mode));
>> }
>> EXPORT_SYMBOL(drm_mode_debug_printmodeline);
>>
>> @@ -1813,9 +1813,9 @@ void drm_mode_prune_invalid(struct drm_device *dev,
>> }
>> if (verbose) {
>> drm_mode_debug_printmodeline(mode);
>> - DRM_DEBUG_KMS("Not using %s mode: %s\n",
>> - mode->name,
>> - drm_get_mode_status_name(mode->status));
>> + drm_dbg_kms(dev, "Not using %s mode: %s\n",
>> + mode->name,
>> + drm_get_mode_status_name(mode->status));
>> }
>> drm_mode_destroy(dev, mode);
>> }
>> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
>> index 1e8727b7bce9..12fed5f812a1 100644
>> --- a/drivers/gpu/drm/drm_plane.c
>> +++ b/drivers/gpu/drm/drm_plane.c
>> @@ -275,7 +275,7 @@ static int __drm_universal_plane_init(struct drm_device *dev,
>> plane->format_types = kmalloc_array(format_count, sizeof(uint32_t),
>> GFP_KERNEL);
>> if (!plane->format_types) {
>> - DRM_DEBUG_KMS("out of memory when allocating plane\n");
>> + drm_dbg_kms(dev, "out of memory when allocating plane\n");
>> drm_mode_object_unregister(dev, &plane->base);
>> return -ENOMEM;
>> }
>> @@ -302,7 +302,7 @@ static int __drm_universal_plane_init(struct drm_device *dev,
>> GFP_KERNEL);
>>
>> if (format_modifier_count && !plane->modifiers) {
>> - DRM_DEBUG_KMS("out of memory when allocating plane\n");
>> + drm_dbg_kms(dev, "out of memory when allocating plane\n");
>> kfree(plane->format_types);
>> drm_mode_object_unregister(dev, &plane->base);
>> return -ENOMEM;
>> @@ -786,7 +786,7 @@ static int __setplane_check(struct drm_plane *plane,
>>
>> /* Check whether this plane is usable on this CRTC */
>> if (!(plane->possible_crtcs & drm_crtc_mask(crtc))) {
>> - DRM_DEBUG_KMS("Invalid crtc for plane\n");
>> + drm_dbg_kms(plane->dev, "Invalid crtc for plane\n");
>> return -EINVAL;
>> }
>>
>> @@ -794,8 +794,9 @@ static int __setplane_check(struct drm_plane *plane,
>> ret = drm_plane_check_pixel_format(plane, fb->format->format,
>> fb->modifier);
>> if (ret) {
>> - DRM_DEBUG_KMS("Invalid pixel format %p4cc, modifier 0x%llx\n",
>> - &fb->format->format, fb->modifier);
>> + drm_dbg_kms(fb->dev,
>> + "Invalid pixel format %p4cc, modifier 0x%llx\n",
>> + &fb->format->format, fb->modifier);
>> return ret;
>> }
>>
>> @@ -804,8 +805,8 @@ static int __setplane_check(struct drm_plane *plane,
>> crtc_x > INT_MAX - (int32_t) crtc_w ||
>> crtc_h > INT_MAX ||
>> crtc_y > INT_MAX - (int32_t) crtc_h) {
>> - DRM_DEBUG_KMS("Invalid CRTC coordinates %ux%u+%d+%d\n",
>> - crtc_w, crtc_h, crtc_x, crtc_y);
>> + drm_dbg_kms(crtc->dev, "Invalid CRTC coordinates %ux%u+%d+%d\n",
>> + crtc_w, crtc_h, crtc_x, crtc_y);
>> return -ERANGE;
>> }
>>
>> @@ -982,24 +983,23 @@ int drm_mode_setplane(struct drm_device *dev, void *data,
>> */
>> plane = drm_plane_find(dev, file_priv, plane_req->plane_id);
>> if (!plane) {
>> - DRM_DEBUG_KMS("Unknown plane ID %d\n",
>> - plane_req->plane_id);
>> + drm_dbg_kms(dev, "Unknown plane ID %d\n", plane_req->plane_id);
>> return -ENOENT;
>> }
>>
>> if (plane_req->fb_id) {
>> fb = drm_framebuffer_lookup(dev, file_priv, plane_req->fb_id);
>> if (!fb) {
>> - DRM_DEBUG_KMS("Unknown framebuffer ID %d\n",
>> - plane_req->fb_id);
>> + drm_dbg_kms(dev, "Unknown framebuffer ID %d\n",
>> + plane_req->fb_id);
>> return -ENOENT;
>> }
>>
>> crtc = drm_crtc_find(dev, file_priv, plane_req->crtc_id);
>> if (!crtc) {
>> drm_framebuffer_put(fb);
>> - DRM_DEBUG_KMS("Unknown crtc ID %d\n",
>> - plane_req->crtc_id);
>> + drm_dbg_kms(dev, "Unknown crtc ID %d\n",
>> + plane_req->crtc_id);
>> return -ENOENT;
>> }
>> }
>> @@ -1048,7 +1048,7 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc,
>> if (req->handle) {
>> fb = drm_internal_framebuffer_create(dev, &fbreq, file_priv);
>> if (IS_ERR(fb)) {
>> - DRM_DEBUG_KMS("failed to wrap cursor buffer in drm framebuffer\n");
>> + drm_dbg_kms(dev, "failed to wrap cursor buffer in drm framebuffer\n");
>> return PTR_ERR(fb);
>> }
>>
>> @@ -1119,7 +1119,7 @@ static int drm_mode_cursor_common(struct drm_device *dev,
>>
>> crtc = drm_crtc_find(dev, file_priv, req->crtc_id);
>> if (!crtc) {
>> - DRM_DEBUG_KMS("Unknown CRTC ID %d\n", req->crtc_id);
>> + drm_dbg_kms(dev, "Unknown CRTC ID %d\n", req->crtc_id);
>> return -ENOENT;
>> }
>>
>> @@ -1340,7 +1340,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
>> * to modifier changes.
>> */
>> if (old_fb->format->format != fb->format->format) {
>> - DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
>> + drm_dbg_kms(dev, "Page flip is not allowed to change frame buffer format.\n");
>> ret = -EINVAL;
>> goto out;
>> }
>> diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
>> index 2fb9bf901a2c..6cdaf84735cd 100644
>> --- a/drivers/gpu/drm/drm_probe_helper.c
>> +++ b/drivers/gpu/drm/drm_probe_helper.c
>> @@ -532,8 +532,8 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
>>
>> drm_modeset_acquire_init(&ctx, 0);
>>
>> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id,
>> - connector->name);
>> + drm_dbg_kms(dev, "[CONNECTOR:%d:%s]\n", connector->base.id,
>> + connector->name);
>>
>> retry:
>> ret = drm_modeset_lock(&dev->mode_config.connection_mutex, &ctx);
>> @@ -576,11 +576,12 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
>> * check here, and if anything changed start the hotplug code.
>> */
>> if (old_status != connector->status) {
>> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to %s\n",
>> - connector->base.id,
>> - connector->name,
>> - drm_get_connector_status_name(old_status),
>> - drm_get_connector_status_name(connector->status));
>> + drm_dbg_kms(dev,
>> + "[CONNECTOR:%d:%s] status updated from %s to %s\n",
>> + connector->base.id,
>> + connector->name,
>> + drm_get_connector_status_name(old_status),
>> + drm_get_connector_status_name(connector->status));
>>
>> /*
>> * The hotplug event code might call into the fb
>> @@ -599,8 +600,8 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
>> drm_kms_helper_poll_enable(dev);
>>
>> if (connector->status == connector_status_disconnected) {
>> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s] disconnected\n",
>> - connector->base.id, connector->name);
>> + drm_dbg_kms(dev, "[CONNECTOR:%d:%s] disconnected\n",
>> + connector->base.id, connector->name);
>> drm_connector_update_edid_property(connector, NULL);
>> drm_mode_prune_invalid(dev, &connector->modes, false);
>> goto exit;
>> @@ -658,8 +659,8 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
>>
>> drm_mode_sort(&connector->modes);
>>
>> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s] probed modes :\n", connector->base.id,
>> - connector->name);
>> + drm_dbg_kms(dev, "[CONNECTOR:%d:%s] probed modes :\n",
>> + connector->base.id, connector->name);
>> list_for_each_entry(mode, &connector->modes, head) {
>> drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
>> drm_mode_debug_printmodeline(mode);
>> @@ -793,14 +794,14 @@ static void output_poll_execute(struct work_struct *work)
>> old = drm_get_connector_status_name(old_status);
>> new = drm_get_connector_status_name(connector->status);
>>
>> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s] "
>> - "status updated from %s to %s\n",
>> - connector->base.id,
>> - connector->name,
>> - old, new);
>> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s] epoch counter %llu -> %llu\n",
>> - connector->base.id, connector->name,
>> - old_epoch_counter, connector->epoch_counter);
>> + drm_dbg_kms(dev, "[CONNECTOR:%d:%s] "
>> + "status updated from %s to %s\n",
>> + connector->base.id,
>> + connector->name,
>> + old, new);
>> + drm_dbg_kms(dev, "[CONNECTOR:%d:%s] epoch counter %llu -> %llu\n",
>> + connector->base.id, connector->name,
>> + old_epoch_counter, connector->epoch_counter);
>>
>> changed = true;
>> }
>> diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c
>> index 85c79a38c13a..8f4abcb1cbd8 100644
>> --- a/drivers/gpu/drm/drm_rect.c
>> +++ b/drivers/gpu/drm/drm_rect.c
>> @@ -228,9 +228,9 @@ EXPORT_SYMBOL(drm_rect_calc_vscale);
>> void drm_rect_debug_print(const char *prefix, const struct drm_rect *r, bool fixed_point)
>> {
>> if (fixed_point)
>> - DRM_DEBUG_KMS("%s" DRM_RECT_FP_FMT "\n", prefix, DRM_RECT_FP_ARG(r));
>> + drm_dbg_kms(NULL, "%s" DRM_RECT_FP_FMT "\n", prefix, DRM_RECT_FP_ARG(r));
>> else
>> - DRM_DEBUG_KMS("%s" DRM_RECT_FMT "\n", prefix, DRM_RECT_ARG(r));
>> + drm_dbg_kms(NULL, "%s" DRM_RECT_FMT "\n", prefix, DRM_RECT_ARG(r));
>> }
>> EXPORT_SYMBOL(drm_rect_debug_print);
>>
>> diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
>> index b7c6754b4688..0edd0df29cb3 100644
>> --- a/drivers/gpu/drm/drm_sysfs.c
>> +++ b/drivers/gpu/drm/drm_sysfs.c
>> @@ -209,10 +209,10 @@ static ssize_t status_store(struct device *device,
>> ret = -EINVAL;
>>
>> if (old_force != connector->force || !connector->force) {
>> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s] force updated from %d to %d or reprobing\n",
>> - connector->base.id,
>> - connector->name,
>> - old_force, connector->force);
>> + drm_dbg_kms(dev, "[CONNECTOR:%d:%s] force updated from %d to %d or reprobing\n",
>> + connector->base.id,
>> + connector->name,
>> + old_force, connector->force);
>>
>> connector->funcs->fill_modes(connector,
>> dev->mode_config.max_width,
--
Jani Nikula, Intel Open Source Graphics Center
Hi Jani,
On Wed, Jun 07, 2023 at 12:39:44AM +0300, Jani Nikula wrote:
> On Tue, 06 Jun 2023, Laurent Pinchart wrote:
> > On Tue, Jun 06, 2023 at 04:15:22PM +0530, Siddh Raman Pant wrote:
> >> drm_print.h says DRM_DEBUG_KMS is deprecated in favor of
> >> drm_dbg_kms().
> >> ---
> >> drivers/gpu/drm/drm_client_modeset.c | 112 +++++++++++++++------------
> >> drivers/gpu/drm/drm_color_mgmt.c | 4 +-
> >> drivers/gpu/drm/drm_connector.c | 21 ++---
> >> drivers/gpu/drm/drm_crtc.c | 36 ++++-----
> >> drivers/gpu/drm/drm_crtc_helper.c | 54 ++++++-------
> >> drivers/gpu/drm/drm_debugfs_crc.c | 5 +-
> >> drivers/gpu/drm/drm_displayid.c | 4 +-
> >> drivers/gpu/drm/drm_edid.c | 17 ++--
> >> drivers/gpu/drm/drm_lease.c | 2 +-
> >> drivers/gpu/drm/drm_mipi_dbi.c | 7 +-
> >> drivers/gpu/drm/drm_modes.c | 10 +--
> >> drivers/gpu/drm/drm_plane.c | 32 ++++----
> >> drivers/gpu/drm/drm_probe_helper.c | 39 +++++-----
> >> drivers/gpu/drm/drm_rect.c | 4 +-
> >> drivers/gpu/drm/drm_sysfs.c | 8 +-
> >> 15 files changed, 187 insertions(+), 168 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c
> >> index e2403b8c6347..4e08ae688b83 100644
> >> --- a/drivers/gpu/drm/drm_client_modeset.c
> >> +++ b/drivers/gpu/drm/drm_client_modeset.c
> >> @@ -242,8 +242,9 @@ static void drm_client_connectors_enabled(struct drm_connector **connectors,
> >> for (i = 0; i < connector_count; i++) {
> >> connector = connectors[i];
> >> enabled[i] = drm_connector_enabled(connector, true);
> >> - DRM_DEBUG_KMS("connector %d enabled? %s\n", connector->base.id,
> >> - connector->display_info.non_desktop ? "non desktop" : str_yes_no(enabled[i]));
> >> + drm_dbg_kms(connector->dev, "connector %d enabled? %s\n",
> >> + connector->base.id,
> >> + connector->display_info.non_desktop ? "non desktop" : str_yes_no(enabled[i]));
> >>
> >> any_enabled |= enabled[i];
> >> }
> >> @@ -303,7 +304,7 @@ static bool drm_client_target_cloned(struct drm_device *dev,
> >> }
> >>
> >> if (can_clone) {
> >> - DRM_DEBUG_KMS("can clone using command line\n");
> >> + drm_dbg_kms(dev, "can clone using command line\n");
> >> return true;
> >> }
> >>
> >> @@ -328,7 +329,7 @@ static bool drm_client_target_cloned(struct drm_device *dev,
> >> }
> >>
> >> if (can_clone) {
> >> - DRM_DEBUG_KMS("can clone using 1024x768\n");
> >> + drm_dbg_kms(dev, "can clone using 1024x768\n");
> >> return true;
> >> }
> >> drm_info(dev, "kms: can't enable cloning when we probably wanted to.\n");
> >> @@ -352,8 +353,9 @@ static int drm_client_get_tile_offsets(struct drm_connector **connectors,
> >> continue;
> >>
> >> if (!modes[i] && (h_idx || v_idx)) {
> >> - DRM_DEBUG_KMS("no modes for connector tiled %d %d\n", i,
> >> - connector->base.id);
> >> + drm_dbg_kms(connector->dev,
> >> + "no modes for connector tiled %d %d\n",
> >> + i, connector->base.id);
> >> continue;
> >> }
> >> if (connector->tile_h_loc < h_idx)
> >> @@ -364,7 +366,8 @@ static int drm_client_get_tile_offsets(struct drm_connector **connectors,
> >> }
> >> offsets[idx].x = hoffset;
> >> offsets[idx].y = voffset;
> >> - DRM_DEBUG_KMS("returned %d %d for %d %d\n", hoffset, voffset, h_idx, v_idx);
> >> + drm_dbg_kms(NULL, "returned %d %d for %d %d\n",
> >> + hoffset, voffset, h_idx, v_idx);
> >> return 0;
> >> }
> >>
> >> @@ -421,14 +424,16 @@ static bool drm_client_target_preferred(struct drm_connector **connectors,
> >> drm_client_get_tile_offsets(connectors, connector_count, modes, offsets, i,
> >> connector->tile_h_loc, connector->tile_v_loc);
> >> }
> >> - DRM_DEBUG_KMS("looking for cmdline mode on connector %d\n",
> >> - connector->base.id);
> >> + drm_dbg_kms(connector->dev,
> >> + "looking for cmdline mode on connector %d\n",
> >> + connector->base.id);
> >>
> >> /* got for command line mode first */
> >> modes[i] = drm_connector_pick_cmdline_mode(connector);
> >> if (!modes[i]) {
> >> - DRM_DEBUG_KMS("looking for preferred mode on connector %d %d\n",
> >> - connector->base.id, connector->tile_group ? connector->tile_group->id : 0);
> >> + drm_dbg_kms(connector->dev,
> >> + "looking for preferred mode on connector %d %d\n",
> >> + connector->base.id, connector->tile_group ? connector->tile_group->id : 0);
> >> modes[i] = drm_connector_has_preferred_mode(connector, width, height);
> >> }
> >> /* No preferred modes, pick one off the list */
> >> @@ -450,16 +455,17 @@ static bool drm_client_target_preferred(struct drm_connector **connectors,
> >> (connector->tile_h_loc == 0 &&
> >> connector->tile_v_loc == 0 &&
> >> !drm_connector_get_tiled_mode(connector))) {
> >> - DRM_DEBUG_KMS("Falling back to non tiled mode on Connector %d\n",
> >> - connector->base.id);
> >> + drm_dbg_kms(connector->dev,
> >> + "Falling back to non tiled mode on Connector %d\n",
> >> + connector->base.id);
> >> modes[i] = drm_connector_fallback_non_tiled_mode(connector);
> >> } else {
> >> modes[i] = drm_connector_get_tiled_mode(connector);
> >> }
> >> }
> >>
> >> - DRM_DEBUG_KMS("found mode %s\n", modes[i] ? modes[i]->name :
> >> - "none");
> >> + drm_dbg_kms(connector->dev, "found mode %s\n",
> >> + modes[i] ? modes[i]->name : "none");
> >> conn_configured |= BIT_ULL(i);
> >> }
> >>
> >> @@ -619,15 +625,17 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
> >> num_connectors_detected++;
> >>
> >> if (!enabled[i]) {
> >> - DRM_DEBUG_KMS("connector %s not enabled, skipping\n",
> >> - connector->name);
> >> + drm_dbg_kms(connector->dev,
> >> + "connector %s not enabled, skipping\n",
> >> + connector->name);
> >> conn_configured |= BIT(i);
> >> continue;
> >> }
> >>
> >> if (connector->force == DRM_FORCE_OFF) {
> >> - DRM_DEBUG_KMS("connector %s is disabled by user, skipping\n",
> >> - connector->name);
> >> + drm_dbg_kms(connector->dev,
> >> + "connector %s is disabled by user, skipping\n",
> >> + connector->name);
> >> enabled[i] = false;
> >> continue;
> >> }
> >> @@ -637,8 +645,9 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
> >> if (connector->force > DRM_FORCE_OFF)
> >> goto bail;
> >>
> >> - DRM_DEBUG_KMS("connector %s has no encoder or crtc, skipping\n",
> >> - connector->name);
> >> + drm_dbg_kms(connector->dev,
> >> + "connector %s has no encoder or crtc, skipping\n",
> >> + connector->name);
> >> enabled[i] = false;
> >> conn_configured |= BIT(i);
> >> continue;
> >> @@ -655,28 +664,32 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
> >> */
> >> for (j = 0; j < count; j++) {
> >> if (crtcs[j] == new_crtc) {
> >> - DRM_DEBUG_KMS("fallback: cloned configuration\n");
> >> + drm_dbg_kms(connector->dev,
> >> + "fallback: cloned configuration\n");
> >> goto bail;
> >> }
> >> }
> >>
> >> - DRM_DEBUG_KMS("looking for cmdline mode on connector %s\n",
> >> - connector->name);
> >> + drm_dbg_kms(connector->dev,
> >> + "looking for cmdline mode on connector %s\n",
> >> + connector->name);
> >>
> >> /* go for command line mode first */
> >> modes[i] = drm_connector_pick_cmdline_mode(connector);
> >>
> >> /* try for preferred next */
> >> if (!modes[i]) {
> >> - DRM_DEBUG_KMS("looking for preferred mode on connector %s %d\n",
> >> - connector->name, connector->has_tile);
> >> + drm_dbg_kms(connector->dev,
> >> + "looking for preferred mode on connector %s %d\n",
> >> + connector->name, connector->has_tile);
> >> modes[i] = drm_connector_has_preferred_mode(connector, width, height);
> >> }
> >>
> >> /* No preferred mode marked by the EDID? Are there any modes? */
> >> if (!modes[i] && !list_empty(&connector->modes)) {
> >> - DRM_DEBUG_KMS("using first mode listed on connector %s\n",
> >> - connector->name);
> >> + drm_dbg_kms(connector->dev,
> >> + "using first mode listed on connector %s\n",
> >> + connector->name);
> >> modes[i] = list_first_entry(&connector->modes,
> >> struct drm_display_mode,
> >> head);
> >> @@ -695,8 +708,9 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
> >> * This is crtc->mode and not crtc->state->mode for the
> >> * fastboot check to work correctly.
> >> */
> >> - DRM_DEBUG_KMS("looking for current mode on connector %s\n",
> >> - connector->name);
> >> + drm_dbg_kms(connector->dev,
> >> + "looking for current mode on connector %s\n",
> >> + connector->name);
> >> modes[i] = &connector->state->crtc->mode;
> >> }
> >> /*
> >> @@ -705,18 +719,20 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
> >> */
> >> if (connector->has_tile &&
> >> num_tiled_conns < connector->num_h_tile * connector->num_v_tile) {
> >> - DRM_DEBUG_KMS("Falling back to non tiled mode on Connector %d\n",
> >> - connector->base.id);
> >> + drm_dbg_kms(connector->dev,
> >> + "Falling back to non tiled mode on Connector %d\n",
> >> + connector->base.id);
> >> modes[i] = drm_connector_fallback_non_tiled_mode(connector);
> >> }
> >> crtcs[i] = new_crtc;
> >>
> >> - DRM_DEBUG_KMS("connector %s on [CRTC:%d:%s]: %dx%d%s\n",
> >> - connector->name,
> >> - connector->state->crtc->base.id,
> >> - connector->state->crtc->name,
> >> - modes[i]->hdisplay, modes[i]->vdisplay,
> >> - modes[i]->flags & DRM_MODE_FLAG_INTERLACE ? "i" : "");
> >> + drm_dbg_kms(connector->dev,
> >> + "connector %s on [CRTC:%d:%s]: %dx%d%s\n",
> >> + connector->name,
> >> + connector->state->crtc->base.id,
> >> + connector->state->crtc->name,
> >> + modes[i]->hdisplay, modes[i]->vdisplay,
> >> + modes[i]->flags & DRM_MODE_FLAG_INTERLACE ? "i" : "");
> >>
> >> fallback = false;
> >> conn_configured |= BIT(i);
> >> @@ -732,15 +748,15 @@ static bool drm_client_firmware_config(struct drm_client_dev *client,
> >> */
> >> if (num_connectors_enabled != num_connectors_detected &&
> >> num_connectors_enabled < dev->mode_config.num_crtc) {
> >> - DRM_DEBUG_KMS("fallback: Not all outputs enabled\n");
> >> - DRM_DEBUG_KMS("Enabled: %i, detected: %i\n", num_connectors_enabled,
> >> - num_connectors_detected);
> >> + drm_dbg_kms(NULL, "fallback: Not all outputs enabled\n");
> >> + drm_dbg_kms(NULL, "Enabled: %i, detected: %i\n",
> >> + num_connectors_enabled, num_connectors_detected);
> >> fallback = true;
> >> }
> >>
> >> if (fallback) {
> >> bail:
> >> - DRM_DEBUG_KMS("Not using firmware configuration\n");
> >> + drm_dbg_kms(NULL, "Not using firmware configuration\n");
> >> memcpy(enabled, save_enabled, count);
> >> ret = false;
> >> }
> >> @@ -777,7 +793,7 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width,
> >> int i, ret = 0;
> >> bool *enabled;
> >>
> >> - DRM_DEBUG_KMS("\n");
> >> + drm_dbg_kms(dev, "\n");
> >
> > This message is pretty useless, it could be dropped on top of this
> > series.
>
> They do debug log the function being called.
I overlooked the fact that ___drm_dbg() prints the caller's function
name using __builtin_return_address(). It thus has marginally more value
than I thought. Still, function tracing is best performed with ftrace().
> >>
> >> if (!width)
> >> width = dev->mode_config.max_width;
> >> @@ -819,7 +835,7 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width,
> >> for (i = 0; i < connector_count; i++)
> >> total_modes_count += connectors[i]->funcs->fill_modes(connectors[i], width, height);
> >> if (!total_modes_count)
> >> - DRM_DEBUG_KMS("No connectors reported connected with modes\n");
> >> + drm_dbg_kms(dev, "No connectors reported connected with modes\n");
> >> drm_client_connectors_enabled(connectors, connector_count, enabled);
> >>
> >> if (!drm_client_firmware_config(client, connectors, connector_count, crtcs,
> >> @@ -834,8 +850,8 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width,
> >> offsets, enabled, width, height))
> >> drm_err(client->dev, "Unable to find initial modes\n");
> >>
> >> - DRM_DEBUG_KMS("picking CRTCs for %dx%d config\n",
> >> - width, height);
> >> + drm_dbg_kms(dev, "picking CRTCs for %dx%d config\n",
> >> + width, height);
> >>
> >> drm_client_pick_crtcs(client, connectors, connector_count,
> >> crtcs, modes, 0, width, height);
> >> @@ -853,8 +869,8 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width,
> >> struct drm_mode_set *modeset = drm_client_find_modeset(client, crtc);
> >> struct drm_connector *connector = connectors[i];
> >>
> >> - DRM_DEBUG_KMS("desired mode %s set on crtc %d (%d,%d)\n",
> >> - mode->name, crtc->base.id, offset->x, offset->y);
> >> + drm_dbg_kms(dev, "desired mode %s set on crtc %d (%d,%d)\n",
> >> + mode->name, crtc->base.id, offset->x, offset->y);
> >>
> >> if (WARN_ON_ONCE(modeset->num_connectors == DRM_CLIENT_MAX_CLONED_CONNECTORS ||
> >> (dev->mode_config.num_crtc > 1 && modeset->num_connectors == 1))) {
> >> diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c
> >> index d021497841b8..a2761a6ce11f 100644
> >> --- a/drivers/gpu/drm/drm_color_mgmt.c
> >> +++ b/drivers/gpu/drm/drm_color_mgmt.c
> >> @@ -612,7 +612,7 @@ int drm_color_lut_check(const struct drm_property_blob *lut, u32 tests)
> >> if (tests & DRM_COLOR_LUT_EQUAL_CHANNELS) {
> >> if (entry[i].red != entry[i].blue ||
> >> entry[i].red != entry[i].green) {
> >> - DRM_DEBUG_KMS("All LUT entries must have equal r/g/b\n");
> >> + drm_dbg_kms(NULL, "All LUT entries must have equal r/g/b\n");
> >> return -EINVAL;
> >> }
> >> }
> >> @@ -621,7 +621,7 @@ int drm_color_lut_check(const struct drm_property_blob *lut, u32 tests)
> >> if (entry[i].red < entry[i - 1].red ||
> >> entry[i].green < entry[i - 1].green ||
> >> entry[i].blue < entry[i - 1].blue) {
> >> - DRM_DEBUG_KMS("LUT entries must never decrease.\n");
> >> + drm_dbg_kms(NULL, "LUT entries must never decrease.\n");
> >> return -EINVAL;
> >> }
> >> }
> >> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> >> index dca8dd4ab93f..adedaf05418a 100644
> >> --- a/drivers/gpu/drm/drm_connector.c
> >> +++ b/drivers/gpu/drm/drm_connector.c
> >> @@ -181,13 +181,14 @@ static void drm_connector_get_cmdline_mode(struct drm_connector *connector)
> >> mode->panel_orientation);
> >> }
> >>
> >> - DRM_DEBUG_KMS("cmdline mode for connector %s %s %dx%d@%dHz%s%s%s\n",
> >> - connector->name, mode->name,
> >> - mode->xres, mode->yres,
> >> - mode->refresh_specified ? mode->refresh : 60,
> >> - mode->rb ? " reduced blanking" : "",
> >> - mode->margins ? " with margins" : "",
> >> - mode->interlace ? " interlaced" : "");
> >> + drm_dbg_kms(connector->dev,
> >> + "cmdline mode for connector %s %s %dx%d@%dHz%s%s%s\n",
> >> + connector->name, mode->name,
> >> + mode->xres, mode->yres,
> >> + mode->refresh_specified ? mode->refresh : 60,
> >> + mode->rb ? " reduced blanking" : "",
> >> + mode->margins ? " with margins" : "",
> >> + mode->interlace ? " interlaced" : "");
> >> }
> >>
> >> static void drm_connector_free(struct kref *kref)
> >> @@ -247,9 +248,9 @@ static int __drm_connector_init(struct drm_device *dev,
> >> /* connector index is used with 32bit bitmasks */
> >> ret = ida_alloc_max(&config->connector_ida, 31, GFP_KERNEL);
> >> if (ret < 0) {
> >> - DRM_DEBUG_KMS("Failed to allocate %s connector index: %d\n",
> >> - drm_connector_enum_list[connector_type].name,
> >> - ret);
> >> + drm_dbg_kms(dev, "Failed to allocate %s connector index: %d\n",
> >> + drm_connector_enum_list[connector_type].name,
> >> + ret);
> >> goto out_put;
> >> }
> >> connector->index = ret;
> >> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> >> index df9bf3c9206e..adc426561e17 100644
> >> --- a/drivers/gpu/drm/drm_crtc.c
> >> +++ b/drivers/gpu/drm/drm_crtc.c
> >> @@ -730,10 +730,10 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
> >>
> >> crtc = drm_crtc_find(dev, file_priv, crtc_req->crtc_id);
> >> if (!crtc) {
> >> - DRM_DEBUG_KMS("Unknown CRTC ID %d\n", crtc_req->crtc_id);
> >> + drm_dbg_kms(dev, "Unknown CRTC ID %d\n", crtc_req->crtc_id);
> >> return -ENOENT;
> >> }
> >> - DRM_DEBUG_KMS("[CRTC:%d:%s]\n", crtc->base.id, crtc->name);
> >> + drm_dbg_kms(dev, "[CRTC:%d:%s]\n", crtc->base.id, crtc->name);
> >>
> >> plane = crtc->primary;
> >>
> >> @@ -756,7 +756,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
> >> old_fb = plane->fb;
> >>
> >> if (!old_fb) {
> >> - DRM_DEBUG_KMS("CRTC doesn't have current FB\n");
> >> + drm_dbg_kms(dev, "CRTC doesn't have current FB\n");
> >> ret = -EINVAL;
> >> goto out;
> >> }
> >> @@ -767,8 +767,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
> >> } else {
> >> fb = drm_framebuffer_lookup(dev, file_priv, crtc_req->fb_id);
> >> if (!fb) {
> >> - DRM_DEBUG_KMS("Unknown FB ID%d\n",
> >> - crtc_req->fb_id);
> >> + drm_dbg_kms(dev, "Unknown FB ID%d\n", crtc_req->fb_id);
> >> ret = -ENOENT;
> >> goto out;
> >> }
> >> @@ -781,7 +780,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
> >> }
> >> if (!file_priv->aspect_ratio_allowed &&
> >> (crtc_req->mode.flags & DRM_MODE_FLAG_PIC_AR_MASK) != DRM_MODE_FLAG_PIC_AR_NONE) {
> >> - DRM_DEBUG_KMS("Unexpected aspect-ratio flag bits\n");
> >> + drm_dbg_kms(dev, "Unexpected aspect-ratio flag bits\n");
> >> ret = -EINVAL;
> >> goto out;
> >> }
> >> @@ -789,8 +788,8 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
> >>
> >> ret = drm_mode_convert_umode(dev, mode, &crtc_req->mode);
> >> if (ret) {
> >> - DRM_DEBUG_KMS("Invalid mode (ret=%d, status=%s)\n",
> >> - ret, drm_get_mode_status_name(mode->status));
> >> + drm_dbg_kms(dev, "Invalid mode (ret=%d, status=%s)\n",
> >> + ret, drm_get_mode_status_name(mode->status));
> >> drm_mode_debug_printmodeline(mode);
> >> goto out;
> >> }
> >> @@ -807,9 +806,8 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
> >> fb->format->format,
> >> fb->modifier);
> >> if (ret) {
> >> - DRM_DEBUG_KMS("Invalid pixel format %p4cc, modifier 0x%llx\n",
> >> - &fb->format->format,
> >> - fb->modifier);
> >> + drm_dbg_kms(dev, "Invalid pixel format %p4cc, modifier 0x%llx\n",
> >> + &fb->format->format, fb->modifier);
> >> goto out;
> >> }
> >> }
> >> @@ -822,14 +820,14 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
> >> }
> >>
> >> if (crtc_req->count_connectors == 0 && mode) {
> >> - DRM_DEBUG_KMS("Count connectors is 0 but mode set\n");
> >> + drm_dbg_kms(dev, "Count connectors is 0 but mode set\n");
> >> ret = -EINVAL;
> >> goto out;
> >> }
> >>
> >> if (crtc_req->count_connectors > 0 && (!mode || !fb)) {
> >> - DRM_DEBUG_KMS("Count connectors is %d but no mode or fb set\n",
> >> - crtc_req->count_connectors);
> >> + drm_dbg_kms(dev, "Count connectors is %d but no mode or fb set\n",
> >> + crtc_req->count_connectors);
> >> ret = -EINVAL;
> >> goto out;
> >> }
> >> @@ -861,14 +859,14 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
> >>
> >> connector = drm_connector_lookup(dev, file_priv, out_id);
> >> if (!connector) {
> >> - DRM_DEBUG_KMS("Connector id %d unknown\n",
> >> - out_id);
> >> + drm_dbg_kms(dev, "Connector id %d unknown\n",
> >> + out_id);
> >> ret = -ENOENT;
> >> goto out;
> >> }
> >> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
> >> - connector->base.id,
> >> - connector->name);
> >> + drm_dbg_kms(dev, "[CONNECTOR:%d:%s]\n",
> >> + connector->base.id,
> >> + connector->name);
> >>
> >> connector_set[i] = connector;
> >> }
> >> diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
> >> index b74b4301a471..59e7b86eab93 100644
> >> --- a/drivers/gpu/drm/drm_crtc_helper.c
> >> +++ b/drivers/gpu/drm/drm_crtc_helper.c
> >> @@ -338,7 +338,7 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
> >> if (encoder_funcs->mode_fixup) {
> >> if (!(ret = encoder_funcs->mode_fixup(encoder, mode,
> >> adjusted_mode))) {
> >> - DRM_DEBUG_KMS("Encoder fixup failed\n");
> >> + drm_dbg_kms(dev, "Encoder fixup failed\n");
> >> goto done;
> >> }
> >> }
> >> @@ -347,11 +347,11 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
> >> if (crtc_funcs->mode_fixup) {
> >> if (!(ret = crtc_funcs->mode_fixup(crtc, mode,
> >> adjusted_mode))) {
> >> - DRM_DEBUG_KMS("CRTC fixup failed\n");
> >> + drm_dbg_kms(dev, "CRTC fixup failed\n");
> >> goto done;
> >> }
> >> }
> >> - DRM_DEBUG_KMS("[CRTC:%d:%s]\n", crtc->base.id, crtc->name);
> >> + drm_dbg_kms(dev, "[CRTC:%d:%s]\n", crtc->base.id, crtc->name);
> >>
> >> drm_mode_copy(&crtc->hwmode, adjusted_mode);
> >>
> >> @@ -390,8 +390,8 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
> >> if (!encoder_funcs)
> >> continue;
> >>
> >> - DRM_DEBUG_KMS("[ENCODER:%d:%s] set [MODE:%s]\n",
> >> - encoder->base.id, encoder->name, mode->name);
> >> + drm_dbg_kms(dev, "[ENCODER:%d:%s] set [MODE:%s]\n",
> >> + encoder->base.id, encoder->name, mode->name);
> >> if (encoder_funcs->mode_set)
> >> encoder_funcs->mode_set(encoder, mode, adjusted_mode);
> >> }
> >> @@ -567,7 +567,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
> >> int ret;
> >> int i;
> >>
> >> - DRM_DEBUG_KMS("\n");
> >> + drm_dbg_kms(NULL, "\n");
> >
> > Same.
> >
> >>
> >> BUG_ON(!set);
> >> BUG_ON(!set->crtc);
> >> @@ -586,13 +586,13 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
> >> set->fb = NULL;
> >>
> >> if (set->fb) {
> >> - DRM_DEBUG_KMS("[CRTC:%d:%s] [FB:%d] #connectors=%d (x y) (%i %i)\n",
> >> - set->crtc->base.id, set->crtc->name,
> >> - set->fb->base.id,
> >> - (int)set->num_connectors, set->x, set->y);
> >> + drm_dbg_kms(dev, "[CRTC:%d:%s] [FB:%d] #connectors=%d (x y) (%i %i)\n",
> >> + set->crtc->base.id, set->crtc->name,
> >> + set->fb->base.id,
> >> + (int)set->num_connectors, set->x, set->y);
> >> } else {
> >> - DRM_DEBUG_KMS("[CRTC:%d:%s] [NOFB]\n",
> >> - set->crtc->base.id, set->crtc->name);
> >> + drm_dbg_kms(dev, "[CRTC:%d:%s] [NOFB]\n",
> >> + set->crtc->base.id, set->crtc->name);
> >> drm_crtc_helper_disable(set->crtc);
> >> return 0;
> >> }
> >> @@ -642,7 +642,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
> >> if (set->crtc->primary->fb != set->fb) {
> >> /* If we have no fb then treat it as a full mode set */
> >> if (set->crtc->primary->fb == NULL) {
> >> - DRM_DEBUG_KMS("crtc has no fb, full mode set\n");
> >> + drm_dbg_kms(dev, "crtc has no fb, full mode set\n");
> >> mode_changed = true;
> >> } else if (set->fb->format != set->crtc->primary->fb->format) {
> >> mode_changed = true;
> >> @@ -654,7 +654,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
> >> fb_changed = true;
> >>
> >> if (!drm_mode_equal(set->mode, &set->crtc->mode)) {
> >> - DRM_DEBUG_KMS("modes are different, full mode set\n");
> >> + drm_dbg_kms(dev, "modes are different, full mode set\n");
> >> drm_mode_debug_printmodeline(&set->crtc->mode);
> >> drm_mode_debug_printmodeline(set->mode);
> >> mode_changed = true;
> >> @@ -690,7 +690,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
> >> fail = 1;
> >>
> >> if (connector->dpms != DRM_MODE_DPMS_ON) {
> >> - DRM_DEBUG_KMS("connector dpms not on, full mode switch\n");
> >> + drm_dbg_kms(dev, "connector dpms not on, full mode switch\n");
> >> mode_changed = true;
> >> }
> >>
> >> @@ -699,7 +699,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
> >> }
> >>
> >> if (new_encoder != connector->encoder) {
> >> - DRM_DEBUG_KMS("encoder changed, full mode switch\n");
> >> + drm_dbg_kms(dev, "encoder changed, full mode switch\n");
> >> mode_changed = true;
> >> /* If the encoder is reused for another connector, then
> >> * the appropriate crtc will be set later.
> >> @@ -740,17 +740,17 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
> >> goto fail;
> >> }
> >> if (new_crtc != connector->encoder->crtc) {
> >> - DRM_DEBUG_KMS("crtc changed, full mode switch\n");
> >> + drm_dbg_kms(dev, "crtc changed, full mode switch\n");
> >> mode_changed = true;
> >> connector->encoder->crtc = new_crtc;
> >> }
> >> if (new_crtc) {
> >> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s] to [CRTC:%d:%s]\n",
> >> - connector->base.id, connector->name,
> >> - new_crtc->base.id, new_crtc->name);
> >> + drm_dbg_kms(dev, "[CONNECTOR:%d:%s] to [CRTC:%d:%s]\n",
> >> + connector->base.id, connector->name,
> >> + new_crtc->base.id, new_crtc->name);
> >> } else {
> >> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s] to [NOCRTC]\n",
> >> - connector->base.id, connector->name);
> >> + drm_dbg_kms(dev, "[CONNECTOR:%d:%s] to [NOCRTC]\n",
> >> + connector->base.id, connector->name);
> >> }
> >> }
> >> drm_connector_list_iter_end(&conn_iter);
> >> @@ -761,8 +761,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
> >>
> >> if (mode_changed) {
> >> if (drm_helper_crtc_in_use(set->crtc)) {
> >> - DRM_DEBUG_KMS("attempting to set mode from"
> >> - " userspace\n");
> >> + drm_dbg_kms(dev, "attempting to set mode from userspace\n");
> >> drm_mode_debug_printmodeline(set->mode);
> >> set->crtc->primary->fb = set->fb;
> >> if (!drm_crtc_helper_set_mode(set->crtc, set->mode,
> >> @@ -774,10 +773,11 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
> >> ret = -EINVAL;
> >> goto fail;
> >> }
> >> - DRM_DEBUG_KMS("Setting connector DPMS state to on\n");
> >> + drm_dbg_kms(dev, "Setting connector DPMS state to on\n");
> >> for (i = 0; i < set->num_connectors; i++) {
> >> - DRM_DEBUG_KMS("\t[CONNECTOR:%d:%s] set DPMS on\n", set->connectors[i]->base.id,
> >> - set->connectors[i]->name);
> >> + drm_dbg_kms(dev, "\t[CONNECTOR:%d:%s] set DPMS on\n",
> >> + set->connectors[i]->base.id,
> >> + set->connectors[i]->name);
> >> set->connectors[i]->funcs->dpms(set->connectors[i], DRM_MODE_DPMS_ON);
> >> }
> >> }
> >> diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c
> >> index a59ef3f0e4a1..f29d286f4760 100644
> >> --- a/drivers/gpu/drm/drm_debugfs_crc.c
> >> +++ b/drivers/gpu/drm/drm_debugfs_crc.c
> >> @@ -131,8 +131,9 @@ static ssize_t crc_control_write(struct file *file, const char __user *ubuf,
> >> return 0;
> >>
> >> if (len > PAGE_SIZE - 1) {
> >> - DRM_DEBUG_KMS("Expected < %lu bytes into crtc crc control\n",
> >> - PAGE_SIZE);
> >> + drm_dbg_kms(crtc->dev,
> >> + "Expected < %lu bytes into crtc crc control\n",
> >> + PAGE_SIZE);
> >> return -E2BIG;
> >> }
> >>
> >> diff --git a/drivers/gpu/drm/drm_displayid.c b/drivers/gpu/drm/drm_displayid.c
> >> index 27ffeee09e4f..7e591bc0883f 100644
> >> --- a/drivers/gpu/drm/drm_displayid.c
> >> +++ b/drivers/gpu/drm/drm_displayid.c
> >> @@ -31,8 +31,8 @@ validate_displayid(const u8 *displayid, int length, int idx)
> >> if (IS_ERR(base))
> >> return base;
> >>
> >> - DRM_DEBUG_KMS("base revision 0x%x, length %d, %d %d\n",
> >> - base->rev, base->bytes, base->prod_id, base->ext_count);
> >> + drm_dbg_kms(NULL, "base revision 0x%x, length %d, %d %d\n",
> >> + base->rev, base->bytes, base->prod_id, base->ext_count);
> >>
> >> /* +1 for DispID checksum */
> >> dispid_length = sizeof(*base) + base->bytes + 1;
> >> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> >> index 0454da505687..791152c4afd4 100644
> >> --- a/drivers/gpu/drm/drm_edid.c
> >> +++ b/drivers/gpu/drm/drm_edid.c
> >> @@ -1986,7 +1986,7 @@ bool drm_edid_block_valid(u8 *_block, int block_num, bool print_bad_edid,
> >>
> >> status = edid_block_check(block, is_base_block);
> >> if (status == EDID_BLOCK_HEADER_REPAIR) {
> >> - DRM_DEBUG_KMS("Fixing EDID header, your hardware may be failing\n");
> >> + drm_dbg_kms(NULL, "Fixing EDID header, your hardware may be failing\n");
> >> edid_header_fix(block);
> >>
> >> /* Retry with fixed header, update status if that worked. */
> >> @@ -2172,8 +2172,9 @@ drm_do_probe_ddc_edid(void *data, u8 *buf, unsigned int block, size_t len)
> >> ret = i2c_transfer(adapter, &msgs[3 - xfers], xfers);
> >>
> >> if (ret == -ENXIO) {
> >> - DRM_DEBUG_KMS("drm: skipping non-existent adapter %s\n",
> >> - adapter->name);
> >> + drm_dbg_kms(NULL,
> >> + "drm: skipping non-existent adapter %s\n",
> >> + adapter->name);
> >> break;
> >> }
> >> } while (ret != xfers && --retries);
> >> @@ -5589,7 +5590,7 @@ static int _drm_edid_to_sad(const struct drm_edid *drm_edid,
> >> }
> >> cea_db_iter_end(&iter);
> >>
> >> - DRM_DEBUG_KMS("Found %d Short Audio Descriptors\n", count);
> >> + drm_dbg_kms(NULL, "Found %d Short Audio Descriptors\n", count);
> >>
> >> return count;
> >> }
> >> @@ -5634,7 +5635,7 @@ static int _drm_edid_to_speaker_allocation(const struct drm_edid *drm_edid,
> >> }
> >> cea_db_iter_end(&iter);
> >>
> >> - DRM_DEBUG_KMS("Found %d Speaker Allocation Data Blocks\n", count);
> >> + drm_dbg_kms(NULL, "Found %d Speaker Allocation Data Blocks\n", count);
> >>
> >> return count;
> >> }
> >> @@ -5761,7 +5762,7 @@ static bool _drm_detect_monitor_audio(const struct drm_edid *drm_edid)
> >> drm_edid_iter_end(&edid_iter);
> >>
> >> if (has_audio) {
> >> - DRM_DEBUG_KMS("Monitor has basic audio support\n");
> >> + drm_dbg_kms(NULL, "Monitor has basic audio support\n");
> >> goto end;
> >> }
> >>
> >> @@ -5772,8 +5773,8 @@ static bool _drm_detect_monitor_audio(const struct drm_edid *drm_edid)
> >> int i;
> >>
> >> for (i = 0; i < cea_db_payload_len(db); i += 3)
> >> - DRM_DEBUG_KMS("CEA audio format %d\n",
> >> - (data[i] >> 3) & 0xf);
> >> + drm_dbg_kms(NULL, "CEA audio format %d\n",
> >> + (data[i] >> 3) & 0xf);
> >> has_audio = true;
> >> break;
> >> }
> >> diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c
> >> index af72fc38bb7c..c1b8717b5794 100644
> >> --- a/drivers/gpu/drm/drm_lease.c
> >> +++ b/drivers/gpu/drm/drm_lease.c
> >> @@ -403,7 +403,7 @@ static int fill_object_idr(struct drm_device *dev,
> >> }
> >>
> >> if (!drm_mode_object_lease_required(objects[o]->type)) {
> >> - DRM_DEBUG_KMS("invalid object for lease\n");
> >> + drm_dbg_kms(dev, "invalid object for lease\n");
> >> ret = -EINVAL;
> >> goto out_free_objects;
> >> }
> >> diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c
> >> index ab5dd5933a1a..793fdd7da1d0 100644
> >> --- a/drivers/gpu/drm/drm_mipi_dbi.c
> >> +++ b/drivers/gpu/drm/drm_mipi_dbi.c
> >> @@ -265,7 +265,8 @@ static void mipi_dbi_fb_dirty(struct iosys_map *src, struct drm_framebuffer *fb,
> >>
> >> full = width == fb->width && height == fb->height;
> >>
> >> - DRM_DEBUG_KMS("Flushing [FB:%d] " DRM_RECT_FMT "\n", fb->base.id, DRM_RECT_ARG(rect));
> >> + drm_dbg_kms(fb->dev, "Flushing [FB:%d] " DRM_RECT_FMT "\n",
> >> + fb->base.id, DRM_RECT_ARG(rect));
> >>
> >> if (!dbi->dc || !full || swap ||
> >> fb->format->format == DRM_FORMAT_XRGB8888) {
> >> @@ -408,7 +409,7 @@ void mipi_dbi_pipe_disable(struct drm_simple_display_pipe *pipe)
> >> {
> >> struct mipi_dbi_dev *dbidev = drm_to_mipi_dbi_dev(pipe->crtc.dev);
> >>
> >> - DRM_DEBUG_KMS("\n");
> >> + drm_dbg_kms(&dbidev->drm, "\n");
> >
> > Same.
> >
> > With the commit subject fixed,
> >
> > Reviewed-by: Laurent Pinchart <[email protected]>
> >
> >>
> >> if (dbidev->backlight)
> >> backlight_disable(dbidev->backlight);
> >> @@ -627,7 +628,7 @@ int mipi_dbi_dev_init_with_formats(struct mipi_dbi_dev *dbidev,
> >> drm->mode_config.max_height = dbidev->mode.vdisplay;
> >> dbidev->rotation = rotation;
> >>
> >> - DRM_DEBUG_KMS("rotation = %u\n", rotation);
> >> + drm_dbg_kms(drm, "rotation = %u\n", rotation);
> >>
> >> return 0;
> >> }
> >> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> >> index f5171bf91eae..440e3b015cc6 100644
> >> --- a/drivers/gpu/drm/drm_modes.c
> >> +++ b/drivers/gpu/drm/drm_modes.c
> >> @@ -53,11 +53,11 @@
> >> * drm_mode_debug_printmodeline - print a mode to dmesg
> >> * @mode: mode to print
> >> *
> >> - * Describe @mode using DRM_DEBUG.
> >> + * Describe @mode using drm_dbg_kms().
> >> */
> >> void drm_mode_debug_printmodeline(const struct drm_display_mode *mode)
> >> {
> >> - DRM_DEBUG_KMS("Modeline " DRM_MODE_FMT "\n", DRM_MODE_ARG(mode));
> >> + drm_dbg_kms(NULL, "Modeline " DRM_MODE_FMT "\n", DRM_MODE_ARG(mode));
> >> }
> >> EXPORT_SYMBOL(drm_mode_debug_printmodeline);
> >>
> >> @@ -1813,9 +1813,9 @@ void drm_mode_prune_invalid(struct drm_device *dev,
> >> }
> >> if (verbose) {
> >> drm_mode_debug_printmodeline(mode);
> >> - DRM_DEBUG_KMS("Not using %s mode: %s\n",
> >> - mode->name,
> >> - drm_get_mode_status_name(mode->status));
> >> + drm_dbg_kms(dev, "Not using %s mode: %s\n",
> >> + mode->name,
> >> + drm_get_mode_status_name(mode->status));
> >> }
> >> drm_mode_destroy(dev, mode);
> >> }
> >> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> >> index 1e8727b7bce9..12fed5f812a1 100644
> >> --- a/drivers/gpu/drm/drm_plane.c
> >> +++ b/drivers/gpu/drm/drm_plane.c
> >> @@ -275,7 +275,7 @@ static int __drm_universal_plane_init(struct drm_device *dev,
> >> plane->format_types = kmalloc_array(format_count, sizeof(uint32_t),
> >> GFP_KERNEL);
> >> if (!plane->format_types) {
> >> - DRM_DEBUG_KMS("out of memory when allocating plane\n");
> >> + drm_dbg_kms(dev, "out of memory when allocating plane\n");
> >> drm_mode_object_unregister(dev, &plane->base);
> >> return -ENOMEM;
> >> }
> >> @@ -302,7 +302,7 @@ static int __drm_universal_plane_init(struct drm_device *dev,
> >> GFP_KERNEL);
> >>
> >> if (format_modifier_count && !plane->modifiers) {
> >> - DRM_DEBUG_KMS("out of memory when allocating plane\n");
> >> + drm_dbg_kms(dev, "out of memory when allocating plane\n");
> >> kfree(plane->format_types);
> >> drm_mode_object_unregister(dev, &plane->base);
> >> return -ENOMEM;
> >> @@ -786,7 +786,7 @@ static int __setplane_check(struct drm_plane *plane,
> >>
> >> /* Check whether this plane is usable on this CRTC */
> >> if (!(plane->possible_crtcs & drm_crtc_mask(crtc))) {
> >> - DRM_DEBUG_KMS("Invalid crtc for plane\n");
> >> + drm_dbg_kms(plane->dev, "Invalid crtc for plane\n");
> >> return -EINVAL;
> >> }
> >>
> >> @@ -794,8 +794,9 @@ static int __setplane_check(struct drm_plane *plane,
> >> ret = drm_plane_check_pixel_format(plane, fb->format->format,
> >> fb->modifier);
> >> if (ret) {
> >> - DRM_DEBUG_KMS("Invalid pixel format %p4cc, modifier 0x%llx\n",
> >> - &fb->format->format, fb->modifier);
> >> + drm_dbg_kms(fb->dev,
> >> + "Invalid pixel format %p4cc, modifier 0x%llx\n",
> >> + &fb->format->format, fb->modifier);
> >> return ret;
> >> }
> >>
> >> @@ -804,8 +805,8 @@ static int __setplane_check(struct drm_plane *plane,
> >> crtc_x > INT_MAX - (int32_t) crtc_w ||
> >> crtc_h > INT_MAX ||
> >> crtc_y > INT_MAX - (int32_t) crtc_h) {
> >> - DRM_DEBUG_KMS("Invalid CRTC coordinates %ux%u+%d+%d\n",
> >> - crtc_w, crtc_h, crtc_x, crtc_y);
> >> + drm_dbg_kms(crtc->dev, "Invalid CRTC coordinates %ux%u+%d+%d\n",
> >> + crtc_w, crtc_h, crtc_x, crtc_y);
> >> return -ERANGE;
> >> }
> >>
> >> @@ -982,24 +983,23 @@ int drm_mode_setplane(struct drm_device *dev, void *data,
> >> */
> >> plane = drm_plane_find(dev, file_priv, plane_req->plane_id);
> >> if (!plane) {
> >> - DRM_DEBUG_KMS("Unknown plane ID %d\n",
> >> - plane_req->plane_id);
> >> + drm_dbg_kms(dev, "Unknown plane ID %d\n", plane_req->plane_id);
> >> return -ENOENT;
> >> }
> >>
> >> if (plane_req->fb_id) {
> >> fb = drm_framebuffer_lookup(dev, file_priv, plane_req->fb_id);
> >> if (!fb) {
> >> - DRM_DEBUG_KMS("Unknown framebuffer ID %d\n",
> >> - plane_req->fb_id);
> >> + drm_dbg_kms(dev, "Unknown framebuffer ID %d\n",
> >> + plane_req->fb_id);
> >> return -ENOENT;
> >> }
> >>
> >> crtc = drm_crtc_find(dev, file_priv, plane_req->crtc_id);
> >> if (!crtc) {
> >> drm_framebuffer_put(fb);
> >> - DRM_DEBUG_KMS("Unknown crtc ID %d\n",
> >> - plane_req->crtc_id);
> >> + drm_dbg_kms(dev, "Unknown crtc ID %d\n",
> >> + plane_req->crtc_id);
> >> return -ENOENT;
> >> }
> >> }
> >> @@ -1048,7 +1048,7 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc,
> >> if (req->handle) {
> >> fb = drm_internal_framebuffer_create(dev, &fbreq, file_priv);
> >> if (IS_ERR(fb)) {
> >> - DRM_DEBUG_KMS("failed to wrap cursor buffer in drm framebuffer\n");
> >> + drm_dbg_kms(dev, "failed to wrap cursor buffer in drm framebuffer\n");
> >> return PTR_ERR(fb);
> >> }
> >>
> >> @@ -1119,7 +1119,7 @@ static int drm_mode_cursor_common(struct drm_device *dev,
> >>
> >> crtc = drm_crtc_find(dev, file_priv, req->crtc_id);
> >> if (!crtc) {
> >> - DRM_DEBUG_KMS("Unknown CRTC ID %d\n", req->crtc_id);
> >> + drm_dbg_kms(dev, "Unknown CRTC ID %d\n", req->crtc_id);
> >> return -ENOENT;
> >> }
> >>
> >> @@ -1340,7 +1340,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
> >> * to modifier changes.
> >> */
> >> if (old_fb->format->format != fb->format->format) {
> >> - DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
> >> + drm_dbg_kms(dev, "Page flip is not allowed to change frame buffer format.\n");
> >> ret = -EINVAL;
> >> goto out;
> >> }
> >> diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
> >> index 2fb9bf901a2c..6cdaf84735cd 100644
> >> --- a/drivers/gpu/drm/drm_probe_helper.c
> >> +++ b/drivers/gpu/drm/drm_probe_helper.c
> >> @@ -532,8 +532,8 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
> >>
> >> drm_modeset_acquire_init(&ctx, 0);
> >>
> >> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id,
> >> - connector->name);
> >> + drm_dbg_kms(dev, "[CONNECTOR:%d:%s]\n", connector->base.id,
> >> + connector->name);
> >>
> >> retry:
> >> ret = drm_modeset_lock(&dev->mode_config.connection_mutex, &ctx);
> >> @@ -576,11 +576,12 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
> >> * check here, and if anything changed start the hotplug code.
> >> */
> >> if (old_status != connector->status) {
> >> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to %s\n",
> >> - connector->base.id,
> >> - connector->name,
> >> - drm_get_connector_status_name(old_status),
> >> - drm_get_connector_status_name(connector->status));
> >> + drm_dbg_kms(dev,
> >> + "[CONNECTOR:%d:%s] status updated from %s to %s\n",
> >> + connector->base.id,
> >> + connector->name,
> >> + drm_get_connector_status_name(old_status),
> >> + drm_get_connector_status_name(connector->status));
> >>
> >> /*
> >> * The hotplug event code might call into the fb
> >> @@ -599,8 +600,8 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
> >> drm_kms_helper_poll_enable(dev);
> >>
> >> if (connector->status == connector_status_disconnected) {
> >> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s] disconnected\n",
> >> - connector->base.id, connector->name);
> >> + drm_dbg_kms(dev, "[CONNECTOR:%d:%s] disconnected\n",
> >> + connector->base.id, connector->name);
> >> drm_connector_update_edid_property(connector, NULL);
> >> drm_mode_prune_invalid(dev, &connector->modes, false);
> >> goto exit;
> >> @@ -658,8 +659,8 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
> >>
> >> drm_mode_sort(&connector->modes);
> >>
> >> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s] probed modes :\n", connector->base.id,
> >> - connector->name);
> >> + drm_dbg_kms(dev, "[CONNECTOR:%d:%s] probed modes :\n",
> >> + connector->base.id, connector->name);
> >> list_for_each_entry(mode, &connector->modes, head) {
> >> drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
> >> drm_mode_debug_printmodeline(mode);
> >> @@ -793,14 +794,14 @@ static void output_poll_execute(struct work_struct *work)
> >> old = drm_get_connector_status_name(old_status);
> >> new = drm_get_connector_status_name(connector->status);
> >>
> >> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s] "
> >> - "status updated from %s to %s\n",
> >> - connector->base.id,
> >> - connector->name,
> >> - old, new);
> >> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s] epoch counter %llu -> %llu\n",
> >> - connector->base.id, connector->name,
> >> - old_epoch_counter, connector->epoch_counter);
> >> + drm_dbg_kms(dev, "[CONNECTOR:%d:%s] "
> >> + "status updated from %s to %s\n",
> >> + connector->base.id,
> >> + connector->name,
> >> + old, new);
> >> + drm_dbg_kms(dev, "[CONNECTOR:%d:%s] epoch counter %llu -> %llu\n",
> >> + connector->base.id, connector->name,
> >> + old_epoch_counter, connector->epoch_counter);
> >>
> >> changed = true;
> >> }
> >> diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c
> >> index 85c79a38c13a..8f4abcb1cbd8 100644
> >> --- a/drivers/gpu/drm/drm_rect.c
> >> +++ b/drivers/gpu/drm/drm_rect.c
> >> @@ -228,9 +228,9 @@ EXPORT_SYMBOL(drm_rect_calc_vscale);
> >> void drm_rect_debug_print(const char *prefix, const struct drm_rect *r, bool fixed_point)
> >> {
> >> if (fixed_point)
> >> - DRM_DEBUG_KMS("%s" DRM_RECT_FP_FMT "\n", prefix, DRM_RECT_FP_ARG(r));
> >> + drm_dbg_kms(NULL, "%s" DRM_RECT_FP_FMT "\n", prefix, DRM_RECT_FP_ARG(r));
> >> else
> >> - DRM_DEBUG_KMS("%s" DRM_RECT_FMT "\n", prefix, DRM_RECT_ARG(r));
> >> + drm_dbg_kms(NULL, "%s" DRM_RECT_FMT "\n", prefix, DRM_RECT_ARG(r));
> >> }
> >> EXPORT_SYMBOL(drm_rect_debug_print);
> >>
> >> diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
> >> index b7c6754b4688..0edd0df29cb3 100644
> >> --- a/drivers/gpu/drm/drm_sysfs.c
> >> +++ b/drivers/gpu/drm/drm_sysfs.c
> >> @@ -209,10 +209,10 @@ static ssize_t status_store(struct device *device,
> >> ret = -EINVAL;
> >>
> >> if (old_force != connector->force || !connector->force) {
> >> - DRM_DEBUG_KMS("[CONNECTOR:%d:%s] force updated from %d to %d or reprobing\n",
> >> - connector->base.id,
> >> - connector->name,
> >> - old_force, connector->force);
> >> + drm_dbg_kms(dev, "[CONNECTOR:%d:%s] force updated from %d to %d or reprobing\n",
> >> + connector->base.id,
> >> + connector->name,
> >> + old_force, connector->force);
> >>
> >> connector->funcs->fill_modes(connector,
> >> dev->mode_config.max_width,
--
Regards,
Laurent Pinchart
On Tue, Jun 06, 2023 at 11:47:50PM +0530, Siddh Raman Pant wrote:
> On Tue, 06 Jun 2023 23:19:28 +0530, Laurent Pinchart wrote:
> > The idea would be to include the drm_print_deprecated.h header in
> > drivers that still use the deprecated macros.
>
> Yeah, what I meant was in a "first pass" kind of sense.
>
> > > Not every file can be seen at a case-by-case basis or by coccinelle
> > > as far as I understand its usage. Consider the following:
> > >
> > > DRM_INFO is used on line 210 of amd/amdgpu/amdgpu_acpi.c, but the
> > > file does not even include drm_print.h directly. It includes the
> > > amdgpu.h header, which includes the amdgpu_ring.h header, which
> > > finally has the "#include " line.
> > >
> > > If a simple find and replace has to be done, then that can be added
> > > at the end of the series.
> >
> > Maybe a simple grep for the deprecated macros would be enough to
> > identify all the files that still use them ?
>
> Hmm, so the drm_print_deprecated.h should be included individually on
> all the files, regardless of whether they include drm_print.h directly
> or not?
>
> Actually that makes sense, so further inclusion of top-level header
> would not automatically include the deprecated macros.
That's the idea, yes. It would also clearly flag drivers that need to be
converted to the new macros.
> Since this needs some thought, I will be sending v10 without this.
> This change can be sent later separately, as it will anyways be a
> huge patch, and 10 is already a big enough revision number.
Sounds good to me.
--
Regards,
Laurent Pinchart
On Wed, 07 Jun 2023, Laurent Pinchart <[email protected]> wrote:
> Hi Jani,
>
> On Wed, Jun 07, 2023 at 12:39:44AM +0300, Jani Nikula wrote:
>> On Tue, 06 Jun 2023, Laurent Pinchart wrote:
>> > On Tue, Jun 06, 2023 at 04:15:22PM +0530, Siddh Raman Pant wrote:
>> >> @@ -777,7 +793,7 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width,
>> >> int i, ret = 0;
>> >> bool *enabled;
>> >>
>> >> - DRM_DEBUG_KMS("\n");
>> >> + drm_dbg_kms(dev, "\n");
>> >
>> > This message is pretty useless, it could be dropped on top of this
>> > series.
>>
>> They do debug log the function being called.
>
> I overlooked the fact that ___drm_dbg() prints the caller's function
> name using __builtin_return_address(). It thus has marginally more value
> than I thought. Still, function tracing is best performed with ftrace().
I'm not going to argue this one too much, but it can be quite a step
getting a random bug reporter from providing dmesgs to running ftrace.
BR,
Jani.
--
Jani Nikula, Intel Open Source Graphics Center