if (ret)
goto err;
- if (i915_inject_probe_failure()) {
+ if (i915_inject_probe_failure(to_i915(connector->dev))) {
ret = -EFAULT;
goto err_backlight;
}
WARN_ON(engine_mask &
GENMASK(BITS_PER_TYPE(mask) - 1, I915_NUM_ENGINES));
- if (i915_inject_probe_failure())
+ if (i915_inject_probe_failure(i915))
return -ENODEV;
for (i = 0; i < ARRAY_SIZE(intel_engines); i++) {
#if IS_ENABLED(CONFIG_DRM_I915_DEBUG)
static unsigned int i915_probe_fail_count;
-bool __i915_inject_probe_failure(const char *func, int line)
+int __i915_inject_load_error(struct drm_i915_private *i915, int err,
+ const char *func, int line)
{
if (i915_probe_fail_count >= i915_modparams.inject_load_failure)
- return false;
+ return 0;
- if (++i915_probe_fail_count == i915_modparams.inject_load_failure) {
- DRM_INFO("Injecting failure at checkpoint %u [%s:%d]\n",
- i915_modparams.inject_load_failure, func, line);
- i915_modparams.inject_load_failure = 0;
- return true;
- }
+ if (++i915_probe_fail_count < i915_modparams.inject_load_failure)
+ return 0;
- return false;
+ __i915_printk(i915, KERN_INFO,
+ "Injecting failure %d at checkpoint %u [%s:%d]\n",
+ err, i915_modparams.inject_load_failure, func, line);
+ i915_modparams.inject_load_failure = 0;
+ return err;
}
bool i915_error_injected(void)
struct pci_dev *pdev = dev_priv->drm.pdev;
int ret;
- if (i915_inject_probe_failure())
+ if (i915_inject_probe_failure(dev_priv))
return -ENODEV;
if (HAS_DISPLAY(dev_priv)) {
{
int ret = 0;
- if (i915_inject_probe_failure())
+ if (i915_inject_probe_failure(dev_priv))
return -ENODEV;
intel_device_info_subplatform_init(dev_priv);
{
int ret;
- if (i915_inject_probe_failure())
+ if (i915_inject_probe_failure(dev_priv))
return -ENODEV;
if (i915_get_bridge_dev(dev_priv))
struct pci_dev *pdev = dev_priv->drm.pdev;
int ret;
- if (i915_inject_probe_failure())
+ if (i915_inject_probe_failure(dev_priv))
return -ENODEV;
intel_device_info_runtime_init(dev_priv);
#if IS_ENABLED(CONFIG_DRM_I915_DEBUG)
-bool __i915_inject_probe_failure(const char *func, int line);
-#define i915_inject_probe_failure() \
- __i915_inject_probe_failure(__func__, __LINE__)
-
+int __i915_inject_load_error(struct drm_i915_private *i915, int err,
+ const char *func, int line);
+#define i915_inject_load_error(_i915, _err) \
+ __i915_inject_load_error((_i915), (_err), __func__, __LINE__)
bool i915_error_injected(void);
#else
-#define i915_inject_probe_failure() false
+#define i915_inject_load_error(_i915, _err) 0
#define i915_error_injected() false
#endif
+#define i915_inject_probe_failure(i915) i915_inject_load_error((i915), -ENODEV)
+
#define i915_probe_error(i915, fmt, ...) \
__i915_printk(i915, i915_error_injected() ? KERN_DEBUG : KERN_ERR, \
fmt, ##__VA_ARGS__)
if (ret)
goto err_gt;
- if (i915_inject_probe_failure()) {
- ret = -ENODEV;
+ ret = i915_inject_load_error(dev_priv, -ENODEV);
+ if (ret)
goto err_gt;
- }
- if (i915_inject_probe_failure()) {
- ret = -EIO;
+ ret = i915_inject_load_error(dev_priv, -EIO);
+ if (ret)
goto err_gt;
- }
intel_uncore_forcewake_put(&dev_priv->uncore, FORCEWAKE_ALL);
mutex_unlock(&dev_priv->drm.struct_mutex);
if (err)
return err;
- if (i915_inject_probe_failure()) {
+ if (i915_inject_probe_failure(to_i915(pci_get_drvdata(pdev)))) {
i915_pci_remove(pdev);
return -ENODEV;
}
{
int ret;
- if (i915_inject_probe_failure())
+ if (i915_inject_probe_failure(dev_priv))
return -ENODEV;
if (!i915_modparams.enable_gvt) {
GEM_BUG_ON(domain_id >= FW_DOMAIN_ID_COUNT);
GEM_BUG_ON(uncore->fw_domain[domain_id]);
- if (i915_inject_probe_failure())
+ if (i915_inject_probe_failure(uncore->i915))
return -ENOMEM;
d = kzalloc(sizeof(*d), GFP_KERNEL);
GEM_BUG_ON(!wopcm->size);
- if (i915_inject_probe_failure())
+ if (i915_inject_probe_failure(i915))
return -E2BIG;
if (guc_fw_size >= wopcm->size) {