2022-12-22 15:53:57

by Siddh Raman Pant

[permalink] [raw]
Subject: [PATCH v2 0/9] drm: Remove usage of deprecated DRM_* macros

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.

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.

----
Changes in v2:
- 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 (9):
drm: Remove usage of deprecated DRM_INFO
drm: Remove usage of deprecated DRM_ERROR
drm/print: Fix support for NULL as first argument of drm_dbg_*
drm: Remove usage of deprecated DRM_DEBUG
drm: Remove usage of deprecated DRM_DEBUG_DRIVER
drm: Remove usage of deprecated DRM_DEBUG_KMS
drm: Remove usage of deprecated DRM_DEBUG_PRIME
drm/drm_blend: Remove usage of deprecated DRM_DEBUG_ATOMIC
drm/drm_lease: Remove usage of deprecated DRM_DEBUG_LEASE

drivers/gpu/drm/drm_agpsupport.c | 4 +-
drivers/gpu/drm/drm_blend.c | 13 ++-
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 | 60 ++++++------
drivers/gpu/drm/drm_debugfs_crc.c | 8 +-
drivers/gpu/drm/drm_displayid.c | 4 +-
drivers/gpu/drm/drm_dma.c | 10 +-
drivers/gpu/drm/drm_drv.c | 20 ++--
drivers/gpu/drm/drm_edid.c | 17 ++--
drivers/gpu/drm/drm_file.c | 18 ++--
drivers/gpu/drm/drm_framebuffer.c | 3 +-
drivers/gpu/drm/drm_gem.c | 7 +-
drivers/gpu/drm/drm_gem_dma_helper.c | 6 +-
drivers/gpu/drm/drm_gem_shmem_helper.c | 6 +-
drivers/gpu/drm/drm_hashtab.c | 6 +-
drivers/gpu/drm/drm_ioc32.c | 13 +--
drivers/gpu/drm/drm_ioctl.c | 24 ++---
drivers/gpu/drm/drm_irq.c | 4 +-
drivers/gpu/drm/drm_lease.c | 68 +++++++-------
drivers/gpu/drm/drm_legacy_misc.c | 4 +-
drivers/gpu/drm/drm_lock.c | 20 ++--
drivers/gpu/drm/drm_mipi_dbi.c | 19 ++--
drivers/gpu/drm/drm_mode_config.c | 2 +-
drivers/gpu/drm/drm_mode_object.c | 6 +-
drivers/gpu/drm/drm_modes.c | 10 +-
drivers/gpu/drm/drm_modeset_helper.c | 2 +-
drivers/gpu/drm/drm_pci.c | 12 +--
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 | 44 ++++++---
41 files changed, 486 insertions(+), 435 deletions(-)

--
2.35.1



2022-12-22 15:54:34

by Siddh Raman Pant

[permalink] [raw]
Subject: [PATCH v2 6/9] drm: Remove usage of deprecated DRM_DEBUG_KMS

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_gem_shmem_helper.c | 4 +-
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 +-
16 files changed, 189 insertions(+), 170 deletions(-)

diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c
index c4517dea924e..7c1e8352ff71 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -246,8 +246,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];
}
@@ -307,7 +308,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;
}

@@ -332,7 +333,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");
@@ -356,8 +357,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)
@@ -368,7 +370,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;
}

@@ -425,14 +428,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 */
@@ -454,16 +459,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);
}

@@ -623,15 +629,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;
}
@@ -641,8 +649,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;
@@ -659,28 +668,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);
@@ -699,8 +712,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;
}
/*
@@ -709,18 +723,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);
@@ -736,15 +752,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;
}
@@ -781,7 +797,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;
@@ -823,7 +839,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,
@@ -838,8 +854,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);
@@ -857,8 +873,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 34c26b2a974e..3294f2e41e7a 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -178,13 +178,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)
@@ -244,9 +245,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 ab41dc180c58..9478d16fc7b0 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 38ea8203df45..e8c2d73b29e6 100644
--- a/drivers/gpu/drm/drm_displayid.c
+++ b/drivers/gpu/drm/drm_displayid.c
@@ -15,8 +15,8 @@ static int validate_displayid(const u8 *displayid, int length, int idx)

base = (const struct displayid_header *)&displayid[idx];

- 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 3841aba17abd..ee16ebf88eea 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -1987,7 +1987,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. */
@@ -2173,8 +2173,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);
@@ -5629,7 +5630,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;
}
@@ -5674,7 +5675,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;
}
@@ -5801,7 +5802,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;
}

