[Intel-gfx] [PATCH 8/9] drm/i915: Print DisplayPort clocks on a single line
Tvrtko Ursulin
tvrtko.ursulin at linux.intel.com
Wed Apr 27 10:07:01 UTC 2016
From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Tidy debug logging a bit and avoid allocating the buffer on the stack,
removing one FIXME tag in the process. Replaces current debug of:
[ 4.236714] [drm:intel_dp_print_rates] source rates: 162000, 270000, 540000
[ 4.236715] [drm:intel_dp_print_rates] sink rates: 162000, 270000
[ 4.236716] [drm:intel_dp_print_rates] common rates: 162000, 270000
With:
[ 4.245597] [drm:intel_dp_print_rates] source=[162k, 270k, 540k]; sink=[162k, 270k]; common=[162k, 270k]
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
drivers/gpu/drm/i915/intel_dp.c | 33 +++++++++++++--------------------
1 file changed, 13 insertions(+), 20 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index c12c41482de7..7274def0fbca 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1349,20 +1349,12 @@ static int intel_dp_common_rates(struct intel_dp *intel_dp,
common_rates);
}
-static void snprintf_int_array(char *str, size_t len,
- const int *array, int nelem)
+static void printk_dp_rates(const int *array, unsigned int nelem)
{
- int i;
-
- str[0] = '\0';
+ unsigned int i;
- for (i = 0; i < nelem; i++) {
- int r = snprintf(str, len, "%s%d", i ? ", " : "", array[i]);
- if (r >= len)
- return;
- str += r;
- len -= r;
- }
+ for (i = 0; i < nelem; i++)
+ printk("%s%dk", i ? ", " : "", array[i] / 1000);
}
static void intel_dp_print_rates(struct intel_dp *intel_dp)
@@ -1370,22 +1362,23 @@ static void intel_dp_print_rates(struct intel_dp *intel_dp)
const int *source_rates, *sink_rates;
int source_len, sink_len, common_len;
int common_rates[DP_MAX_SUPPORTED_RATES];
- char str[128]; /* FIXME: too big for stack? */
- if ((drm_debug & DRM_UT_KMS) == 0)
+ if ((drm_debug & DRM_UT_KMS) == 0 )
return;
source_len = intel_dp_source_rates(intel_dp, &source_rates);
- snprintf_int_array(str, sizeof(str), source_rates, source_len);
- DRM_DEBUG_KMS("source rates: %s\n", str);
+ DRM_DEBUG_KMS("source=[");
+ printk_dp_rates(source_rates, source_len);
sink_len = intel_dp_sink_rates(intel_dp, &sink_rates);
- snprintf_int_array(str, sizeof(str), sink_rates, sink_len);
- DRM_DEBUG_KMS("sink rates: %s\n", str);
+ printk("]; sink=[");
+ printk_dp_rates(sink_rates, sink_len);
common_len = intel_dp_common_rates(intel_dp, common_rates);
- snprintf_int_array(str, sizeof(str), common_rates, common_len);
- DRM_DEBUG_KMS("common rates: %s\n", str);
+ printk("]; common=[");
+ printk_dp_rates(common_rates, common_len);
+
+ printk("]\n");
}
static int rate_to_index(int find, const int *rates)
--
1.9.1
More information about the Intel-gfx
mailing list