On Wed, Jul 31, 2024 at 07:44:35PM +0300, Jani Nikula wrote:
> Going forward, struct intel_display shall replace struct
> drm_i915_private as the main display device data pointer type. Convert
> intel_opregion.[ch] to struct intel_display.
> 
> Signed-off-by: Jani Nikula <jani.nik...@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_bios.c     |  10 +-
>  .../drm/i915/display/intel_display_debugfs.c  |   5 +-
>  .../drm/i915/display/intel_display_device.c   |   8 +-
>  .../drm/i915/display/intel_display_driver.c   |   6 +-
>  .../gpu/drm/i915/display/intel_display_irq.c  |  24 +-
>  drivers/gpu/drm/i915/display/intel_opregion.c | 296 +++++++++---------
>  drivers/gpu/drm/i915/display/intel_opregion.h |  54 ++--
>  drivers/gpu/drm/i915/i915_driver.c            |  22 +-
>  drivers/gpu/drm/xe/display/xe_display.c       |  19 +-
>  9 files changed, 238 insertions(+), 206 deletions(-)
> 
> [...]
> diff --git a/drivers/gpu/drm/i915/display/intel_opregion.c 
> b/drivers/gpu/drm/i915/display/intel_opregion.c
> index 4c9b9e7ebc91..0cf6c0711dae 100644
> --- a/drivers/gpu/drm/i915/display/intel_opregion.c
> +++ b/drivers/gpu/drm/i915/display/intel_opregion.c
> [...]
>  
> @@ -384,18 +384,18 @@ static int swsci(struct drm_i915_private *dev_priv,
>  int intel_opregion_notify_encoder(struct intel_encoder *encoder,
>                                 bool enable)
>  {
> -     struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> +     struct intel_display *display = to_intel_display(encoder->base.dev);

Nit: AFAICS, this could be just to_intel_display(encoder).

>       u32 parm = 0;
>       u32 type = 0;
>       u32 port;
>       int ret;
>  
>       /* don't care about old stuff for now */
> -     if (!HAS_DDI(dev_priv))
> +     if (!HAS_DDI(display))
>               return 0;
>  
>       /* Avoid port out of bounds checks if SWSCI isn't there. */
> -     ret = check_swsci_function(dev_priv, SWSCI_SBCB_DISPLAY_POWER_STATE);
> +     ret = check_swsci_function(display, SWSCI_SBCB_DISPLAY_POWER_STATE);
>       if (ret)
>               return ret;
>  
> @@ -419,7 +419,7 @@ int intel_opregion_notify_encoder(struct intel_encoder 
> *encoder,
>        * number is out of bounds after mapping.
>        */
>       if (port > 4) {
> -             drm_dbg_kms(&dev_priv->drm,
> +             drm_dbg_kms(display->drm,
>                           "[ENCODER:%d:%s] port %c (index %u) out of bounds 
> for display power state notification\n",
>                           encoder->base.base.id, encoder->base.name,
>                           port_name(encoder->port), port);
> @@ -444,7 +444,7 @@ int intel_opregion_notify_encoder(struct intel_encoder 
> *encoder,
>               type = DISPLAY_TYPE_INTERNAL_FLAT_PANEL;
>               break;
>       default:
> -             drm_WARN_ONCE(&dev_priv->drm, 1,
> +             drm_WARN_ONCE(display->drm, 1,
>                             "unsupported intel_encoder type %d\n",
>                             encoder->type);
>               return -EINVAL;
> @@ -452,7 +452,7 @@ int intel_opregion_notify_encoder(struct intel_encoder 
> *encoder,
>  
>       parm |= type << (16 + port * 3);
>  
> -     return swsci(dev_priv, SWSCI_SBCB_DISPLAY_POWER_STATE, parm, NULL);
> +     return swsci(display, SWSCI_SBCB_DISPLAY_POWER_STATE, parm, NULL);
>  }
>  
>  static const struct {
> @@ -466,33 +466,33 @@ static const struct {
>       { PCI_D3cold,   0x04 },
>  };
>  
> -int intel_opregion_notify_adapter(struct drm_i915_private *dev_priv,
> +int intel_opregion_notify_adapter(struct intel_display *display,
>                                 pci_power_t state)

Missing change in the forward declartion for !CONFIG_ACPI, also reported
by lkp.

>  {
>       int i;
>  
> -     if (!HAS_DDI(dev_priv))
> +     if (!HAS_DDI(display))
>               return 0;
>  
>       for (i = 0; i < ARRAY_SIZE(power_state_map); i++) {
>               if (state == power_state_map[i].pci_power_state)
> -                     return swsci(dev_priv, SWSCI_SBCB_ADAPTER_POWER_STATE,
> +                     return swsci(display, SWSCI_SBCB_ADAPTER_POWER_STATE,
>                                    power_state_map[i].parm, NULL);
>       }
>  
>       return -EINVAL;
>  }
>  
> [...]
>  int
> -intel_opregion_get_panel_type(struct drm_i915_private *dev_priv)
> +intel_opregion_get_panel_type(struct intel_display *display)

Same as above.

>  {
>       u32 panel_details;
>       int ret;
>  
> -     ret = swsci(dev_priv, SWSCI_GBDA_PANEL_DETAILS, 0x0, &panel_details);
> +     ret = swsci(display, SWSCI_GBDA_PANEL_DETAILS, 0x0, &panel_details);
>       if (ret)
>               return ret;
>  
>       ret = (panel_details >> 8) & 0xff;
>       if (ret > 0x10) {
> -             drm_dbg_kms(&dev_priv->drm,
> +             drm_dbg_kms(display->drm,
>                           "Invalid OpRegion panel type 0x%x\n", ret);
>               return -EINVAL;
>       }
>  
>       /* fall back to VBT panel type? */
>       if (ret == 0x0) {
> -             drm_dbg_kms(&dev_priv->drm, "No panel type in OpRegion\n");
> +             drm_dbg_kms(display->drm, "No panel type in OpRegion\n");
>               return -ENODEV;
>       }
>  
> @@ -1083,7 +1084,7 @@ intel_opregion_get_panel_type(struct drm_i915_private 
> *dev_priv)
>        * via a quirk list :(
>        */
>       if (!dmi_check_system(intel_use_opregion_panel_type)) {
> -             drm_dbg_kms(&dev_priv->drm,
> +             drm_dbg_kms(display->drm,
>                           "Ignoring OpRegion panel type (%d)\n", ret - 1);
>               return -ENODEV;
>       }
> @@ -1104,8 +1105,8 @@ intel_opregion_get_panel_type(struct drm_i915_private 
> *dev_priv)
>   */
>  const struct drm_edid *intel_opregion_get_edid(struct intel_connector 
> *connector)
>  {
> -     struct drm_i915_private *i915 = to_i915(connector->base.dev);
> -     struct intel_opregion *opregion = i915->display.opregion;
> +     struct intel_display *display = to_intel_display(connector->base.dev);

Nit: this could be just to_intel_display(connector).

With the forward declarations fixed looks ok:
Reviewed-by: Imre Deak <imre.d...@intel.com>

Reply via email to