diff options
| author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2025-12-08 20:26:22 +0200 |
|---|---|---|
| committer | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2026-01-23 04:36:54 +0200 |
| commit | d4470842e415e8e1b170bfac98c65077babdffcb (patch) | |
| tree | dc8c51a187d2f7cc0634fcb9902a40f06798e3ac /drivers | |
| parent | 284c6d8043a82549ec4f3e0300ea14c53713d974 (diff) | |
| download | linux-d4470842e415e8e1b170bfac98c65077babdffcb.tar.gz linux-d4470842e415e8e1b170bfac98c65077babdffcb.zip | |
drm/i915/vga: Extract intel_gmch_ctrl_reg()
Extract the GMCH_CTLR register offset determination into a helper
rather than using a local varaible. I'll be needing this in another
function soon.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patch.msgid.link/20251208182637.334-5-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/gpu/drm/i915/display/intel_vga.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/display/intel_vga.c b/drivers/gpu/drm/i915/display/intel_vga.c index 39c68aec647b..84fd5475d336 100644 --- a/drivers/gpu/drm/i915/display/intel_vga.c +++ b/drivers/gpu/drm/i915/display/intel_vga.c @@ -18,6 +18,11 @@ #include "intel_vga.h" #include "intel_vga_regs.h" +static unsigned int intel_gmch_ctrl_reg(struct intel_display *display) +{ + return DISPLAY_VER(display) >= 6 ? SNB_GMCH_CTRL : INTEL_GMCH_CTRL; +} + static i915_reg_t intel_vga_cntrl_reg(struct intel_display *display) { if (display->platform.valleyview || display->platform.cherryview) @@ -98,10 +103,10 @@ void intel_vga_disable(struct intel_display *display) static int intel_gmch_vga_set_state(struct intel_display *display, bool enable_decode) { struct pci_dev *pdev = to_pci_dev(display->drm->dev); - unsigned int reg = DISPLAY_VER(display) >= 6 ? SNB_GMCH_CTRL : INTEL_GMCH_CTRL; u16 gmch_ctrl; - if (pci_bus_read_config_word(pdev->bus, PCI_DEVFN(0, 0), reg, &gmch_ctrl)) { + if (pci_bus_read_config_word(pdev->bus, PCI_DEVFN(0, 0), + intel_gmch_ctrl_reg(display), &gmch_ctrl)) { drm_err(display->drm, "failed to read control word\n"); return -EIO; } @@ -114,7 +119,8 @@ static int intel_gmch_vga_set_state(struct intel_display *display, bool enable_d else gmch_ctrl |= INTEL_GMCH_VGA_DISABLE; - if (pci_bus_write_config_word(pdev->bus, PCI_DEVFN(0, 0), reg, gmch_ctrl)) { + if (pci_bus_write_config_word(pdev->bus, PCI_DEVFN(0, 0), + intel_gmch_ctrl_reg(display), gmch_ctrl)) { drm_err(display->drm, "failed to write control word\n"); return -EIO; } |
