]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/display: Make WARN* drm specific where drm_device ptr is available
authorPankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Tue, 28 Jan 2020 18:16:01 +0000 (23:46 +0530)
committerJani Nikula <jani.nikula@intel.com>
Tue, 4 Feb 2020 09:00:04 +0000 (11:00 +0200)
drm specific WARN* calls include device information in the
backtrace, so we know what device the warnings originate from.

Covert all the calls of WARN* with device specific drm_WARN*
variants in functions where drm_device or drm_i915_private struct
pointer is readily available.

The conversion was done automatically with below coccinelle semantic
patch. checkpatch errors/warnings are fixed manually.

@rule1@
identifier func, T;
@@
func(...) {
...
struct drm_device *T = ...;
<...
(
-WARN(
+drm_WARN(T,
...)
|
-WARN_ON(
+drm_WARN_ON(T,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(T,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(T,
...)
)
...>
}

@rule2@
identifier func, T;
@@
func(struct drm_device *T,...) {
<...
(
-WARN(
+drm_WARN(T,
...)
|
-WARN_ON(
+drm_WARN_ON(T,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(T,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(T,
...)
)
...>
}

@rule3@
identifier func, T;
@@
func(...) {
...
struct drm_i915_private *T = ...;
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}

@rule4@
identifier func, T;
@@
func(struct drm_i915_private *T,...) {
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}

Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200128181603.27767-20-pankaj.laxminarayan.bharadiya@intel.com
20 files changed:
drivers/gpu/drm/i915/display/intel_atomic.c
drivers/gpu/drm/i915/display/intel_bios.c
drivers/gpu/drm/i915/display/intel_bw.c
drivers/gpu/drm/i915/display/intel_color.c
drivers/gpu/drm/i915/display/intel_combo_phy.c
drivers/gpu/drm/i915/display/intel_connector.c
drivers/gpu/drm/i915/display/intel_dp_mst.c
drivers/gpu/drm/i915/display/intel_dpio_phy.c
drivers/gpu/drm/i915/display/intel_dsb.c
drivers/gpu/drm/i915/display/intel_dsi_dcs_backlight.c
drivers/gpu/drm/i915/display/intel_dsi_vbt.c
drivers/gpu/drm/i915/display/intel_gmbus.c
drivers/gpu/drm/i915/display/intel_hotplug.c
drivers/gpu/drm/i915/display/intel_lpe_audio.c
drivers/gpu/drm/i915/display/intel_lvds.c
drivers/gpu/drm/i915/display/intel_opregion.c
drivers/gpu/drm/i915/display/intel_pipe_crc.c
drivers/gpu/drm/i915/display/intel_sprite.c
drivers/gpu/drm/i915/display/intel_vdsc.c
drivers/gpu/drm/i915/display/vlv_dsi.c

index 9c737aa4cf72cb4bf50f7b4911b108dd530dbbcb..379c12f3b1d4f7cd5733c9645e5207db9dacb2b2 100644 (file)
@@ -318,7 +318,8 @@ static void intel_atomic_setup_scaler(struct intel_crtc_scaler_state *scaler_sta
                }
        }
 
-       if (WARN(*scaler_id < 0, "Cannot find scaler for %s:%d\n", name, idx))
+       if (drm_WARN(&dev_priv->drm, *scaler_id < 0,
+                    "Cannot find scaler for %s:%d\n", name, idx))
                return;
 
        /* set scaler mode */
@@ -469,7 +470,8 @@ int intel_atomic_setup_scalers(struct drm_i915_private *dev_priv,
                        idx = plane->base.id;
 
                        /* plane on different crtc cannot be a scaler user of this crtc */
-                       if (WARN_ON(intel_plane->pipe != intel_crtc->pipe))
+                       if (drm_WARN_ON(&dev_priv->drm,
+                                       intel_plane->pipe != intel_crtc->pipe))
                                continue;
 
                        plane_state = intel_atomic_get_new_plane_state(intel_state,
index 942a073d5768218f9df38f9cf7ef2bc670085ab5..2049cf5b54f38d05d794459d5346fa53ec9284a5 100644 (file)
@@ -228,7 +228,7 @@ parse_panel_options(struct drm_i915_private *dev_priv,
 
        ret = intel_opregion_get_panel_type(dev_priv);
        if (ret >= 0) {
-               WARN_ON(ret > 0xf);
+               drm_WARN_ON(&dev_priv->drm, ret > 0xf);
                panel_type = ret;
                drm_dbg_kms(&dev_priv->drm, "Panel type: %d (OpRegion)\n",
                            panel_type);
@@ -1248,7 +1248,8 @@ static int get_init_otp_deassert_fragment_len(struct drm_i915_private *dev_priv)
        const u8 *data = dev_priv->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP];
        int index, len;
 
-       if (WARN_ON(!data || dev_priv->vbt.dsi.seq_version != 1))
+       if (drm_WARN_ON(&dev_priv->drm,
+                       !data || dev_priv->vbt.dsi.seq_version != 1))
                return 0;
 
        /* index = 1 to skip sequence byte */
@@ -2305,7 +2306,8 @@ bool intel_bios_is_port_present(struct drm_i915_private *dev_priv, enum port por
        }
 
        /* FIXME maybe deal with port A as well? */
-       if (WARN_ON(port == PORT_A) || port >= ARRAY_SIZE(port_mapping))
+       if (drm_WARN_ON(&dev_priv->drm,
+                       port == PORT_A) || port >= ARRAY_SIZE(port_mapping))
                return false;
 
        list_for_each_entry(devdata, &dev_priv->vbt.display_devices, node) {
@@ -2555,7 +2557,7 @@ intel_bios_is_port_hpd_inverted(const struct drm_i915_private *i915,
        const struct child_device_config *child =
                i915->vbt.ddi_port_info[port].child;
 
-       if (WARN_ON_ONCE(!IS_GEN9_LP(i915)))
+       if (drm_WARN_ON_ONCE(&i915->drm, !IS_GEN9_LP(i915)))
                return false;
 
        return child && child->hpd_invert;
index 26fa94329eda531d750ebd6239f178d46457b132..58b264bc318d9fdb9e57326e40c1bf9b931e645b 100644 (file)
@@ -122,7 +122,8 @@ static int icl_get_qgv_points(struct drm_i915_private *dev_priv,
        if (ret)
                return ret;
 
-       if (WARN_ON(qi->num_points > ARRAY_SIZE(qi->points)))
+       if (drm_WARN_ON(&dev_priv->drm,
+                       qi->num_points > ARRAY_SIZE(qi->points)))
                qi->num_points = ARRAY_SIZE(qi->points);
 
        for (i = 0; i < qi->num_points; i++) {
index b5d9ff56a8eb7ff2a408239fd36c5fbbc45ee75f..2087a18524865843ef7d394b786d7680f581b00e 100644 (file)
@@ -309,7 +309,8 @@ static void ilk_load_csc_matrix(const struct intel_crtc_state *crtc_state)
                 * LUT is needed but CSC is not we need to load an
                 * identity matrix.
                 */
-               WARN_ON(!IS_CANNONLAKE(dev_priv) && !IS_GEMINILAKE(dev_priv));
+               drm_WARN_ON(&dev_priv->drm, !IS_CANNONLAKE(dev_priv) &&
+                           !IS_GEMINILAKE(dev_priv));
 
                ilk_update_pipe_csc(crtc, ilk_csc_off_zero,
                                    ilk_csc_coeff_identity,
index 11f80f15cb4ddc18fb3907271d68aa453e2f948f..dc5525ee8dee132b6f7be149fafdba63731ef09c 100644 (file)
@@ -256,7 +256,7 @@ void intel_combo_phy_power_up_lanes(struct drm_i915_private *dev_priv,
        u32 val;
 
        if (is_dsi) {
-               WARN_ON(lane_reversal);
+               drm_WARN_ON(&dev_priv->drm, lane_reversal);
 
                switch (lane_count) {
                case 1:
index 54891a4ed2f300893d9a3fec6c2f76f3e368c5ef..903e49659f561d289852c1b9f4094ab9cbdef37e 100644 (file)
@@ -162,7 +162,8 @@ enum pipe intel_connector_get_pipe(struct intel_connector *connector)
 {
        struct drm_device *dev = connector->base.dev;
 
-       WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex));
+       drm_WARN_ON(dev,
+                   !drm_modeset_is_locked(&dev->mode_config.connection_mutex));
 
        if (!connector->base.state->crtc)
                return INVALID_PIPE;
index 4b05886eb45f6e0bf1bd57e3327443d197cefb00..ffa2aa2222bfe5cdb218c420af63d4c0a06e9dd7 100644 (file)
@@ -351,8 +351,9 @@ static void intel_mst_post_disable_dp(struct intel_encoder *encoder,
 
        intel_dp->active_mst_links--;
        last_mst_stream = intel_dp->active_mst_links == 0;
-       WARN_ON(INTEL_GEN(dev_priv) >= 12 && last_mst_stream &&
-               !intel_dp_mst_is_master_trans(old_crtc_state));
+       drm_WARN_ON(&dev_priv->drm,
+                   INTEL_GEN(dev_priv) >= 12 && last_mst_stream &&
+                   !intel_dp_mst_is_master_trans(old_crtc_state));
 
        intel_crtc_vblank_off(old_crtc_state);
 
@@ -439,8 +440,9 @@ static void intel_mst_pre_enable_dp(struct intel_encoder *encoder,
        connector->encoder = encoder;
        intel_mst->connector = connector;
        first_mst_stream = intel_dp->active_mst_links == 0;
-       WARN_ON(INTEL_GEN(dev_priv) >= 12 && first_mst_stream &&
-               !intel_dp_mst_is_master_trans(pipe_config));
+       drm_WARN_ON(&dev_priv->drm,
+                   INTEL_GEN(dev_priv) >= 12 && first_mst_stream &&
+                   !intel_dp_mst_is_master_trans(pipe_config));
 
        DRM_DEBUG_KMS("active links %d\n", intel_dp->active_mst_links);
 
index e9d46ae75377094ac7f80b77514b2615b9cd6586..85d6471ac357d9481164c0a1d8bd52be967e2173 100644 (file)
@@ -259,7 +259,8 @@ void bxt_port_to_phy_channel(struct drm_i915_private *dev_priv, enum port port,
                }
        }
 
-       WARN(1, "PHY not found for PORT %c", port_name(port));
+       drm_WARN(&dev_priv->drm, 1, "PHY not found for PORT %c",
+                port_name(port));
        *phy = DPIO_PHY0;
        *ch = DPIO_CH0;
 }
index 9dd18144a66469bf86d7d2b30974bbdaf610ef02..76ae01277fd63cc9c1fd6c740818be2d3744da8a 100644 (file)
@@ -165,7 +165,7 @@ void intel_dsb_put(struct intel_dsb *dsb)
        if (!HAS_DSB(i915))
                return;
 
-       if (WARN_ON(dsb->refcount == 0))
+       if (drm_WARN_ON(&i915->drm, dsb->refcount == 0))
                return;
 
        if (--dsb->refcount == 0) {
@@ -202,7 +202,7 @@ void intel_dsb_indexed_reg_write(struct intel_dsb *dsb, i915_reg_t reg,
                return;
        }
 
-       if (WARN_ON(dsb->free_pos >= DSB_BUF_SIZE)) {
+       if (drm_WARN_ON(&dev_priv->drm, dsb->free_pos >= DSB_BUF_SIZE)) {
                DRM_DEBUG_KMS("DSB buffer overflow\n");
                return;
        }
@@ -276,7 +276,7 @@ void intel_dsb_reg_write(struct intel_dsb *dsb, i915_reg_t reg, u32 val)
                return;
        }
 
-       if (WARN_ON(dsb->free_pos >= DSB_BUF_SIZE)) {
+       if (drm_WARN_ON(&dev_priv->drm, dsb->free_pos >= DSB_BUF_SIZE)) {
                DRM_DEBUG_KMS("DSB buffer overflow\n");
                return;
        }
index ac3eff26df12cdd3677d3348c4f7a105ad63cb19..b53c50372918f442871ca4ecab51fce3ebe17114 100644 (file)
@@ -166,7 +166,7 @@ int intel_dsi_dcs_init_backlight_funcs(struct intel_connector *intel_connector)
        if (dev_priv->vbt.backlight.type != INTEL_BACKLIGHT_DSI_DCS)
                return -ENODEV;
 
-       if (WARN_ON(encoder->type != INTEL_OUTPUT_DSI))
+       if (drm_WARN_ON(dev, encoder->type != INTEL_OUTPUT_DSI))
                return -EINVAL;
 
        panel->backlight.setup = dcs_setup_backlight;
index 04f953ba8f0027fb143b9327912cea19e0002c2a..3914cfdab51179248c7e37fd050fc96a25bb1800 100644 (file)
@@ -570,14 +570,15 @@ static void intel_dsi_vbt_exec(struct intel_dsi *intel_dsi,
        const u8 *data;
        fn_mipi_elem_exec mipi_elem_exec;
 
-       if (WARN_ON(seq_id >= ARRAY_SIZE(dev_priv->vbt.dsi.sequence)))
+       if (drm_WARN_ON(&dev_priv->drm,
+                       seq_id >= ARRAY_SIZE(dev_priv->vbt.dsi.sequence)))
                return;
 
        data = dev_priv->vbt.dsi.sequence[seq_id];
        if (!data)
                return;
 
-       WARN_ON(*data != seq_id);
+       drm_WARN_ON(&dev_priv->drm, *data != seq_id);
 
        DRM_DEBUG_KMS("Starting MIPI sequence %d - %s\n",
                      seq_id, sequence_name(seq_id));
index 508308555dc695ec3f4eeb053bd992918275db17..4ef8a81ae0adf4e506442b7cd1ca89344127a8ae 100644 (file)
@@ -904,7 +904,8 @@ err:
 struct i2c_adapter *intel_gmbus_get_adapter(struct drm_i915_private *dev_priv,
                                            unsigned int pin)
 {
-       if (WARN_ON(!intel_gmbus_is_valid_pin(dev_priv, pin)))
+       if (drm_WARN_ON(&dev_priv->drm,
+                       !intel_gmbus_is_valid_pin(dev_priv, pin)))
                return NULL;
 
        return &dev_priv->gmbus[pin].adapter;
index 042d98bae1ea4f64610caa2e814146de66d50db2..6f98440355e178490cd62baa01b1e49b5813d2b0 100644 (file)
@@ -278,7 +278,7 @@ intel_encoder_hotplug(struct intel_encoder *encoder,
        struct drm_device *dev = connector->base.dev;
        enum drm_connector_status old_status;
 
-       WARN_ON(!mutex_is_locked(&dev->mode_config.mutex));
+       drm_WARN_ON(dev, !mutex_is_locked(&dev->mode_config.mutex));
        old_status = connector->base.status;
 
        connector->base.status =
@@ -504,8 +504,9 @@ void intel_hpd_irq_handler(struct drm_i915_private *dev_priv,
                         * hotplug bits itself. So only WARN about unexpected
                         * interrupts on saner platforms.
                         */
-                       WARN_ONCE(!HAS_GMCH(dev_priv),
-                                 "Received HPD interrupt on pin %d although disabled\n", pin);
+                       drm_WARN_ONCE(&dev_priv->drm, !HAS_GMCH(dev_priv),
+                                     "Received HPD interrupt on pin %d although disabled\n",
+                                     pin);
                        continue;
                }
 
index 09591ba27e2ecbc070f9d4e7dd3f4d7ab1dd1736..516e7179a5a404c5487e49a446b8ec908e51ffc3 100644 (file)
@@ -167,7 +167,7 @@ static int lpe_audio_irq_init(struct drm_i915_private *dev_priv)
 {
        int irq = dev_priv->lpe_audio.irq;
 
-       WARN_ON(!intel_irqs_enabled(dev_priv));
+       drm_WARN_ON(&dev_priv->drm, !intel_irqs_enabled(dev_priv));
        irq_set_chip_and_handler_name(irq,
                                &lpe_audio_irqchip,
                                handle_simple_irq,
index 47c49f317e07dcdd4aed89c12828ec224d32d990..b7ad0b53479007f44029fd5c7f920e91dba9608d 100644 (file)
@@ -204,7 +204,8 @@ static void intel_lvds_pps_init_hw(struct drm_i915_private *dev_priv,
        u32 val;
 
        val = intel_de_read(dev_priv, PP_CONTROL(0));
-       WARN_ON((val & PANEL_UNLOCK_MASK) != PANEL_UNLOCK_REGS);
+       drm_WARN_ON(&dev_priv->drm,
+                   (val & PANEL_UNLOCK_MASK) != PANEL_UNLOCK_REGS);
        if (pps->powerdown_on_reset)
                val |= PANEL_POWER_RESET;
        intel_de_write(dev_priv, PP_CONTROL(0), val);
@@ -826,8 +827,8 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
 
        /* Skip init on machines we know falsely report LVDS */
        if (dmi_check_system(intel_no_lvds)) {
-               WARN(!dev_priv->vbt.int_lvds_support,
-                    "Useless DMI match. Internal LVDS support disabled by VBT\n");
+               drm_WARN(dev, !dev_priv->vbt.int_lvds_support,
+                        "Useless DMI match. Internal LVDS support disabled by VBT\n");
                return;
        }
 
index 8d9e691e0906dcebe909814adf14deada1ccb23d..dfd78fccd456974969bd71b8d80960cef3b8d8a7 100644 (file)
@@ -381,8 +381,9 @@ int intel_opregion_notify_encoder(struct intel_encoder *intel_encoder,
                type = DISPLAY_TYPE_INTERNAL_FLAT_PANEL;
                break;
        default:
-               WARN_ONCE(1, "unsupported intel_encoder type %d\n",
-                         intel_encoder->type);
+               drm_WARN_ONCE(&dev_priv->drm, 1,
+                             "unsupported intel_encoder type %d\n",
+                             intel_encoder->type);
                return -EINVAL;
        }
 
@@ -931,7 +932,7 @@ int intel_opregion_setup(struct drm_i915_private *dev_priv)
                 */
                if (opregion->header->over.major > 2 ||
                    opregion->header->over.minor >= 1) {
-                       WARN_ON(rvda < OPREGION_SIZE);
+                       drm_WARN_ON(&dev_priv->drm, rvda < OPREGION_SIZE);
 
                        rvda += asls;
                }
index b83062201212d9abb95f267dff2398ddb216f606..d0f05857e4b073c4a9553936ec04857e7d9ffbc7 100644 (file)
@@ -110,8 +110,8 @@ static int i9xx_pipe_crc_auto_source(struct drm_i915_private *dev_priv,
                                *source = INTEL_PIPE_CRC_SOURCE_DP_D;
                                break;
                        default:
-                               WARN(1, "nonexisting DP port %c\n",
-                                    port_name(dig_port->base.port));
+                               drm_WARN(dev, 1, "nonexisting DP port %c\n",
+                                        port_name(dig_port->base.port));
                                break;
                        }
                        break;
@@ -328,7 +328,8 @@ put_state:
 
        drm_atomic_state_put(state);
 unlock:
-       WARN(ret, "Toggling workaround to %i returns %i\n", enable, ret);
+       drm_WARN(&dev_priv->drm, ret,
+                "Toggling workaround to %i returns %i\n", enable, ret);
        drm_modeset_drop_locks(&ctx);
        drm_modeset_acquire_fini(&ctx);
 }
index 2f277d1fc6f115a6627fd4fafc1d9d9c1f7d3d0f..4760a9fe833158ab54fbbfc0a9c404498a5c3245 100644 (file)
@@ -104,7 +104,7 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state)
        if (min <= 0 || max <= 0)
                goto irq_disable;
 
-       if (WARN_ON(drm_crtc_vblank_get(&crtc->base)))
+       if (drm_WARN_ON(&dev_priv->drm, drm_crtc_vblank_get(&crtc->base)))
                goto irq_disable;
 
        /*
@@ -204,7 +204,8 @@ void intel_pipe_update_end(struct intel_crtc_state *new_crtc_state)
         * event outside of the critical section - the spinlock might spin for a
         * while ... */
        if (new_crtc_state->uapi.event) {
-               WARN_ON(drm_crtc_vblank_get(&crtc->base) != 0);
+               drm_WARN_ON(&dev_priv->drm,
+                           drm_crtc_vblank_get(&crtc->base) != 0);
 
                spin_lock(&crtc->base.dev->event_lock);
                drm_crtc_arm_vblank_event(&crtc->base,
index a81abadb067f8ed66c3282af510daad8d8e8fdda..6ad57ae39db924dbefd77e82d00badad82f872c9 100644 (file)
@@ -374,7 +374,7 @@ static bool is_pipe_dsc(const struct intel_crtc_state *crtc_state)
                return false;
 
        /* There's no pipe A DSC engine on ICL */
-       WARN_ON(crtc->pipe == PIPE_A);
+       drm_WARN_ON(&i915->drm, crtc->pipe == PIPE_A);
 
        return true;
 }
index 81d579076a073f66f3357aff16c0681f74c0bbda..8776f7d6ec4592073473dc35895421fd03f8c134 100644 (file)
@@ -1030,7 +1030,7 @@ static bool intel_dsi_get_hw_state(struct intel_encoder *encoder,
                        tmp &= BXT_PIPE_SELECT_MASK;
                        tmp >>= BXT_PIPE_SELECT_SHIFT;
 
-                       if (WARN_ON(tmp > PIPE_C))
+                       if (drm_WARN_ON(&dev_priv->drm, tmp > PIPE_C))
                                continue;
 
                        *pipe = tmp;