On Mon, 2024-11-04 at 19:19 +0200, Jani Nikula wrote: > Convert intel_display_device_probe() to accept struct pci_dev * instead > of struct drm_i915_private *. Return struct intel_display * in > preparation of allocating the memory of it later. > > Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx> > --- > drivers/gpu/drm/i915/display/intel_display_device.c | 10 ++++++---- > drivers/gpu/drm/i915/display/intel_display_device.h | 4 ++-- > drivers/gpu/drm/i915/i915_driver.c | 2 +- > drivers/gpu/drm/i915/selftests/mock_gem_device.c | 2 +- > drivers/gpu/drm/xe/display/xe_display.c | 5 +++-- > 5 files changed, 13 insertions(+), 10 deletions(-) > Reviewed-by: Vinod Govindapillai <vinod.govindapillai@xxxxxxxxx> > diff --git a/drivers/gpu/drm/i915/display/intel_display_device.c > b/drivers/gpu/drm/i915/display/intel_display_device.c > index aabf6ece40c4..8ba1b4652ca9 100644 > --- a/drivers/gpu/drm/i915/display/intel_display_device.c > +++ b/drivers/gpu/drm/i915/display/intel_display_device.c > @@ -16,6 +16,7 @@ > #include "intel_display_params.h" > #include "intel_display_power.h" > #include "intel_display_reg_defs.h" > +#include "intel_display_types.h" > #include "intel_fbc.h" > #include "intel_step.h" > > @@ -1569,10 +1570,9 @@ static void display_platforms_or(struct intel_display_platforms *dst, > bitmap_or(dst->bitmap, dst->bitmap, src->bitmap, display_platforms_num_bits()); > } > > -void intel_display_device_probe(struct drm_i915_private *i915) > +struct intel_display *intel_display_device_probe(struct pci_dev *pdev) > { > - struct intel_display *display = &i915->display; > - struct pci_dev *pdev = to_pci_dev(i915->drm.dev); > + struct intel_display *display = to_intel_display(pdev); > const struct intel_display_device_info *info; > struct intel_display_ip_ver ip_ver = {}; > const struct platform_desc *desc; > @@ -1649,10 +1649,12 @@ void intel_display_device_probe(struct drm_i915_private *i915) > DISPLAY_RUNTIME_INFO(display)->ip.rel, > step != STEP_NONE ? intel_step_name(step) : "N/A"); > > - return; > + return display; > > no_display: > DISPLAY_INFO(display) = &no_display; > + > + return display; > } > > void intel_display_device_remove(struct intel_display *display) > diff --git a/drivers/gpu/drm/i915/display/intel_display_device.h > b/drivers/gpu/drm/i915/display/intel_display_device.h > index 01e3cc0fde4b..e1398689cda5 100644 > --- a/drivers/gpu/drm/i915/display/intel_display_device.h > +++ b/drivers/gpu/drm/i915/display/intel_display_device.h > @@ -12,9 +12,9 @@ > #include "intel_display_conversion.h" > #include "intel_display_limits.h" > > -struct drm_i915_private; > struct drm_printer; > struct intel_display; > +struct pci_dev; > > /* > * Display platforms and subplatforms. Keep platforms in display version based > @@ -288,7 +288,7 @@ struct intel_display_device_info { > }; > > bool intel_display_device_enabled(struct intel_display *display); > -void intel_display_device_probe(struct drm_i915_private *i915); > +struct intel_display *intel_display_device_probe(struct pci_dev *pdev); > void intel_display_device_remove(struct intel_display *display); > void intel_display_device_info_runtime_init(struct intel_display *display); > > diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c > index 596aaf940d0c..310c0a2e9e26 100644 > --- a/drivers/gpu/drm/i915/i915_driver.c > +++ b/drivers/gpu/drm/i915/i915_driver.c > @@ -732,7 +732,7 @@ i915_driver_create(struct pci_dev *pdev, const struct pci_device_id *ent) > /* Set up device info and initial runtime info. */ > intel_device_info_driver_create(i915, pdev->device, match_info); > > - intel_display_device_probe(i915); > + intel_display_device_probe(pdev); > > return i915; > } > diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c > b/drivers/gpu/drm/i915/selftests/mock_gem_device.c > index ae57eb03dfca..a77e5b26542c 100644 > --- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c > +++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c > @@ -180,7 +180,7 @@ struct drm_i915_private *mock_gem_device(void) > /* Set up device info and initial runtime info. */ > intel_device_info_driver_create(i915, pdev->device, &mock_info); > > - intel_display_device_probe(i915); > + intel_display_device_probe(pdev); > > dev_pm_domain_set(&pdev->dev, &pm_domain); > pm_runtime_enable(&pdev->dev); > diff --git a/drivers/gpu/drm/xe/display/xe_display.c b/drivers/gpu/drm/xe/display/xe_display.c > index 9b8acf2074e0..60ff48604e3b 100644 > --- a/drivers/gpu/drm/xe/display/xe_display.c > +++ b/drivers/gpu/drm/xe/display/xe_display.c > @@ -502,13 +502,14 @@ static void display_device_remove(struct drm_device *dev, void *arg) > > int xe_display_probe(struct xe_device *xe) > { > - struct intel_display *display = &xe->display; > + struct pci_dev *pdev = to_pci_dev(xe->drm.dev); > + struct intel_display *display; > int err; > > if (!xe->info.probe_display) > goto no_display; > > - intel_display_device_probe(xe); > + display = intel_display_device_probe(pdev); > > err = drmm_add_action_or_reset(&xe->drm, display_device_remove, display); > if (err)