Skip to contentSkip to conversation

drm/i915: nuke the intel_lvds_connector

PATCH In review Jani Nikula 5 participants 8 messages Oct 9, 2018 – Oct 10, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: nuke the intel_lvds_connector

For a while we carried lvds connector specific data in the lvds connector, but since commit 05c72e77ccda ("drm/i915: Nuke the LVDS lid notifier") we haven't needed it. Revert back to plain intel_connector.

Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_lvds.c | 42 +++++++++++----------------------------
 1 file changed, 12 insertions(+), 30 deletions(-)
drivers/gpu/drm/i915/intel_lvds.c +12 -30
index 1fe970cf9909..510585ed94b2 100644
@@ -42,10 +42,6 @@
 #include <linux/acpi.h>
 
 /* Private structure for the integrated LVDS support */
-struct intel_lvds_connector {
-	struct intel_connector base;
-};
-
 struct intel_lvds_pps {
 	/* 100us units */
 	int t1_t2;
@@ -70,7 +66,7 @@ struct intel_lvds_encoder {
 	struct intel_lvds_pps init_pps;
 	u32 init_lvds_val;
 
-	struct intel_lvds_connector *attached_connector;
+	struct intel_connector *attached_connector;
 };
 
 static struct intel_lvds_encoder *to_lvds_encoder(struct drm_encoder *encoder)
@@ -78,11 +74,6 @@ static struct intel_lvds_encoder *to_lvds_encoder(struct drm_encoder *encoder)
 	return container_of(encoder, struct intel_lvds_encoder, base.base);
 }
 
