]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/panel: automatic conversion to drm_device based logging macros.
authorWambui Karuga <wambui.karugax@gmail.com>
Thu, 30 Jan 2020 08:32:29 +0000 (11:32 +0300)
committerJani Nikula <jani.nikula@intel.com>
Tue, 4 Feb 2020 09:13:48 +0000 (11:13 +0200)
Converts various instances of the printk based drm logging macros to the
struct drm_device based logging macros in i915/display/intel_panel.c
using the following coccinelle script that transforms based on the
existence of a struct drm_i915_private device pointer:
@@
identifier fn, T;
@@

fn(...) {
...
struct drm_i915_private *T = ...;
<+...
(
-DRM_INFO(
+drm_info(&T->drm,
...)
|
-DRM_ERROR(
+drm_err(&T->drm,
...)
|
-DRM_WARN(
+drm_warn(&T->drm,
...)
|
-DRM_DEBUG(
+drm_dbg(&T->drm,
...)
|
-DRM_DEBUG_KMS(
+drm_dbg_kms(&T->drm,
...)
|
-DRM_DEBUG_DRIVER(
+drm_dbg(&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_ERROR(
+drm_err(&T->drm,
...)
|
-DRM_WARN(
+drm_warn(&T->drm,
...)
|
-DRM_DEBUG(
+drm_dbg(&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,
...)
)
...+>
}

Checkpatch warnings were addressed manually.

Signed-off-by: Wambui Karuga <wambui.karugax@gmail.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200130083229.12889-13-wambui.karugax@gmail.com
drivers/gpu/drm/i915/display/intel_panel.c

index 7b035f44fce783b105eabd032098e2716fc977a2..cba2f1c2557f856ffb082be5b9f1cefad492ee3d 100644 (file)
@@ -96,8 +96,9 @@ intel_panel_edid_downclock_mode(struct intel_connector *connector,
        if (!downclock_mode)
                return NULL;
 
-       DRM_DEBUG_KMS("[CONNECTOR:%d:%s] using downclock mode from EDID: ",
-                     connector->base.base.id, connector->base.name);
+       drm_dbg_kms(&dev_priv->drm,
+                   "[CONNECTOR:%d:%s] using downclock mode from EDID: ",
+                   connector->base.base.id, connector->base.name);
        drm_mode_debug_printmodeline(downclock_mode);
 
        return downclock_mode;
@@ -122,8 +123,9 @@ intel_panel_edid_fixed_mode(struct intel_connector *connector)
                if (!fixed_mode)
                        return NULL;
 
-               DRM_DEBUG_KMS("[CONNECTOR:%d:%s] using preferred mode from EDID: ",
-                             connector->base.base.id, connector->base.name);
+               drm_dbg_kms(&dev_priv->drm,
+                           "[CONNECTOR:%d:%s] using preferred mode from EDID: ",
+                           connector->base.base.id, connector->base.name);
                drm_mode_debug_printmodeline(fixed_mode);
 
                return fixed_mode;
@@ -138,8 +140,9 @@ intel_panel_edid_fixed_mode(struct intel_connector *connector)
 
        fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
 
-       DRM_DEBUG_KMS("[CONNECTOR:%d:%s] using first mode from EDID: ",
-                     connector->base.base.id, connector->base.name);
+       drm_dbg_kms(&dev_priv->drm,
+                   "[CONNECTOR:%d:%s] using first mode from EDID: ",
+                   connector->base.base.id, connector->base.name);
        drm_mode_debug_printmodeline(fixed_mode);
 
        return fixed_mode;
@@ -162,8 +165,8 @@ intel_panel_vbt_fixed_mode(struct intel_connector *connector)
 
        fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
 
-       DRM_DEBUG_KMS("[CONNECTOR:%d:%s] using mode from VBT: ",
-                     connector->base.base.id, connector->base.name);
+       drm_dbg_kms(&dev_priv->drm, "[CONNECTOR:%d:%s] using mode from VBT: ",
+                   connector->base.base.id, connector->base.name);
        drm_mode_debug_printmodeline(fixed_mode);
 
        info->width_mm = fixed_mode->width_mm;
@@ -747,7 +750,8 @@ static void lpt_disable_backlight(const struct drm_connector_state *old_conn_sta
         */
        tmp = intel_de_read(dev_priv, BLC_PWM_CPU_CTL2);
        if (tmp & BLM_PWM_ENABLE) {
-               DRM_DEBUG_KMS("cpu backlight was enabled, disabling\n");
+               drm_dbg_kms(&dev_priv->drm,
+                           "cpu backlight was enabled, disabling\n");
                intel_de_write(dev_priv, BLC_PWM_CPU_CTL2,
                               tmp & ~BLM_PWM_ENABLE);
        }
@@ -864,7 +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_DEBUG_DRIVER("Skipping backlight disable on vga switch\n");
+               drm_dbg(&dev_priv->drm,
+                       "Skipping backlight disable on vga switch\n");
                return;
        }
 
@@ -888,7 +893,7 @@ static void lpt_enable_backlight(const struct intel_crtc_state *crtc_state,
 
        pch_ctl1 = intel_de_read(dev_priv, BLC_PWM_PCH_CTL1);
        if (pch_ctl1 & BLM_PCH_PWM_ENABLE) {
-               DRM_DEBUG_KMS("pch backlight already enabled\n");
+               drm_dbg_kms(&dev_priv->drm, "pch backlight already enabled\n");
                pch_ctl1 &= ~BLM_PCH_PWM_ENABLE;
                intel_de_write(dev_priv, BLC_PWM_PCH_CTL1, pch_ctl1);
        }
@@ -940,14 +945,14 @@ static void pch_enable_backlight(const struct intel_crtc_state *crtc_state,
 
        cpu_ctl2 = intel_de_read(dev_priv, BLC_PWM_CPU_CTL2);
        if (cpu_ctl2 & BLM_PWM_ENABLE) {
-               DRM_DEBUG_KMS("cpu backlight already enabled\n");
+               drm_dbg_kms(&dev_priv->drm, "cpu backlight already enabled\n");
                cpu_ctl2 &= ~BLM_PWM_ENABLE;
                intel_de_write(dev_priv, BLC_PWM_CPU_CTL2, cpu_ctl2);
        }
 
        pch_ctl1 = intel_de_read(dev_priv, BLC_PWM_PCH_CTL1);
        if (pch_ctl1 & BLM_PCH_PWM_ENABLE) {
-               DRM_DEBUG_KMS("pch backlight already enabled\n");
+               drm_dbg_kms(&dev_priv->drm, "pch backlight already enabled\n");
                pch_ctl1 &= ~BLM_PCH_PWM_ENABLE;
                intel_de_write(dev_priv, BLC_PWM_PCH_CTL1, pch_ctl1);
        }
@@ -986,7 +991,7 @@ static void i9xx_enable_backlight(const struct intel_crtc_state *crtc_state,
 
        ctl = intel_de_read(dev_priv, BLC_PWM_CTL);
        if (ctl & BACKLIGHT_DUTY_CYCLE_MASK_PNV) {
-               DRM_DEBUG_KMS("backlight already enabled\n");
+               drm_dbg_kms(&dev_priv->drm, "backlight already enabled\n");
                intel_de_write(dev_priv, BLC_PWM_CTL, 0);
        }
 
@@ -1026,7 +1031,7 @@ static void i965_enable_backlight(const struct intel_crtc_state *crtc_state,
 
        ctl2 = intel_de_read(dev_priv, BLC_PWM_CTL2);
        if (ctl2 & BLM_PWM_ENABLE) {
-               DRM_DEBUG_KMS("backlight already enabled\n");
+               drm_dbg_kms(&dev_priv->drm, "backlight already enabled\n");
                ctl2 &= ~BLM_PWM_ENABLE;
                intel_de_write(dev_priv, BLC_PWM_CTL2, ctl2);
        }
@@ -1061,7 +1066,7 @@ static void vlv_enable_backlight(const struct intel_crtc_state *crtc_state,
 
        ctl2 = intel_de_read(dev_priv, VLV_BLC_PWM_CTL2(pipe));
        if (ctl2 & BLM_PWM_ENABLE) {
-               DRM_DEBUG_KMS("backlight already enabled\n");
+               drm_dbg_kms(&dev_priv->drm, "backlight already enabled\n");
                ctl2 &= ~BLM_PWM_ENABLE;
                intel_de_write(dev_priv, VLV_BLC_PWM_CTL2(pipe), ctl2);
        }
@@ -1094,7 +1099,8 @@ static void bxt_enable_backlight(const struct intel_crtc_state *crtc_state,
        if (panel->backlight.controller == 1) {
                val = intel_de_read(dev_priv, UTIL_PIN_CTL);
                if (val & UTIL_PIN_ENABLE) {
-                       DRM_DEBUG_KMS("util pin already enabled\n");
+                       drm_dbg_kms(&dev_priv->drm,
+                                   "util pin already enabled\n");
                        val &= ~UTIL_PIN_ENABLE;
                        intel_de_write(dev_priv, UTIL_PIN_CTL, val);
                }
@@ -1109,7 +1115,7 @@ static void bxt_enable_backlight(const struct intel_crtc_state *crtc_state,
        pwm_ctl = intel_de_read(dev_priv,
                                BXT_BLC_PWM_CTL(panel->backlight.controller));
        if (pwm_ctl & BXT_BLC_PWM_ENABLE) {
-               DRM_DEBUG_KMS("backlight already enabled\n");
+               drm_dbg_kms(&dev_priv->drm, "backlight already enabled\n");
                pwm_ctl &= ~BXT_BLC_PWM_ENABLE;
                intel_de_write(dev_priv,
                               BXT_BLC_PWM_CTL(panel->backlight.controller),
@@ -1145,7 +1151,7 @@ static void cnp_enable_backlight(const struct intel_crtc_state *crtc_state,
        pwm_ctl = intel_de_read(dev_priv,
                                BXT_BLC_PWM_CTL(panel->backlight.controller));
        if (pwm_ctl & BXT_BLC_PWM_ENABLE) {
-               DRM_DEBUG_KMS("backlight already enabled\n");
+               drm_dbg_kms(&dev_priv->drm, "backlight already enabled\n");
                pwm_ctl &= ~BXT_BLC_PWM_ENABLE;
                intel_de_write(dev_priv,
                               BXT_BLC_PWM_CTL(panel->backlight.controller),
@@ -1214,7 +1220,7 @@ void intel_panel_enable_backlight(const struct intel_crtc_state *crtc_state,
        if (!panel->backlight.present)
                return;
 
-       DRM_DEBUG_KMS("pipe %c\n", pipe_name(pipe));
+       drm_dbg_kms(&dev_priv->drm, "pipe %c\n", pipe_name(pipe));
 
        mutex_lock(&dev_priv->backlight_lock);
 
@@ -1239,7 +1245,7 @@ static u32 intel_panel_get_backlight(struct intel_connector *connector)
 
        mutex_unlock(&dev_priv->backlight_lock);
 
-       DRM_DEBUG_DRIVER("get backlight PWM = %d\n", val);
+       drm_dbg(&dev_priv->drm, "get backlight PWM = %d\n", val);
        return val;
 }
 
@@ -1535,22 +1541,26 @@ static u32 get_backlight_max_vbt(struct intel_connector *connector)
        u32 pwm;
 
        if (!panel->backlight.hz_to_pwm) {
-               DRM_DEBUG_KMS("backlight frequency conversion not supported\n");
+               drm_dbg_kms(&dev_priv->drm,
+                           "backlight frequency conversion not supported\n");
                return 0;
        }
 
        if (pwm_freq_hz) {
-               DRM_DEBUG_KMS("VBT defined backlight frequency %u Hz\n",
-                             pwm_freq_hz);
+               drm_dbg_kms(&dev_priv->drm,
+                           "VBT defined backlight frequency %u Hz\n",
+                           pwm_freq_hz);
        } else {
                pwm_freq_hz = 200;
-               DRM_DEBUG_KMS("default backlight frequency %u Hz\n",
-                             pwm_freq_hz);
+               drm_dbg_kms(&dev_priv->drm,
+                           "default backlight frequency %u Hz\n",
+                           pwm_freq_hz);
        }
 
        pwm = panel->backlight.hz_to_pwm(connector, pwm_freq_hz);
        if (!pwm) {
-               DRM_DEBUG_KMS("backlight frequency conversion failed\n");
+               drm_dbg_kms(&dev_priv->drm,
+                           "backlight frequency conversion failed\n");
                return 0;
        }
 
@@ -1577,8 +1587,9 @@ static u32 get_backlight_min_vbt(struct intel_connector *connector)
         */
        min = clamp_t(int, dev_priv->vbt.backlight.min_brightness, 0, 64);
        if (min != dev_priv->vbt.backlight.min_brightness) {
-               DRM_DEBUG_KMS("clamping VBT min backlight %d/255 to %d/255\n",
-                             dev_priv->vbt.backlight.min_brightness, min);
+               drm_dbg_kms(&dev_priv->drm,
+                           "clamping VBT min backlight %d/255 to %d/255\n",
+                           dev_priv->vbt.backlight.min_brightness, min);
        }
 
        /* vbt value is a coefficient in range [0..255] */
@@ -1628,7 +1639,8 @@ static int lpt_setup_backlight(struct intel_connector *connector, enum pipe unus
                                       panel->backlight.max);
 
        if (cpu_mode) {
-               DRM_DEBUG_KMS("CPU backlight register was enabled, switching to PCH override\n");
+               drm_dbg_kms(&dev_priv->drm,
+                           "CPU backlight register was enabled, switching to PCH override\n");
 
                /* Write converted CPU PWM value to PCH override register */
                lpt_set_backlight(connector->base.state, panel->backlight.level);
@@ -1881,7 +1893,8 @@ static int pwm_setup_backlight(struct intel_connector *connector,
        }
 
        if (IS_ERR(panel->backlight.pwm)) {
-               DRM_ERROR("Failed to get the %s PWM chip\n", desc);
+               drm_err(&dev_priv->drm, "Failed to get the %s PWM chip\n",
+                       desc);
                panel->backlight.pwm = NULL;
                return -ENODEV;
        }
@@ -1895,7 +1908,7 @@ static int pwm_setup_backlight(struct intel_connector *connector,
        retval = pwm_config(panel->backlight.pwm, CRC_PMIC_PWM_PERIOD_NS,
                            CRC_PMIC_PWM_PERIOD_NS);
        if (retval < 0) {
-               DRM_ERROR("Failed to configure the pwm chip\n");
+               drm_err(&dev_priv->drm, "Failed to configure the pwm chip\n");
                pwm_put(panel->backlight.pwm);
                panel->backlight.pwm = NULL;
                return retval;
@@ -1908,7 +1921,8 @@ static int pwm_setup_backlight(struct intel_connector *connector,
                                 CRC_PMIC_PWM_PERIOD_NS);
        panel->backlight.enabled = panel->backlight.level != 0;
 
-       DRM_INFO("Using %s PWM for LCD backlight control\n", desc);
+       drm_info(&dev_priv->drm, "Using %s PWM for LCD backlight control\n",
+                desc);
        return 0;
 }
 
@@ -1939,9 +1953,11 @@ int intel_panel_setup_backlight(struct drm_connector *connector, enum pipe pipe)
 
        if (!dev_priv->vbt.backlight.present) {
                if (dev_priv->quirks & QUIRK_BACKLIGHT_PRESENT) {
-                       DRM_DEBUG_KMS("no backlight present per VBT, but present per quirk\n");
+                       drm_dbg_kms(&dev_priv->drm,
+                                   "no backlight present per VBT, but present per quirk\n");
                } else {
-                       DRM_DEBUG_KMS("no backlight present per VBT\n");
+                       drm_dbg_kms(&dev_priv->drm,
+                                   "no backlight present per VBT\n");
                        return 0;
                }
        }
@@ -1956,17 +1972,19 @@ int intel_panel_setup_backlight(struct drm_connector *connector, enum pipe pipe)
        mutex_unlock(&dev_priv->backlight_lock);
 
        if (ret) {
-               DRM_DEBUG_KMS("failed to setup backlight for connector %s\n",
-                             connector->name);
+               drm_dbg_kms(&dev_priv->drm,
+                           "failed to setup backlight for connector %s\n",
+                           connector->name);
                return ret;
        }
 
        panel->backlight.present = true;
 
-       DRM_DEBUG_KMS("Connector %s backlight initialized, %s, brightness %u/%u\n",
-                     connector->name,
-                     enableddisabled(panel->backlight.enabled),
-                     panel->backlight.level, panel->backlight.max);
+       drm_dbg_kms(&dev_priv->drm,
+                   "Connector %s backlight initialized, %s, brightness %u/%u\n",
+                   connector->name,
+                   enableddisabled(panel->backlight.enabled),
+                   panel->backlight.level, panel->backlight.max);
 
        return 0;
 }