[Intel-gfx] [PATCH 02/17] drm/i915/panel: use struct drm_device based logging
Jani Nikula
jani.nikula at intel.com
Mon Apr 6 11:07:44 UTC 2020
On Mon, 06 Apr 2020, "Bharadiya,Pankaj" <pankaj.laxminarayan.bharadiya at intel.com> wrote:
> On Thu, Apr 02, 2020 at 02:48:04PM +0300, Jani Nikula wrote:
>> Convert all the DRM_* logging macros to the struct drm_device based
>> macros to provide device specific logging.
>>
>> No functional changes.
>>
>> Generated using the following semantic patch, originally written by
>> Wambui Karuga <wambui.karugax at gmail.com>, with manual fixups on top:
>>
>> @@
>> identifier fn, T;
>> @@
>>
>> fn(...,struct drm_i915_private *T,...) {
>> <+...
>> (
>> -DRM_INFO(
>> +drm_info(&T->drm,
>> ...)
>> |
>> -DRM_NOTE(
>> +drm_notice(&T->drm,
>> ...)
>> |
>> -DRM_ERROR(
>> +drm_err(&T->drm,
>> ...)
>> |
>> -DRM_WARN(
>> +drm_warn(&T->drm,
>> ...)
>> |
>> -DRM_DEBUG_DRIVER(
>> +drm_dbg(&T->drm,
>> ...)
>> |
>> -DRM_DEBUG_KMS(
>> +drm_dbg_kms(&T->drm,
>> ...)
>> |
>> -DRM_DEBUG_ATOMIC(
>> +drm_dbg_atomic(&T->drm,
>> ...)
>> )
>> ...+>
>> }
>>
>> @@
>> identifier fn, T;
>> @@
>>
>> fn(...) {
>> ...
>> struct drm_i915_private *T = ...;
>> <+...
>> (
>> -DRM_INFO(
>> +drm_info(&T->drm,
>> ...)
>> |
>> -DRM_NOTE(
>> +drm_notice(&T->drm,
>> ...)
>> |
>> -DRM_ERROR(
>> +drm_err(&T->drm,
>> ...)
>> |
>> -DRM_WARN(
>> +drm_warn(&T->drm,
>> ...)
>> |
>> -DRM_DEBUG_DRIVER(
>> +drm_dbg(&T->drm,
>> ...)
>> |
>> -DRM_DEBUG_KMS(
>> +drm_dbg_kms(&T->drm,
>> ...)
>> |
>> -DRM_DEBUG_ATOMIC(
>> +drm_dbg_atomic(&T->drm,
>> ...)
>> )
>> ...+>
>> }
>>
>> Cc: Wambui Karuga <wambui.karugax at gmail.com>
>> Signed-off-by: Jani Nikula <jani.nikula at intel.com>
>> ---
>> drivers/gpu/drm/i915/display/intel_panel.c | 19 +++++++++++--------
>> 1 file changed, 11 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_panel.c b/drivers/gpu/drm/i915/display/intel_panel.c
>> index 276f43870802..a080a623bed6 100644
>> --- a/drivers/gpu/drm/i915/display/intel_panel.c
>> +++ b/drivers/gpu/drm/i915/display/intel_panel.c
>> @@ -684,9 +684,10 @@ static void
>> intel_panel_actually_set_backlight(const struct drm_connector_state *conn_state, u32 level)
>> {
>> struct intel_connector *connector = to_intel_connector(conn_state->connector);
>> + struct drm_i915_private *i915 = to_i915(connector->base.dev);
>
> This addition does not match with the cocci script mentioned in the
> commit description.
> Are you sure same script is used to generate this patch?
I've made some manual changes, such as adding locals first and then
running the script.
BR,
Jani.
>
>> struct intel_panel *panel = &connector->panel;
>>
>> - DRM_DEBUG_DRIVER("set backlight PWM = %d\n", level);
>> + drm_dbg_kms(&i915->drm, "set backlight PWM = %d\n", level);
>>
>> level = intel_panel_compute_brightness(connector, level);
>> panel->backlight.set(conn_state, level);
>> @@ -867,8 +868,8 @@ void intel_panel_disable_backlight(const struct drm_connector_state *old_conn_st
>> * another client is not activated.
>> */
>> if (dev_priv->drm.switch_power_state == DRM_SWITCH_POWER_CHANGING) {
>> - drm_dbg(&dev_priv->drm,
>> - "Skipping backlight disable on vga switch\n");
>> + drm_dbg_kms(&dev_priv->drm,
>> + "Skipping backlight disable on vga switch\n");
>> return;
>> }
>>
>> @@ -1244,7 +1245,7 @@ static u32 intel_panel_get_backlight(struct intel_connector *connector)
>>
>> mutex_unlock(&dev_priv->backlight_lock);
>>
>> - drm_dbg(&dev_priv->drm, "get backlight PWM = %d\n", val);
>> + drm_dbg_kms(&dev_priv->drm, "get backlight PWM = %d\n", val);
>> return val;
>> }
>>
>> @@ -1335,6 +1336,7 @@ static const struct backlight_ops intel_backlight_device_ops = {
>>
>> int intel_backlight_device_register(struct intel_connector *connector)
>> {
>> + struct drm_i915_private *i915 = to_i915(connector->base.dev);
>
> Same as above.
>
>> struct intel_panel *panel = &connector->panel;
>> struct backlight_properties props;
>>
>> @@ -1374,14 +1376,15 @@ int intel_backlight_device_register(struct intel_connector *connector)
>> &intel_backlight_device_ops, &props);
>>
>> if (IS_ERR(panel->backlight.device)) {
>> - DRM_ERROR("Failed to register backlight: %ld\n",
>> - PTR_ERR(panel->backlight.device));
>> + drm_err(&i915->drm, "Failed to register backlight: %ld\n",
>> + PTR_ERR(panel->backlight.device));
>> panel->backlight.device = NULL;
>> return -ENODEV;
>> }
>>
>> - DRM_DEBUG_KMS("Connector %s backlight sysfs interface registered\n",
>> - connector->base.name);
>> + drm_dbg_kms(&i915->drm,
>> + "Connector %s backlight sysfs interface registered\n",
>> + connector->base.name);
>>
>> return 0;
>> }
>> --
>> 2.20.1
>>
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Jani Nikula, Intel Open Source Graphics Center
More information about the Intel-gfx
mailing list