@@ -5812,8 +5813,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_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c
index b602cd72a120..f0b6b69f4baf 100644
--- a/drivers/gpu/drm/drm_gem_shmem_helper.c
+++ b/drivers/gpu/drm/drm_gem_shmem_helper.c
@@ -173,7 +173,7 @@ static int drm_gem_shmem_get_pages_locked(struct drm_gem_shmem_object *shmem)

pages = drm_gem_get_pages(obj);
if (IS_ERR(pages)) {
- DRM_DEBUG_KMS("Failed to get pages (%ld)\n", PTR_ERR(pages));
+ drm_dbg_kms(NULL, "Failed to get pages (%ld)\n", PTR_ERR(pages));
shmem->pages_use_count = 0;
return PTR_ERR(pages);
}
@@ -326,7 +326,7 @@ static int drm_gem_shmem_vmap_locked(struct drm_gem_shmem_object *shmem,
}

if (ret) {
- DRM_DEBUG_KMS("Failed to vmap pages, error %d\n", ret);
+ drm_dbg_kms(NULL, "Failed to vmap pages, error %d\n", ret);
goto err_put_pages;
}

diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c
index a4b50fdbaaf7..c442d5e766d1 100644
--- a/drivers/gpu/drm/drm_lease.c
+++ b/drivers/gpu/drm/drm_lease.c
@@ -400,7 +400,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 6ad399f6ab03..64a976675fde 100644
--- a/drivers/gpu/drm/drm_mipi_dbi.c
+++ b/drivers/gpu/drm/drm_mipi_dbi.c
@@ -282,7 +282,8 @@ static void mipi_dbi_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect)

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) {
@@ -418,7 +419,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);
@@ -551,7 +552,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 3c8034a8c27b..112429eb3709 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -52,11 +52,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);

@@ -1336,9 +1336,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 5e3b82bf197a..ad623a085362 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -270,7 +270,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;
}
@@ -297,7 +297,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;
@@ -781,7 +781,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;
}

@@ -789,8 +789,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;
}

@@ -799,8 +800,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;
}

@@ -977,24 +978,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;
}
}
@@ -1043,7 +1043,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);
}

@@ -1114,7 +1114,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;
}

@@ -1335,7 +1335,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 bcd9611dabfd..5aca64370cb5 100644
--- a/drivers/gpu/drm/drm_probe_helper.c
+++ b/drivers/gpu/drm/drm_probe_helper.c
@@ -498,8 +498,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);
@@ -542,11 +542,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
@@ -567,8 +568,8 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
dev->mode_config.poll_running = drm_kms_helper_poll;

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;
@@ -626,8 +627,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);
@@ -758,14 +759,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 6b090d71d45a..873818348bb4 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -179,10 +179,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.35.1


2022-12-22 16:07:35

by Siddh Raman Pant

[permalink] [raw]
Subject: [PATCH v2 2/9] drm: Remove usage of deprecated DRM_ERROR

drm_print.h says DRM_ERROR is deprecated.
Thus, use newer printing macros drm_err() and pr_err().

Signed-off-by: Siddh Raman Pant <[email protected]>
---
drivers/gpu/drm/drm_bridge.c | 8 ++++----
drivers/gpu/drm/drm_bufs.c | 8 ++++----
drivers/gpu/drm/drm_client_modeset.c | 4 ++--
drivers/gpu/drm/drm_context.c | 4 ++--
drivers/gpu/drm/drm_crtc_helper.c | 6 +++---
drivers/gpu/drm/drm_debugfs_crc.c | 3 ++-
drivers/gpu/drm/drm_drv.c | 8 ++++----
drivers/gpu/drm/drm_framebuffer.c | 3 ++-
drivers/gpu/drm/drm_gem.c | 2 +-
drivers/gpu/drm/drm_gem_dma_helper.c | 2 +-
drivers/gpu/drm/drm_mipi_dbi.c | 2 +-
drivers/gpu/drm/drm_mode_config.c | 2 +-
drivers/gpu/drm/drm_modeset_helper.c | 2 +-
drivers/gpu/drm/drm_plane.c | 2 +-
drivers/gpu/drm/drm_scatter.c | 9 +++++----
drivers/gpu/drm/drm_vm.c | 2 +-
16 files changed, 35 insertions(+), 32 deletions(-)

diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
index 1545c50fd1c8..20a8cde70640 100644
--- a/drivers/gpu/drm/drm_bridge.c
+++ b/drivers/gpu/drm/drm_bridge.c
@@ -312,11 +312,11 @@ int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge,
list_del(&bridge->chain_node);

#ifdef CONFIG_OF
- DRM_ERROR("failed to attach bridge %pOF to encoder %s: %d\n",
- bridge->of_node, encoder->name, ret);
+ drm_err(encoder->dev, "failed to attach bridge %pOF to encoder %s: %d\n",
+ bridge->of_node, encoder->name, ret);
#else
- DRM_ERROR("failed to attach bridge to encoder %s: %d\n",
- encoder->name, ret);
+ drm_err(encoder->dev, "failed to attach bridge to encoder %s: %d\n",
+ encoder->name, ret);
#endif

return ret;
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index fcca21e8efac..98aaf3379a3b 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -1474,15 +1474,15 @@ int drm_legacy_freebufs(struct drm_device *dev, void *data,
if (copy_from_user(&idx, &request->list[i], sizeof(idx)))
return -EFAULT;
if (idx < 0 || idx >= dma->buf_count) {
- DRM_ERROR("Index %d (of %d max)\n",
- idx, dma->buf_count - 1);
+ drm_err(dev, "Index %d (of %d max)\n",
+ idx, dma->buf_count - 1);
return -EINVAL;
}
idx = array_index_nospec(idx, dma->buf_count);
buf = dma->buflist[idx];
if (buf->file_priv != file_priv) {
- DRM_ERROR("Process %d freeing buffer not owned\n",
- task_pid_nr(current));
+ drm_err(dev, "Process %d freeing buffer not owned\n",
+ task_pid_nr(current));
return -EINVAL;
}
drm_legacy_free_buffer(dev, buf);
diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c
index 2b76d4828c5f..c4517dea924e 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -812,7 +812,7 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width,
offsets = kcalloc(connector_count, sizeof(*offsets), GFP_KERNEL);
enabled = kcalloc(connector_count, sizeof(bool), GFP_KERNEL);
if (!crtcs || !modes || !enabled || !offsets) {
- DRM_ERROR("Memory allocation failed\n");
+ drm_err(client->dev, "Memory allocation failed\n");
ret = -ENOMEM;
goto out;
}
@@ -836,7 +836,7 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width,
offsets, enabled, width, height) &&
!drm_client_target_preferred(connectors, connector_count, modes,
offsets, enabled, width, height))
- DRM_ERROR("Unable to find initial modes\n");
+ drm_err(client->dev, "Unable to find initial modes\n");

DRM_DEBUG_KMS("picking CRTCs for %dx%d config\n",
width, height);
diff --git a/drivers/gpu/drm/drm_context.c b/drivers/gpu/drm/drm_context.c
index c6e6a3e7219a..f6d68fad8311 100644
--- a/drivers/gpu/drm/drm_context.c
+++ b/drivers/gpu/drm/drm_context.c
@@ -276,7 +276,7 @@ int drm_legacy_setsareactx(struct drm_device *dev, void *data,
static int drm_context_switch(struct drm_device * dev, int old, int new)
{
if (test_and_set_bit(0, &dev->context_flag)) {
- DRM_ERROR("Reentering -- FIXME\n");
+ drm_err(dev, "Reentering -- FIXME\n");
return -EBUSY;
}

@@ -307,7 +307,7 @@ static int drm_context_switch_complete(struct drm_device *dev,
dev->last_context = new; /* PRE/POST: This is the _only_ writer. */

if (!_DRM_LOCK_IS_HELD(file_priv->master->lock.hw_lock->lock)) {
- DRM_ERROR("Lock isn't held after context switch\n");
+ drm_err(dev, "Lock isn't held after context switch\n");
}

/* If a context switch is ever initiated
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index a209659a996c..ab41dc180c58 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -768,8 +768,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
if (!drm_crtc_helper_set_mode(set->crtc, set->mode,
set->x, set->y,
save_set.fb)) {
- DRM_ERROR("failed to set mode on [CRTC:%d:%s]\n",
- set->crtc->base.id, set->crtc->name);
+ drm_err(dev, "failed to set mode on [CRTC:%d:%s]\n",
+ set->crtc->base.id, set->crtc->name);
set->crtc->primary->fb = save_set.fb;
ret = -EINVAL;
goto fail;
@@ -996,7 +996,7 @@ void drm_helper_resume_force_mode(struct drm_device *dev)

/* Restoring the old config should never fail! */
if (ret == false)
- DRM_ERROR("failed to set mode on crtc %p\n", crtc);
+ drm_err(dev, "failed to set mode on crtc %p\n", crtc);

/* Turn off outputs that were already powered off */
if (drm_helper_choose_crtc_dpms(crtc)) {
diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c
index bbc3bc4ba844..a59ef3f0e4a1 100644
--- a/drivers/gpu/drm/drm_debugfs_crc.c
+++ b/drivers/gpu/drm/drm_debugfs_crc.c
@@ -416,7 +416,8 @@ int drm_crtc_add_crc_entry(struct drm_crtc *crtc, bool has_frame,
spin_unlock_irqrestore(&crc->lock, flags);

if (!was_overflow)
- DRM_ERROR("Overflow of CRC buffer, userspace reads too slow.\n");
+ drm_err(crtc->dev,
+ "Overflow of CRC buffer, userspace reads too slow.\n");

return -ENOBUFS;
}
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index bc98e4bcf2c1..1295ecd98f12 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -177,7 +177,7 @@ static int drm_minor_register(struct drm_device *dev, unsigned int type)
} else {
ret = drm_debugfs_init(minor, minor->index, drm_debugfs_root);
if (ret) {
- DRM_ERROR("DRM: Failed to initialize /sys/kernel/debug/dri.\n");
+ drm_err(dev, "DRM: Failed to initialize /sys/kernel/debug/dri.\n");
goto err_debugfs;
}
}
@@ -629,7 +629,7 @@ static int drm_dev_init(struct drm_device *dev,
if (drm_core_check_feature(dev, DRIVER_COMPUTE_ACCEL) &&
(drm_core_check_feature(dev, DRIVER_RENDER) ||
drm_core_check_feature(dev, DRIVER_MODESET))) {
- DRM_ERROR("DRM driver can't be both a compute acceleration and graphics driver\n");
+ drm_err(dev, "DRM driver can't be both a compute acceleration and graphics driver\n");
return -EINVAL;
}

@@ -652,7 +652,7 @@ static int drm_dev_init(struct drm_device *dev,
inode = drm_fs_inode_new();
if (IS_ERR(inode)) {
ret = PTR_ERR(inode);
- DRM_ERROR("Cannot allocate anonymous inode: %d\n", ret);
+ drm_err(dev, "Cannot allocate anonymous inode: %d\n", ret);
goto err;
}

@@ -683,7 +683,7 @@ static int drm_dev_init(struct drm_device *dev,
if (drm_core_check_feature(dev, DRIVER_GEM)) {
ret = drm_gem_init(dev);
if (ret) {
- DRM_ERROR("Cannot initialize graphics execution manager (GEM)\n");
+ drm_err(dev, "Cannot initialize graphics execution manager (GEM)\n");
goto err;
}
}
diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
index 2dd97473ca10..5aea791f4341 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -1070,7 +1070,8 @@ static void legacy_remove_fb(struct drm_framebuffer *fb)

/* should turn off the crtc */
if (drm_crtc_force_disable(crtc))
- DRM_ERROR("failed to reset crtc %p when fb was deleted\n", crtc);
+ drm_err(dev, "failed to reset crtc %p when fb was deleted\n",
+ crtc);
}
}

diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
index b8db675e7fb5..3c99610afc0a 100644
--- a/drivers/gpu/drm/drm_gem.c
+++ b/drivers/gpu/drm/drm_gem.c
@@ -101,7 +101,7 @@ drm_gem_init(struct drm_device *dev)
vma_offset_manager = drmm_kzalloc(dev, sizeof(*vma_offset_manager),
GFP_KERNEL);
if (!vma_offset_manager) {
- DRM_ERROR("out of memory\n");
+ drm_err(dev, "out of memory\n");
return -ENOMEM;
}

diff --git a/drivers/gpu/drm/drm_gem_dma_helper.c b/drivers/gpu/drm/drm_gem_dma_helper.c
index 1e658c448366..1ba551b0ab97 100644
--- a/drivers/gpu/drm/drm_gem_dma_helper.c
+++ b/drivers/gpu/drm/drm_gem_dma_helper.c
@@ -583,7 +583,7 @@ drm_gem_dma_prime_import_sg_table_vmap(struct drm_device *dev,

ret = dma_buf_vmap_unlocked(attach->dmabuf, &map);
if (ret) {
- DRM_ERROR("Failed to vmap PRIME buffer\n");
+ drm_err(dev, "Failed to vmap PRIME buffer\n");
return ERR_PTR(ret);
}

diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c
index a6ac56580876..24af507bb687 100644
--- a/drivers/gpu/drm/drm_mipi_dbi.c
+++ b/drivers/gpu/drm/drm_mipi_dbi.c
@@ -527,7 +527,7 @@ int mipi_dbi_dev_init_with_formats(struct mipi_dbi_dev *dbidev,
drm_mode_copy(&dbidev->mode, mode);
ret = mipi_dbi_rotate_mode(&dbidev->mode, rotation);
if (ret) {
- DRM_ERROR("Illegal rotation value %u\n", rotation);
+ drm_err(drm, "Illegal rotation value %u\n", rotation);
return -EINVAL;
}

diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c
index 688c8afe0bf1..5dab605520b1 100644
--- a/drivers/gpu/drm/drm_mode_config.c
+++ b/drivers/gpu/drm/drm_mode_config.c
@@ -505,7 +505,7 @@ void drm_mode_config_cleanup(struct drm_device *dev)
if (WARN_ON(!list_empty(&dev->mode_config.connector_list))) {
drm_connector_list_iter_begin(dev, &conn_iter);
drm_for_each_connector_iter(connector, &conn_iter)
- DRM_ERROR("connector %s leaked!\n", connector->name);
+ drm_err(dev, "connector %s leaked!\n", connector->name);
drm_connector_list_iter_end(&conn_iter);
}

diff --git a/drivers/gpu/drm/drm_modeset_helper.c b/drivers/gpu/drm/drm_modeset_helper.c
index f858dfedf2cf..e26b0285dde6 100644
--- a/drivers/gpu/drm/drm_modeset_helper.c
+++ b/drivers/gpu/drm/drm_modeset_helper.c
@@ -235,7 +235,7 @@ int drm_mode_config_helper_resume(struct drm_device *dev)

ret = drm_atomic_helper_resume(dev, dev->mode_config.suspend_state);
if (ret)
- DRM_ERROR("Failed to resume (%d)\n", ret);
+ drm_err(dev, "Failed to resume (%d)\n", ret);
dev->mode_config.suspend_state = NULL;

drm_fb_helper_set_suspend_unlocked(dev->fb_helper, 0);
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 33357629a7f5..a650f06e4cea 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -606,7 +606,7 @@ void drm_plane_force_disable(struct drm_plane *plane)
plane->old_fb = plane->fb;
ret = plane->funcs->disable_plane(plane, NULL);
if (ret) {
- DRM_ERROR("failed to disable plane with busy fb\n");
+ drm_err(plane->dev, "failed to disable plane with busy fb\n");
plane->old_fb = NULL;
return;
}
diff --git a/drivers/gpu/drm/drm_scatter.c b/drivers/gpu/drm/drm_scatter.c
index f4e6184d1877..5b0b2140d535 100644
--- a/drivers/gpu/drm/drm_scatter.c
+++ b/drivers/gpu/drm/drm_scatter.c
@@ -170,9 +170,10 @@ int drm_legacy_sg_alloc(struct drm_device *dev, void *data,
j++, tmp++) {
if (*tmp != 0xcafebabe && error == 0) {
error = 1;
- DRM_ERROR("Scatter allocation error, "
- "pagelist does not match "
- "virtual mapping\n");
+ drm_err(dev,
+ "Scatter allocation error, "
+ "pagelist does not match "
+ "virtual mapping\n");
}
}
tmp = page_address(entry->pagelist[i]);
@@ -183,7 +184,7 @@ int drm_legacy_sg_alloc(struct drm_device *dev, void *data,
}
}
if (error == 0)
- DRM_ERROR("Scatter allocation matches pagelist\n");
+ drm_err(dev, "Scatter allocation matches pagelist\n");
}
#endif

diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c
index f024dc93939e..cdb956af2079 100644
--- a/drivers/gpu/drm/drm_vm.c
+++ b/drivers/gpu/drm/drm_vm.c
@@ -547,7 +547,7 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
return drm_mmap_dma(filp, vma);

if (drm_ht_find_item(&dev->map_hash, vma->vm_pgoff, &hash)) {
- DRM_ERROR("Could not find map\n");
+ drm_err(dev, "Could not find map\n");
return -EINVAL;
}

--
2.35.1


2022-12-22 16:24:12

by Siddh Raman Pant

[permalink] [raw]
Subject: [PATCH v2 9/9] drm/drm_lease: Remove usage of deprecated DRM_DEBUG_LEASE

drm_print.h says DRM_DEBUG_LEASE is deprecated in favor of
drm_dbg_lease().

Signed-off-by: Siddh Raman Pant <[email protected]>
Reviewed-by: Simon Ser <[email protected]>
---
drivers/gpu/drm/drm_lease.c | 64 ++++++++++++++++++++-----------------
1 file changed, 34 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c
index c442d5e766d1..08b4f29f8b61 100644
--- a/drivers/gpu/drm/drm_lease.c
+++ b/drivers/gpu/drm/drm_lease.c
@@ -213,11 +213,11 @@ static struct drm_master *drm_lease_create(struct drm_master *lessor, struct idr
int id;
void *entry;

- DRM_DEBUG_LEASE("lessor %d\n", lessor->lessee_id);
+ drm_dbg_lease(dev, "lessor %d\n", lessor->lessee_id);

lessee = drm_master_create(lessor->dev);
if (!lessee) {
- DRM_DEBUG_LEASE("drm_master_create failed\n");
+ drm_dbg_lease(dev, "drm_master_create failed\n");
return ERR_PTR(-ENOMEM);
}

@@ -231,7 +231,7 @@ static struct drm_master *drm_lease_create(struct drm_master *lessor, struct idr
error = -EBUSY;

if (error != 0) {
- DRM_DEBUG_LEASE("object %d failed %d\n", object, error);
+ drm_dbg_lease(dev, "object %d failed %d\n", object, error);
goto out_lessee;
}
}
@@ -249,7 +249,8 @@ static struct drm_master *drm_lease_create(struct drm_master *lessor, struct idr

/* Move the leases over */
lessee->leases = *leases;
- DRM_DEBUG_LEASE("new lessee %d %p, lessor %d %p\n", lessee->lessee_id, lessee, lessor->lessee_id, lessor);
+ drm_dbg_lease(dev, "new lessee %d %p, lessor %d %p\n",
+ lessee->lessee_id, lessee, lessor->lessee_id, lessor);

mutex_unlock(&dev->mode_config.idr_mutex);
return lessee;
@@ -268,7 +269,7 @@ void drm_lease_destroy(struct drm_master *master)

mutex_lock(&dev->mode_config.idr_mutex);

- DRM_DEBUG_LEASE("drm_lease_destroy %d\n", master->lessee_id);
+ drm_dbg_lease(dev, "drm_lease_destroy %d\n", master->lessee_id);

/* This master is referenced by all lessees, hence it cannot be destroyed
* until all of them have been
@@ -277,7 +278,8 @@ void drm_lease_destroy(struct drm_master *master)

/* Remove this master from the lessee idr in the owner */
if (master->lessee_id != 0) {
- DRM_DEBUG_LEASE("remove master %d from device list of lessees\n", master->lessee_id);
+ drm_dbg_lease(dev, "remove master %d from device list of lessees\n",
+ master->lessee_id);
idr_remove(&(drm_lease_owner(master)->lessee_idr), master->lessee_id);
}

@@ -292,7 +294,7 @@ void drm_lease_destroy(struct drm_master *master)
drm_master_put(&master->lessor);
}

- DRM_DEBUG_LEASE("drm_lease_destroy done %d\n", master->lessee_id);
+ drm_dbg_lease(dev, "drm_lease_destroy done %d\n", master->lessee_id);
}

static void _drm_lease_revoke(struct drm_master *top)
@@ -308,7 +310,8 @@ static void _drm_lease_revoke(struct drm_master *top)
* the tree is fully connected, we can do this without recursing
*/
for (;;) {
- DRM_DEBUG_LEASE("revoke leases for %p %d\n", master, master->lessee_id);
+ drm_dbg_lease(master->dev, "revoke leases for %p %d\n",
+ master, master->lessee_id);

/* Evacuate the lease */
idr_for_each_entry(&master->leases, entry, object)
@@ -408,7 +411,7 @@ static int fill_object_idr(struct drm_device *dev,

ret = validate_lease(dev, object_count, objects, universal_planes);
if (ret) {
- DRM_DEBUG_LEASE("lease validation failed\n");
+ drm_dbg_lease(dev, "lease validation failed\n");
goto out_free_objects;
}

@@ -418,7 +421,7 @@ static int fill_object_idr(struct drm_device *dev,
struct drm_mode_object *obj = objects[o];
u32 object_id = objects[o]->id;

- DRM_DEBUG_LEASE("Adding object %d to lease\n", object_id);
+ drm_dbg_lease(dev, "Adding object %d to lease\n", object_id);

/*
* We're using an IDR to hold the set of leased
@@ -430,8 +433,8 @@ static int fill_object_idr(struct drm_device *dev,
*/
ret = idr_alloc(leases, &drm_lease_idr_object , object_id, object_id + 1, GFP_KERNEL);
if (ret < 0) {
- DRM_DEBUG_LEASE("Object %d cannot be inserted into leases (%d)\n",
- object_id, ret);
+ drm_dbg_lease(dev, "Object %d cannot be inserted into leases (%d)\n",
+ object_id, ret);
goto out_free_objects;
}
if (obj->type == DRM_MODE_OBJECT_CRTC && !universal_planes) {
@@ -439,15 +442,15 @@ static int fill_object_idr(struct drm_device *dev,

ret = idr_alloc(leases, &drm_lease_idr_object, crtc->primary->base.id, crtc->primary->base.id + 1, GFP_KERNEL);
if (ret < 0) {
- DRM_DEBUG_LEASE("Object primary plane %d cannot be inserted into leases (%d)\n",
- object_id, ret);
+ drm_dbg_lease(dev, "Object primary plane %d cannot be inserted into leases (%d)\n",
+ object_id, ret);
goto out_free_objects;
}
if (crtc->cursor) {
ret = idr_alloc(leases, &drm_lease_idr_object, crtc->cursor->base.id, crtc->cursor->base.id + 1, GFP_KERNEL);
if (ret < 0) {
- DRM_DEBUG_LEASE("Object cursor plane %d cannot be inserted into leases (%d)\n",
- object_id, ret);
+ drm_dbg_lease(dev, "Object cursor plane %d cannot be inserted into leases (%d)\n",
+ object_id, ret);
goto out_free_objects;
}
}
@@ -490,14 +493,14 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev,
return -EOPNOTSUPP;

if (cl->flags && (cl->flags & ~(O_CLOEXEC | O_NONBLOCK))) {
- DRM_DEBUG_LEASE("invalid flags\n");
+ drm_dbg_lease(dev, "invalid flags\n");
return -EINVAL;
}

lessor = drm_file_get_master(lessor_priv);
/* Do not allow sub-leases */
if (lessor->lessor) {
- DRM_DEBUG_LEASE("recursive leasing not allowed\n");
+ drm_dbg_lease(dev, "recursive leasing not allowed\n");
ret = -EINVAL;
goto out_lessor;
}
@@ -520,7 +523,7 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev,
object_count, object_ids);
kfree(object_ids);
if (ret) {
- DRM_DEBUG_LEASE("lease object lookup failed: %i\n", ret);
+ drm_dbg_lease(dev, "lease object lookup failed: %i\n", ret);
idr_destroy(&leases);
goto out_lessor;
}
@@ -534,7 +537,7 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev,
goto out_lessor;
}

- DRM_DEBUG_LEASE("Creating lease\n");
+ drm_dbg_lease(dev, "Creating lease\n");
/* lessee will take the ownership of leases */
lessee = drm_lease_create(lessor, &leases);

@@ -545,7 +548,7 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev,
}

/* Clone the lessor file to create a new file for us */
- DRM_DEBUG_LEASE("Allocating lease file\n");
+ drm_dbg_lease(dev, "Allocating lease file\n");
lessee_file = file_clone_open(lessor_file);
if (IS_ERR(lessee_file)) {
ret = PTR_ERR(lessee_file);
@@ -560,7 +563,7 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev,
lessee_priv->authenticated = 1;

/* Pass fd back to userspace */
- DRM_DEBUG_LEASE("Returning fd %d id %d\n", fd, lessee->lessee_id);
+ drm_dbg_lease(dev, "Returning fd %d id %d\n", fd, lessee->lessee_id);
cl->fd = fd;
cl->lessee_id = lessee->lessee_id;

@@ -568,7 +571,7 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev,
fd_install(fd, lessee_file);

drm_master_put(&lessor);
- DRM_DEBUG_LEASE("drm_mode_create_lease_ioctl succeeded\n");
+ drm_dbg_lease(dev, "drm_mode_create_lease_ioctl succeeded\n");
return 0;

out_lessee:
@@ -579,7 +582,7 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev,

out_lessor:
drm_master_put(&lessor);
- DRM_DEBUG_LEASE("drm_mode_create_lease_ioctl failed: %d\n", ret);
+ drm_dbg_lease(dev, "drm_mode_create_lease_ioctl failed: %d\n", ret);
return ret;
}

@@ -601,7 +604,7 @@ int drm_mode_list_lessees_ioctl(struct drm_device *dev,
return -EOPNOTSUPP;

lessor = drm_file_get_master(lessor_priv);
- DRM_DEBUG_LEASE("List lessees for %d\n", lessor->lessee_id);
+ drm_dbg_lease(dev, "List lessees for %d\n", lessor->lessee_id);

mutex_lock(&dev->mode_config.idr_mutex);

@@ -610,7 +613,8 @@ int drm_mode_list_lessees_ioctl(struct drm_device *dev,
/* Only list un-revoked leases */
if (!idr_is_empty(&lessee->leases)) {
if (count_lessees > count) {
- DRM_DEBUG_LEASE("Add lessee %d\n", lessee->lessee_id);
+ drm_dbg_lease(dev, "Add lessee %d\n",
+ lessee->lessee_id);
ret = put_user(lessee->lessee_id, lessee_ids + count);
if (ret)
break;
@@ -619,7 +623,7 @@ int drm_mode_list_lessees_ioctl(struct drm_device *dev,
}
}

- DRM_DEBUG_LEASE("Lessor leases to %d\n", count);
+ drm_dbg_lease(dev, "Lessor leases to %d\n", count);
if (ret == 0)
arg->count_lessees = count;

@@ -651,7 +655,7 @@ int drm_mode_get_lease_ioctl(struct drm_device *dev,
return -EOPNOTSUPP;

lessee = drm_file_get_master(lessee_priv);
- DRM_DEBUG_LEASE("get lease for %d\n", lessee->lessee_id);
+ drm_dbg_lease(dev, "get lease for %d\n", lessee->lessee_id);

mutex_lock(&dev->mode_config.idr_mutex);

@@ -665,7 +669,7 @@ int drm_mode_get_lease_ioctl(struct drm_device *dev,
count = 0;
idr_for_each_entry(object_idr, entry, object) {
if (count_objects > count) {
- DRM_DEBUG_LEASE("adding object %d\n", object);
+ drm_dbg_lease(dev, "adding object %d\n", object);
ret = put_user(object, object_ids + count);
if (ret)
break;
@@ -696,7 +700,7 @@ int drm_mode_revoke_lease_ioctl(struct drm_device *dev,
struct drm_master *lessee;
int ret = 0;

- DRM_DEBUG_LEASE("revoke lease for %d\n", arg->lessee_id);
+ drm_dbg_lease(dev, "revoke lease for %d\n", arg->lessee_id);

/* Can't lease without MODESET */
if (!drm_core_check_feature(dev, DRIVER_MODESET))
--
2.35.1


2022-12-26 18:18:45

by Siddh Raman Pant

[permalink] [raw]
Subject: Re: [PATCH v2 0/9] drm: Remove usage of deprecated DRM_* macros

On Thu, 22 Dec 2022 21:10:34 +0530, Siddh Raman Pant wrote:
> Changes in v2:
> - 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.

I just noticed I forgot to change commit message mentioning pr_*()
after squashing. Apologies for this.

I will send a v3, rebased to drm-misc-next, and also fixing the docs message
pointed out by robot, as well as supporting NULL so pr_* stuff can be moved
to drm_*(NULL, ...).

Thanks,
Siddh