Commit 66578857 authored by Jani Nikula's avatar Jani Nikula

drm/i915/vbt: don't propagate errors from intel_bios_init()

We don't use the error return for anything other than reporting and
logging that there is no VBT. We can pull the logging in the function,
and remove the error status return. Moreover, if we needed the
information for something later on, we'd probably be better off storing
the bit in dev_priv, and using it where it's needed, instead of using
the error return.

While at it, improve the comments.

Cc: Manasi Navare <manasi.d.navare@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/438ebbb0d5f0d321c625065b9cc78532a1dab24f.1489152288.git.jani.nikula@intel.com
parent f103560c
...@@ -567,9 +567,7 @@ static int i915_load_modeset_init(struct drm_device *dev) ...@@ -567,9 +567,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
if (i915_inject_load_failure()) if (i915_inject_load_failure())
return -ENODEV; return -ENODEV;
ret = intel_bios_init(dev_priv); intel_bios_init(dev_priv);
if (ret)
DRM_INFO("failed to find VBIOS tables\n");
/* If we have > 1 VGA cards, then we need to arbitrate access /* If we have > 1 VGA cards, then we need to arbitrate access
* to the common VGA resources. * to the common VGA resources.
......
...@@ -3714,7 +3714,7 @@ static inline bool intel_gmbus_is_forced_bit(struct i2c_adapter *adapter) ...@@ -3714,7 +3714,7 @@ static inline bool intel_gmbus_is_forced_bit(struct i2c_adapter *adapter)
extern void intel_i2c_reset(struct drm_i915_private *dev_priv); extern void intel_i2c_reset(struct drm_i915_private *dev_priv);
/* intel_bios.c */ /* intel_bios.c */
int intel_bios_init(struct drm_i915_private *dev_priv); void intel_bios_init(struct drm_i915_private *dev_priv);
bool intel_bios_is_valid_vbt(const void *buf, size_t size); bool intel_bios_is_valid_vbt(const void *buf, size_t size);
bool intel_bios_is_tv_present(struct drm_i915_private *dev_priv); bool intel_bios_is_tv_present(struct drm_i915_private *dev_priv);
bool intel_bios_is_lvds_present(struct drm_i915_private *dev_priv, u8 *i2c_pin); bool intel_bios_is_lvds_present(struct drm_i915_private *dev_priv, u8 *i2c_pin);
......
...@@ -1462,36 +1462,35 @@ static const struct vbt_header *find_vbt(void __iomem *bios, size_t size) ...@@ -1462,36 +1462,35 @@ static const struct vbt_header *find_vbt(void __iomem *bios, size_t size)
* intel_bios_init - find VBT and initialize settings from the BIOS * intel_bios_init - find VBT and initialize settings from the BIOS
* @dev_priv: i915 device instance * @dev_priv: i915 device instance
* *
* Loads the Video BIOS and checks that the VBT exists. Sets scratch registers * Parse and initialize settings from the Video BIOS Tables (VBT). If the VBT
* to appropriate values. * was not found in ACPI OpRegion, try to find it in PCI ROM first. Also
* * initialize some defaults if the VBT is not present at all.
* Returns 0 on success, nonzero on failure.
*/ */
int void intel_bios_init(struct drm_i915_private *dev_priv)
intel_bios_init(struct drm_i915_private *dev_priv)
{ {
struct pci_dev *pdev = dev_priv->drm.pdev; struct pci_dev *pdev = dev_priv->drm.pdev;
const struct vbt_header *vbt = dev_priv->opregion.vbt; const struct vbt_header *vbt = dev_priv->opregion.vbt;
const struct bdb_header *bdb; const struct bdb_header *bdb;
u8 __iomem *bios = NULL; u8 __iomem *bios = NULL;
if (HAS_PCH_NOP(dev_priv)) if (HAS_PCH_NOP(dev_priv)) {
return -ENODEV; DRM_DEBUG_KMS("Skipping VBT init due to disabled display.\n");
return;
}
init_vbt_defaults(dev_priv); init_vbt_defaults(dev_priv);
/* If the OpRegion does not have VBT, look in PCI ROM. */
if (!vbt) { if (!vbt) {
size_t size; size_t size;
bios = pci_map_rom(pdev, &size); bios = pci_map_rom(pdev, &size);
if (!bios) if (!bios)
return -1; goto out;
vbt = find_vbt(bios, size); vbt = find_vbt(bios, size);
if (!vbt) { if (!vbt)
pci_unmap_rom(pdev, bios); goto out;
return -1;
}
DRM_DEBUG_KMS("Found valid VBT in PCI ROM\n"); DRM_DEBUG_KMS("Found valid VBT in PCI ROM\n");
} }
...@@ -1516,10 +1515,12 @@ intel_bios_init(struct drm_i915_private *dev_priv) ...@@ -1516,10 +1515,12 @@ intel_bios_init(struct drm_i915_private *dev_priv)
parse_mipi_sequence(dev_priv, bdb); parse_mipi_sequence(dev_priv, bdb);
parse_ddi_ports(dev_priv, bdb); parse_ddi_ports(dev_priv, bdb);
out:
if (!vbt)
DRM_INFO("Failed to find VBIOS tables (VBT)\n");
if (bios) if (bios)
pci_unmap_rom(pdev, bios); pci_unmap_rom(pdev, bios);
return 0;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment