Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+9 -3
+9 -3
drivers/gpu/drm/i915/display/intel_vga.c
··· 18 18 #include "intel_vga.h" 19 19 #include "intel_vga_regs.h" 20 20 21 + static unsigned int intel_gmch_ctrl_reg(struct intel_display *display) 22 + { 23 + return DISPLAY_VER(display) >= 6 ? SNB_GMCH_CTRL : INTEL_GMCH_CTRL; 24 + } 25 + 21 26 static i915_reg_t intel_vga_cntrl_reg(struct intel_display *display) 22 27 { 23 28 if (display->platform.valleyview || display->platform.cherryview) ··· 103 98 static int intel_gmch_vga_set_state(struct intel_display *display, bool enable_decode) 104 99 { 105 100 struct pci_dev *pdev = to_pci_dev(display->drm->dev); 106 - unsigned int reg = DISPLAY_VER(display) >= 6 ? SNB_GMCH_CTRL : INTEL_GMCH_CTRL; 107 101 u16 gmch_ctrl; 108 102 109 - if (pci_bus_read_config_word(pdev->bus, PCI_DEVFN(0, 0), reg, &gmch_ctrl)) { 103 + if (pci_bus_read_config_word(pdev->bus, PCI_DEVFN(0, 0), 104 + intel_gmch_ctrl_reg(display), &gmch_ctrl)) { 110 105 drm_err(display->drm, "failed to read control word\n"); 111 106 return -EIO; 112 107 } ··· 119 114 else 120 115 gmch_ctrl |= INTEL_GMCH_VGA_DISABLE; 121 116 122 - if (pci_bus_write_config_word(pdev->bus, PCI_DEVFN(0, 0), reg, gmch_ctrl)) { 117 + if (pci_bus_write_config_word(pdev->bus, PCI_DEVFN(0, 0), 118 + intel_gmch_ctrl_reg(display), gmch_ctrl)) { 123 119 drm_err(display->drm, "failed to write control word\n"); 124 120 return -EIO; 125 121 }