-static struct intel_lvds_connector *to_lvds_connector(struct drm_connector *connector)
-{
-	return container_of(connector, struct intel_lvds_connector, base.base);
-}
-
 bool intel_lvds_port_enabled(struct drm_i915_private *dev_priv,
 			     i915_reg_t lvds_reg, enum pipe *pipe)
 {
@@ -396,7 +387,7 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
 	struct intel_lvds_encoder *lvds_encoder =
 		to_lvds_encoder(&intel_encoder->base);
 	struct intel_connector *intel_connector =
-		&lvds_encoder->attached_connector->base;
+		lvds_encoder->attached_connector;
 	struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
 	struct intel_crtc *intel_crtc = to_intel_crtc(pipe_config->base.crtc);
 	unsigned int lvds_bpp;
@@ -461,15 +452,15 @@ intel_lvds_detect(struct drm_connector *connector, bool force)
  */
 static int intel_lvds_get_modes(struct drm_connector *connector)
 {
-	struct intel_lvds_connector *lvds_connector = to_lvds_connector(connector);
+	struct intel_connector *intel_connector = to_intel_connector(connector);
 	struct drm_device *dev = connector->dev;
 	struct drm_display_mode *mode;
 
 	/* use cached edid if we have one */
-	if (!IS_ERR_OR_NULL(lvds_connector->base.edid))
-		return drm_add_edid_modes(connector, lvds_connector->base.edid);
+	if (!IS_ERR_OR_NULL(intel_connector->edid))
+		return drm_add_edid_modes(connector, intel_connector->edid);
 
-	mode = drm_mode_duplicate(dev, lvds_connector->base.panel.fixed_mode);
+	mode = drm_mode_duplicate(dev, intel_connector->panel.fixed_mode);
 	if (mode == NULL)
 		return 0;
 
@@ -781,8 +772,7 @@ static bool compute_is_dual_link_lvds(struct intel_lvds_encoder *lvds_encoder)
 		return i915_modparams.lvds_channel_mode == 2;
 
 	/* single channel LVDS is limited to 112 MHz */
-	if (lvds_encoder->attached_connector->base.panel.fixed_mode->clock
-	    > 112999)
+	if (lvds_encoder->attached_connector->panel.fixed_mode->clock > 112999)
 		return true;
 
 	if (dmi_check_system(intel_dual_link_lvds))
@@ -837,7 +827,6 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
 	struct drm_device *dev = &dev_priv->drm;
 	struct intel_lvds_encoder *lvds_encoder;
 	struct intel_encoder *intel_encoder;
-	struct intel_lvds_connector *lvds_connector;
 	struct intel_connector *intel_connector;
 	struct drm_connector *connector;
 	struct drm_encoder *encoder;
@@ -890,23 +879,16 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
 	if (!lvds_encoder)
 		return;
 
-	lvds_connector = kzalloc(sizeof(*lvds_connector), GFP_KERNEL);
-	if (!lvds_connector) {
-		kfree(lvds_encoder);
-		return;
-	}
-
-	if (intel_connector_init(&lvds_connector->base) < 0) {
-		kfree(lvds_connector);
+	intel_connector = intel_connector_alloc();
+	if (!intel_connector) {
 		kfree(lvds_encoder);
 		return;
 	}
 
-	lvds_encoder->attached_connector = lvds_connector;
+	lvds_encoder->attached_connector = intel_connector;
 
 	intel_encoder = &lvds_encoder->base;
 	encoder = &intel_encoder->base;
-	intel_connector = &lvds_connector->base;
 	connector = &intel_connector->base;
 	drm_connector_init(dev, &intel_connector->base, &intel_lvds_connector_funcs,
 			   DRM_MODE_CONNECTOR_LVDS);
@@ -987,7 +969,7 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
 	} else {
 		edid = ERR_PTR(-ENOENT);
 	}
-	lvds_connector->base.edid = edid;
+	intel_connector->edid = edid;
 
 	list_for_each_entry(scan, &connector->probed_modes, head) {
 		if (scan->type & DRM_MODE_TYPE_PREFERRED) {
@@ -1051,6 +1033,6 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
 	drm_connector_cleanup(connector);
 	drm_encoder_cleanup(encoder);
 	kfree(lvds_encoder);
-	kfree(lvds_connector);
+	intel_connector_free(intel_connector);
 	return;
 }
Signature · 6 lines
2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✓ Fi.CI.BAT: success for drm/i915: nuke the intel_lvds_connector

== Series Details ==

== Series Details ==

Series: drm/i915: nuke the intel_lvds_connector
URL : https://patchwork.freedesktop.org/series/50771/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4956 -> Patchwork_10403 =

== Summary - SUCCESS ==

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/50771/revisions/1/mbox/

== Known issues ==

Here are the changes found in Patchwork_10403 that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@amdgpu/amd_basic@cs-compute:
      fi-kbl-8809g:       NOTRUN -> FAIL (fdo#108094)

    igt@amdgpu/amd_prime@amd-to-i915:
      fi-kbl-8809g:       NOTRUN -> FAIL (fdo#107341)

    igt@gem_exec_suspend@basic-s3:
      fi-blb-e6850:       PASS -> INCOMPLETE (fdo#107718)

    
    ==== Possible fixes ====

    igt@prime_vgem@basic-fence-flip:
      fi-ilk-650:         FAIL (fdo#104008) -> PASS

fdo#104008 https://bugs.freedesktop.org/show_bug.cgi?id=104008
fdo#107341 https://bugs.freedesktop.org/show_bug.cgi?id=107341
fdo#107718 https://bugs.freedesktop.org/show_bug.cgi?id=107718
fdo#108094 https://bugs.freedesktop.org/show_bug.cgi?id=108094

== Participating hosts (48 -> 38) ==

Missing (10): fi-ilk-m540 fi-hsw-4200u fi-glk-dsi fi-icl-u2 fi-byt-squawks fi-snb-2520m fi-bsw-cyan fi-ctg-p8600 fi-hsw-4770 fi-glk-j4005

== Build changes ==

* Linux: CI_DRM_4956 -> Patchwork_10403

CI_DRM_4956: 61d9f59ad3592dd6fb724d72014f03b4f222571b @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4672: 4497591d2572831a9f07fd9e48a2571bfcffe354 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_10403: fce1cc335f2893d42b51328b43c55c90e54e73db @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

fce1cc335f28 drm/i915: nuke the intel_lvds_connector

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_10403/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

✓ Fi.CI.IGT: success for drm/i915: nuke the intel_lvds_connector

In reply to Jani Nikula
== Series Details ==

== Series Details ==

Series: drm/i915: nuke the intel_lvds_connector
URL : https://patchwork.freedesktop.org/series/50771/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4956_full -> Patchwork_10403_full =

== Summary - WARNING ==

Minor unknown changes coming with Patchwork_10403_full need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_10403_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

== Possible new issues ==

Here are the unknown changes that may have been introduced in Patchwork_10403_full:

=== IGT changes ===

    ==== Warnings ====

    igt@pm_rc6_residency@rc6-accuracy:
      shard-kbl:          SKIP -> PASS

== Known issues ==

Here are the changes found in Patchwork_10403_full that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@kms_cursor_crc@cursor-256x256-sliding:
      shard-apl:          PASS -> FAIL (fdo#103232)

    igt@kms_cursor_crc@cursor-256x85-random:
      shard-glk:          PASS -> FAIL (fdo#103232)

    igt@kms_cursor_crc@cursor-64x64-suspend:
      shard-apl:          PASS -> FAIL (fdo#103232, fdo#103191)

    igt@kms_cursor_legacy@cursorb-vs-flipb-toggle:
      shard-glk:          PASS -> DMESG-WARN (fdo#105763, fdo#106538) +1

    igt@kms_frontbuffer_tracking@fbc-2p-primscrn-shrfb-pgflip-blt:
      shard-glk:          PASS -> FAIL (fdo#103167) +1

    igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-indfb-draw-render:
      shard-skl:          PASS -> FAIL (fdo#103167) +1

    igt@kms_frontbuffer_tracking@psr-suspend:
      shard-skl:          PASS -> INCOMPLETE (fdo#107773, fdo#104108, fdo#106978)

    igt@kms_plane@pixel-format-pipe-a-planes:
      shard-skl:          NOTRUN -> DMESG-FAIL (fdo#103166, fdo#106885)

    igt@kms_plane_multiple@atomic-pipe-c-tiling-y:
      shard-apl:          PASS -> FAIL (fdo#103166) +2

    igt@perf_pmu@rc6-runtime-pm-long:
      shard-skl:          PASS -> FAIL (fdo#105010)

    igt@pm_rpm@reg-read-ioctl:
      shard-skl:          PASS -> INCOMPLETE (fdo#107807)

    
    ==== Possible fixes ====

    igt@gem_userptr_blits@readonly-unsync:
      shard-skl:          INCOMPLETE (fdo#108074) -> PASS

    igt@kms_ccs@pipe-b-crc-sprite-planes-basic:
      shard-glk:          FAIL (fdo#108145) -> PASS

    igt@kms_cursor_crc@cursor-128x42-onscreen:
      shard-apl:          FAIL (fdo#103232) -> PASS

    igt@kms_cursor_crc@cursor-256x256-sliding:
      shard-glk:          FAIL (fdo#103232) -> PASS +2

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-wc:
      shard-apl:          FAIL (fdo#103167) -> PASS +1

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-onoff:
      shard-glk:          FAIL (fdo#103167) -> PASS +4

    igt@kms_plane@plane-position-covered-pipe-b-planes:
      shard-glk:          FAIL (fdo#103166) -> PASS +3

fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#103232 https://bugs.freedesktop.org/show_bug.cgi?id=103232
fdo#104108 https://bugs.freedesktop.org/show_bug.cgi?id=104108
fdo#105010 https://bugs.freedesktop.org/show_bug.cgi?id=105010
fdo#105763 https://bugs.freedesktop.org/show_bug.cgi?id=105763
fdo#106538 https://bugs.freedesktop.org/show_bug.cgi?id=106538
fdo#106885 https://bugs.freedesktop.org/show_bug.cgi?id=106885
fdo#106978 https://bugs.freedesktop.org/show_bug.cgi?id=106978
fdo#107773 https://bugs.freedesktop.org/show_bug.cgi?id=107773
fdo#107807 https://bugs.freedesktop.org/show_bug.cgi?id=107807
fdo#108074 https://bugs.freedesktop.org/show_bug.cgi?id=108074
fdo#108145 https://bugs.freedesktop.org/show_bug.cgi?id=108145

== Participating hosts (6 -> 6) ==

No changes in participating hosts

== Build changes ==

* Linux: CI_DRM_4956 -> Patchwork_10403

CI_DRM_4956: 61d9f59ad3592dd6fb724d72014f03b4f222571b @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4672: 4497591d2572831a9f07fd9e48a2571bfcffe354 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_10403: fce1cc335f2893d42b51328b43c55c90e54e73db @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_10403/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
In reply to Jani Nikula
I love your patch! Yet something to improve:

Hi Jani,

I love your patch! Yet something to improve:

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on v4.19-rc7 next-20181009]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jani-Nikula/drm-i915-nuke-the-intel_lvds_connector/20181010-092805
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-x000-201840 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

drivers/gpu/drm/i915/intel_lvds.c: In function 'intel_lvds_destroy':

>> drivers/gpu/drm/i915/intel_lvds.c:481:3: error: implicit declaration of function 'to_lvds_connector'; did you mean 'to_intel_connector'? [-Werror=implicit-function-declaration]
      to_lvds_connector(connector);
      ^~~~~~~~~~~~~~~~~
      to_intel_connector
>> drivers/gpu/drm/i915/intel_lvds.c:481:3: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
>> drivers/gpu/drm/i915/intel_lvds.c:483:36: error: dereferencing pointer to incomplete type 'struct intel_lvds_connector'
     if (!IS_ERR_OR_NULL(lvds_connector->base.edid))
                                       ^~

cc1: some warnings being treated as errors

vim +481 drivers/gpu/drm/i915/intel_lvds.c

79e53945 Jesse Barnes    2008-11-07  470  
79e53945 Jesse Barnes    2008-11-07  471  /**
79e53945 Jesse Barnes    2008-11-07  472   * intel_lvds_destroy - unregister and free LVDS structures
79e53945 Jesse Barnes    2008-11-07  473   * @connector: connector to free
79e53945 Jesse Barnes    2008-11-07  474   *
79e53945 Jesse Barnes    2008-11-07  475   * Unregister the DDC bus for this connector then free the driver private
79e53945 Jesse Barnes    2008-11-07  476   * structure.
79e53945 Jesse Barnes    2008-11-07  477   */
79e53945 Jesse Barnes    2008-11-07  478  static void intel_lvds_destroy(struct drm_connector *connector)
79e53945 Jesse Barnes    2008-11-07  479  {
db1740a0 Jani Nikula     2012-10-19  480  	struct intel_lvds_connector *lvds_connector =
db1740a0 Jani Nikula     2012-10-19 @481  		to_lvds_connector(connector);
79e53945 Jesse Barnes    2008-11-07  482  
9cd300e0 Jani Nikula     2012-10-19 @483  	if (!IS_ERR_OR_NULL(lvds_connector->base.edid))
9cd300e0 Jani Nikula     2012-10-19  484  		kfree(lvds_connector->base.edid);
9cd300e0 Jani Nikula     2012-10-19  485  
1d508706 Jani Nikula     2012-10-19  486  	intel_panel_fini(&lvds_connector->base.panel);
aaa6fd2a Matthew Garrett 2011-08-12  487  
79e53945 Jesse Barnes    2008-11-07  488  	drm_connector_cleanup(connector);
79e53945 Jesse Barnes    2008-11-07  489  	kfree(connector);
79e53945 Jesse Barnes    2008-11-07  490  }
79e53945 Jesse Barnes    2008-11-07  491  

:::::: The code at line 481 was first introduced by commit
:::::: db1740a0f1a1d60391f60cfd93083f3c091d398a drm/i915/lvds: Move the acpi_lid_notifier from drm_i915_private to the connector

:::::: TO: Jani Nikula <[email protected]> :::::: CC: Daniel Vetter <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw
In reply to Jani Nikula
I love your patch! Yet something to improve:

Hi Jani,

I love your patch! Yet something to improve:

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on v4.19-rc7 next-20181009]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jani-Nikula/drm-i915-nuke-the-intel_lvds_connector/20181010-092805
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-x005-201840 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

drivers/gpu//drm/i915/intel_lvds.c: In function 'intel_lvds_destroy':
drivers/gpu//drm/i915/intel_lvds.c:481:3: error: implicit declaration of function 'to_lvds_connector'; did you mean 'to_intel_connector'? [-Werror=implicit-function-declaration]

      to_lvds_connector(connector);
      ^~~~~~~~~~~~~~~~~
      to_intel_connector
>> drivers/gpu//drm/i915/intel_lvds.c:481:3: error: initialization makes pointer from integer without a cast [-Werror=int-conversion]
   drivers/gpu//drm/i915/intel_lvds.c:483:36: error: dereferencing pointer to incomplete type 'struct intel_lvds_connector'
     if (!IS_ERR_OR_NULL(lvds_connector->base.edid))
                                       ^~

cc1: all warnings being treated as errors

vim +481 drivers/gpu//drm/i915/intel_lvds.c

79e53945 Jesse Barnes    2008-11-07  470  
79e53945 Jesse Barnes    2008-11-07  471  /**
79e53945 Jesse Barnes    2008-11-07  472   * intel_lvds_destroy - unregister and free LVDS structures
79e53945 Jesse Barnes    2008-11-07  473   * @connector: connector to free
79e53945 Jesse Barnes    2008-11-07  474   *
79e53945 Jesse Barnes    2008-11-07  475   * Unregister the DDC bus for this connector then free the driver private
79e53945 Jesse Barnes    2008-11-07  476   * structure.
79e53945 Jesse Barnes    2008-11-07  477   */
79e53945 Jesse Barnes    2008-11-07  478  static void intel_lvds_destroy(struct drm_connector *connector)
79e53945 Jesse Barnes    2008-11-07  479  {
db1740a0 Jani Nikula     2012-10-19  480  	struct intel_lvds_connector *lvds_connector =
db1740a0 Jani Nikula     2012-10-19 @481  		to_lvds_connector(connector);
79e53945 Jesse Barnes    2008-11-07  482  
9cd300e0 Jani Nikula     2012-10-19  483  	if (!IS_ERR_OR_NULL(lvds_connector->base.edid))
9cd300e0 Jani Nikula     2012-10-19  484  		kfree(lvds_connector->base.edid);
9cd300e0 Jani Nikula     2012-10-19  485  
1d508706 Jani Nikula     2012-10-19  486  	intel_panel_fini(&lvds_connector->base.panel);
aaa6fd2a Matthew Garrett 2011-08-12  487  
79e53945 Jesse Barnes    2008-11-07  488  	drm_connector_cleanup(connector);
79e53945 Jesse Barnes    2008-11-07  489  	kfree(connector);
79e53945 Jesse Barnes    2008-11-07  490  }
79e53945 Jesse Barnes    2008-11-07  491  

:::::: The code at line 481 was first introduced by commit
:::::: db1740a0f1a1d60391f60cfd93083f3c091d398a drm/i915/lvds: Move the acpi_lid_notifier from drm_i915_private to the connector

:::::: TO: Jani Nikula <[email protected]> :::::: CC: Daniel Vetter <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v1 1/1
#5 lore raw
In reply to Jani Nikula

Quoting Jani Nikula (2018-10-09 22:09:16)

Quoted 6 lines

For a while we carried lvds connector specific data in the lvds connector, but since commit 05c72e77ccda ("drm/i915: Nuke the LVDS lid notifier") we haven't needed it. Revert back to plain intel_connector.

Cc Ville Syrjälä <[email protected]>

-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v1 1/1
#6 lore raw
In reply to Jani Nikula
Quoted 130 lines · Jani Nikula

For a while we carried lvds connector specific data in the lvds connector, but since commit 05c72e77ccda ("drm/i915: Nuke the LVDS lid notifier") we haven't needed it. Revert back to plain intel_connector.

Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_lvds.c | 42 +++++++++++----------------------------
 1 file changed, 12 insertions(+), 30 deletions(-)
drivers/gpu/drm/i915/intel_lvds.c +11 -29
index 1fe970cf9909..510585ed94b2 100644
@@ -42,10 +42,6 @@
 #include <linux/acpi.h>
 
 /* Private structure for the integrated LVDS support */
-struct intel_lvds_connector {
-	struct intel_connector base;
-};
-
 struct intel_lvds_pps {
 	/* 100us units */
 	int t1_t2;
@@ -70,7 +66,7 @@ struct intel_lvds_encoder {
 	struct intel_lvds_pps init_pps;
 	u32 init_lvds_val;
 
-	struct intel_lvds_connector *attached_connector;
+	struct intel_connector *attached_connector;
 };
 
 static struct intel_lvds_encoder *to_lvds_encoder(struct drm_encoder *encoder)
@@ -78,11 +74,6 @@ static struct intel_lvds_encoder *to_lvds_encoder(struct drm_encoder *encoder)
 	return container_of(encoder, struct intel_lvds_encoder, base.base);
 }
 
-static struct intel_lvds_connector *to_lvds_connector(struct drm_connector *connector)
-{
-	return container_of(connector, struct intel_lvds_connector, base.base);
-}
-
 bool intel_lvds_port_enabled(struct drm_i915_private *dev_priv,
 			     i915_reg_t lvds_reg, enum pipe *pipe)
 {
@@ -396,7 +387,7 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
 	struct intel_lvds_encoder *lvds_encoder =
 		to_lvds_encoder(&intel_encoder->base);
 	struct intel_connector *intel_connector =
-		&lvds_encoder->attached_connector->base;
+		lvds_encoder->attached_connector;
 	struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
 	struct intel_crtc *intel_crtc = to_intel_crtc(pipe_config->base.crtc);
 	unsigned int lvds_bpp;
@@ -461,15 +452,15 @@ intel_lvds_detect(struct drm_connector *connector, bool force)
  */
 static int intel_lvds_get_modes(struct drm_connector *connector)
 {
-	struct intel_lvds_connector *lvds_connector = to_lvds_connector(connector);
+	struct intel_connector *intel_connector = to_intel_connector(connector);
 	struct drm_device *dev = connector->dev;
 	struct drm_display_mode *mode;
 
 	/* use cached edid if we have one */
-	if (!IS_ERR_OR_NULL(lvds_connector->base.edid))
-		return drm_add_edid_modes(connector, lvds_connector->base.edid);
+	if (!IS_ERR_OR_NULL(intel_connector->edid))
+		return drm_add_edid_modes(connector, intel_connector->edid);
 
-	mode = drm_mode_duplicate(dev, lvds_connector->base.panel.fixed_mode);
+	mode = drm_mode_duplicate(dev, intel_connector->panel.fixed_mode);
 	if (mode == NULL)
 		return 0;
 
@@ -781,8 +772,7 @@ static bool compute_is_dual_link_lvds(struct intel_lvds_encoder *lvds_encoder)
 		return i915_modparams.lvds_channel_mode == 2;
 
 	/* single channel LVDS is limited to 112 MHz */
-	if (lvds_encoder->attached_connector->base.panel.fixed_mode->clock
-	    > 112999)
+	if (lvds_encoder->attached_connector->panel.fixed_mode->clock > 112999)
 		return true;
 
 	if (dmi_check_system(intel_dual_link_lvds))
@@ -837,7 +827,6 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
 	struct drm_device *dev = &dev_priv->drm;
 	struct intel_lvds_encoder *lvds_encoder;
 	struct intel_encoder *intel_encoder;
-	struct intel_lvds_connector *lvds_connector;
 	struct intel_connector *intel_connector;
 	struct drm_connector *connector;
 	struct drm_encoder *encoder;
@@ -890,23 +879,16 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
 	if (!lvds_encoder)
 		return;
 
-	lvds_connector = kzalloc(sizeof(*lvds_connector), GFP_KERNEL);
-	if (!lvds_connector) {
-		kfree(lvds_encoder);
-		return;
-	}
-
-	if (intel_connector_init(&lvds_connector->base) < 0) {
-		kfree(lvds_connector);
+	intel_connector = intel_connector_alloc();
+	if (!intel_connector) {
 		kfree(lvds_encoder);
 		return;
 	}
 
-	lvds_encoder->attached_connector = lvds_connector;
+	lvds_encoder->attached_connector = intel_connector;
 
 	intel_encoder = &lvds_encoder->base;
 	encoder = &intel_encoder->base;
-	intel_connector = &lvds_connector->base;
 	connector = &intel_connector->base;
 	drm_connector_init(dev, &intel_connector->base, &intel_lvds_connector_funcs,
 			   DRM_MODE_CONNECTOR_LVDS);
@@ -987,7 +969,7 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
 	} else {
 		edid = ERR_PTR(-ENOENT);
 	}
-	lvds_connector->base.edid = edid;
+	intel_connector->edid = edid;
 
 	list_for_each_entry(scan, &connector->probed_modes, head) {
 		if (scan->type & DRM_MODE_TYPE_PREFERRED) {

drivers/gpu/drm/i915/intel_lvds.c void intel_lvds_init(struct drm_i915_private *dev_priv) · line 1036

Quoted 5 lines
drivers/gpu/drm/i915/intel_lvds.c +1 -1
@@ -1051,6 +1033,6 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
 	drm_connector_cleanup(connector);
 	drm_encoder_cleanup(encoder);
 	kfree(lvds_encoder);
-	kfree(lvds_connector);
+	intel_connector_free(intel_connector);

I was going to say that this will do a double free on the state, but drm_connector_cleanup() & co. memset(0) the object so this should be fine.

Quoted 4 lines
drivers/gpu/drm/i915/intel_lvds.c +0 -0
 	return;
 }
Signature · 1 line
2.11.0
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw
Quoted 128 lines · Ville Syrjälä
Quoted 127 lines · Jani Nikula

For a while we carried lvds connector specific data in the lvds connector, but since commit 05c72e77ccda ("drm/i915: Nuke the LVDS lid notifier") we haven't needed it. Revert back to plain intel_connector.

Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_lvds.c | 42 +++++++++++----------------------------
 1 file changed, 12 insertions(+), 30 deletions(-)
drivers/gpu/drm/i915/intel_lvds.c +11 -29
index 1fe970cf9909..510585ed94b2 100644
@@ -42,10 +42,6 @@
 #include <linux/acpi.h>
 
 /* Private structure for the integrated LVDS support */
-struct intel_lvds_connector {
-	struct intel_connector base;
-};
-
 struct intel_lvds_pps {
 	/* 100us units */
 	int t1_t2;
@@ -70,7 +66,7 @@ struct intel_lvds_encoder {
 	struct intel_lvds_pps init_pps;
 	u32 init_lvds_val;
 
-	struct intel_lvds_connector *attached_connector;
+	struct intel_connector *attached_connector;
 };
 
 static struct intel_lvds_encoder *to_lvds_encoder(struct drm_encoder *encoder)
@@ -78,11 +74,6 @@ static struct intel_lvds_encoder *to_lvds_encoder(struct drm_encoder *encoder)
 	return container_of(encoder, struct intel_lvds_encoder, base.base);
 }
 
-static struct intel_lvds_connector *to_lvds_connector(struct drm_connector *connector)
-{
-	return container_of(connector, struct intel_lvds_connector, base.base);
-}
-
 bool intel_lvds_port_enabled(struct drm_i915_private *dev_priv,
 			     i915_reg_t lvds_reg, enum pipe *pipe)
 {
@@ -396,7 +387,7 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,
 	struct intel_lvds_encoder *lvds_encoder =
 		to_lvds_encoder(&intel_encoder->base);
 	struct intel_connector *intel_connector =
-		&lvds_encoder->attached_connector->base;
+		lvds_encoder->attached_connector;
 	struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
 	struct intel_crtc *intel_crtc = to_intel_crtc(pipe_config->base.crtc);
 	unsigned int lvds_bpp;
@@ -461,15 +452,15 @@ intel_lvds_detect(struct drm_connector *connector, bool force)
  */
 static int intel_lvds_get_modes(struct drm_connector *connector)
 {
-	struct intel_lvds_connector *lvds_connector = to_lvds_connector(connector);
+	struct intel_connector *intel_connector = to_intel_connector(connector);
 	struct drm_device *dev = connector->dev;
 	struct drm_display_mode *mode;
 
 	/* use cached edid if we have one */
-	if (!IS_ERR_OR_NULL(lvds_connector->base.edid))
-		return drm_add_edid_modes(connector, lvds_connector->base.edid);
+	if (!IS_ERR_OR_NULL(intel_connector->edid))
+		return drm_add_edid_modes(connector, intel_connector->edid);
 
-	mode = drm_mode_duplicate(dev, lvds_connector->base.panel.fixed_mode);
+	mode = drm_mode_duplicate(dev, intel_connector->panel.fixed_mode);
 	if (mode == NULL)
 		return 0;
 
@@ -781,8 +772,7 @@ static bool compute_is_dual_link_lvds(struct intel_lvds_encoder *lvds_encoder)
 		return i915_modparams.lvds_channel_mode == 2;
 
 	/* single channel LVDS is limited to 112 MHz */
-	if (lvds_encoder->attached_connector->base.panel.fixed_mode->clock
-	    > 112999)
+	if (lvds_encoder->attached_connector->panel.fixed_mode->clock > 112999)
 		return true;
 
 	if (dmi_check_system(intel_dual_link_lvds))
@@ -837,7 +827,6 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
 	struct drm_device *dev = &dev_priv->drm;
 	struct intel_lvds_encoder *lvds_encoder;
 	struct intel_encoder *intel_encoder;
-	struct intel_lvds_connector *lvds_connector;
 	struct intel_connector *intel_connector;
 	struct drm_connector *connector;
 	struct drm_encoder *encoder;
@@ -890,23 +879,16 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
 	if (!lvds_encoder)
 		return;
 
-	lvds_connector = kzalloc(sizeof(*lvds_connector), GFP_KERNEL);
-	if (!lvds_connector) {
-		kfree(lvds_encoder);
-		return;
-	}
-
-	if (intel_connector_init(&lvds_connector->base) < 0) {
-		kfree(lvds_connector);
+	intel_connector = intel_connector_alloc();
+	if (!intel_connector) {
 		kfree(lvds_encoder);
 		return;
 	}
 
-	lvds_encoder->attached_connector = lvds_connector;
+	lvds_encoder->attached_connector = intel_connector;
 
 	intel_encoder = &lvds_encoder->base;
 	encoder = &intel_encoder->base;
-	intel_connector = &lvds_connector->base;
 	connector = &intel_connector->base;
 	drm_connector_init(dev, &intel_connector->base, &intel_lvds_connector_funcs,
 			   DRM_MODE_CONNECTOR_LVDS);
@@ -987,7 +969,7 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
 	} else {
 		edid = ERR_PTR(-ENOENT);
 	}
-	lvds_connector->base.edid = edid;
+	intel_connector->edid = edid;
 
Quoted 12 lines

drivers/gpu/drm/i915/intel_lvds.c void intel_lvds_init(struct drm_i915_private *dev_priv) · line 1036

Quoted 8 lines
drivers/gpu/drm/i915/intel_lvds.c +1 -1
 	list_for_each_entry(scan, &connector->probed_modes, head) {
 		if (scan->type & DRM_MODE_TYPE_PREFERRED) {
@@ -1051,6 +1033,6 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
 	drm_connector_cleanup(connector);
 	drm_encoder_cleanup(encoder);
 	kfree(lvds_encoder);
-	kfree(lvds_connector);
+	intel_connector_free(intel_connector);

I was going to say that this will do a double free on the state, but drm_connector_cleanup() & co. memset(0) the object so this should be fine.

I'll just note that we do have some work to do in the fail paths in other connectors...

Quoted 1 line

Thanks for the review, Chris and Ville. Pushed.

BR,
Jani.

Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/i915/intel_lvds.c +0 -0
 	return;
 }
Signature · 1 line
2.11.0
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx