diff options
author | Grazvydas Ignotas <notasas@gmail.com> | 2016-10-09 13:28:19 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-10-12 15:44:12 -0400 |
commit | 40492f60794aaf32576cb42d9af86eed785a6e63 (patch) | |
tree | e34852ace546e9ed191cc74273b1ee753f6bed35 | |
parent | 69405d3da98b48633b78a49403e4f9cdb7c6a0f5 (diff) |
drm/amdgpu: use .early_unregister hook to remove DP AUX i2c
When DisplayPort AUX channel i2c adapter is registered, drm_connector's
kdev member is used as a parent, so we get sysfs structure like:
/drm/card1/card1-DP-2/i2c-12
Because of that, there is a problem when drm core (and not the driver)
calls drm_connector_unregister(), it removes parent sysfs entries
('card1-DP-2' in our example) while the i2c adapter is still registered.
Later we get a WARN when we try to unregister the i2c adapter:
WARNING: CPU: 3 PID: 1374 at fs/sysfs/group.c:243 sysfs_remove_group+0x14c/0x150
sysfs group ffffffff82911e40 not found for kobject 'i2c-12'
To fix it, we can use the .early_unregister hook to unregister the i2c
adapter before drm_connector's sysfs is torn down.
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c index 2e3a0543760d..e3281d4e3e41 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | |||
@@ -765,7 +765,7 @@ amdgpu_connector_lvds_detect(struct drm_connector *connector, bool force) | |||
765 | return ret; | 765 | return ret; |
766 | } | 766 | } |
767 | 767 | ||
768 | static void amdgpu_connector_destroy(struct drm_connector *connector) | 768 | static void amdgpu_connector_unregister(struct drm_connector *connector) |
769 | { | 769 | { |
770 | struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector); | 770 | struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector); |
771 | 771 | ||
@@ -773,6 +773,12 @@ static void amdgpu_connector_destroy(struct drm_connector *connector) | |||
773 | drm_dp_aux_unregister(&amdgpu_connector->ddc_bus->aux); | 773 | drm_dp_aux_unregister(&amdgpu_connector->ddc_bus->aux); |
774 | amdgpu_connector->ddc_bus->has_aux = false; | 774 | amdgpu_connector->ddc_bus->has_aux = false; |
775 | } | 775 | } |
776 | } | ||
777 | |||
778 | static void amdgpu_connector_destroy(struct drm_connector *connector) | ||
779 | { | ||
780 | struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector); | ||
781 | |||
776 | amdgpu_connector_free_edid(connector); | 782 | amdgpu_connector_free_edid(connector); |
777 | kfree(amdgpu_connector->con_priv); | 783 | kfree(amdgpu_connector->con_priv); |
778 | drm_connector_unregister(connector); | 784 | drm_connector_unregister(connector); |
@@ -826,6 +832,7 @@ static const struct drm_connector_funcs amdgpu_connector_lvds_funcs = { | |||
826 | .dpms = drm_helper_connector_dpms, | 832 | .dpms = drm_helper_connector_dpms, |
827 | .detect = amdgpu_connector_lvds_detect, | 833 | .detect = amdgpu_connector_lvds_detect, |
828 | .fill_modes = drm_helper_probe_single_connector_modes, | 834 | .fill_modes = drm_helper_probe_single_connector_modes, |
835 | .early_unregister = amdgpu_connector_unregister, | ||
829 | .destroy = amdgpu_connector_destroy, | 836 | .destroy = amdgpu_connector_destroy, |
830 | .set_property = amdgpu_connector_set_lcd_property, | 837 | .set_property = amdgpu_connector_set_lcd_property, |
831 | }; | 838 | }; |
@@ -936,6 +943,7 @@ static const struct drm_connector_funcs amdgpu_connector_vga_funcs = { | |||
936 | .dpms = drm_helper_connector_dpms, | 943 | .dpms = drm_helper_connector_dpms, |
937 | .detect = amdgpu_connector_vga_detect, | 944 | .detect = amdgpu_connector_vga_detect, |
938 | .fill_modes = drm_helper_probe_single_connector_modes, | 945 | .fill_modes = drm_helper_probe_single_connector_modes, |
946 | .early_unregister = amdgpu_connector_unregister, | ||
939 | .destroy = amdgpu_connector_destroy, | 947 | .destroy = amdgpu_connector_destroy, |
940 | .set_property = amdgpu_connector_set_property, | 948 | .set_property = amdgpu_connector_set_property, |
941 | }; | 949 | }; |
@@ -1203,6 +1211,7 @@ static const struct drm_connector_funcs amdgpu_connector_dvi_funcs = { | |||
1203 | .detect = amdgpu_connector_dvi_detect, | 1211 | .detect = amdgpu_connector_dvi_detect, |
1204 | .fill_modes = drm_helper_probe_single_connector_modes, | 1212 | .fill_modes = drm_helper_probe_single_connector_modes, |
1205 | .set_property = amdgpu_connector_set_property, | 1213 | .set_property = amdgpu_connector_set_property, |
1214 | .early_unregister = amdgpu_connector_unregister, | ||
1206 | .destroy = amdgpu_connector_destroy, | 1215 | .destroy = amdgpu_connector_destroy, |
1207 | .force = amdgpu_connector_dvi_force, | 1216 | .force = amdgpu_connector_dvi_force, |
1208 | }; | 1217 | }; |
@@ -1493,6 +1502,7 @@ static const struct drm_connector_funcs amdgpu_connector_dp_funcs = { | |||
1493 | .detect = amdgpu_connector_dp_detect, | 1502 | .detect = amdgpu_connector_dp_detect, |
1494 | .fill_modes = drm_helper_probe_single_connector_modes, | 1503 | .fill_modes = drm_helper_probe_single_connector_modes, |
1495 | .set_property = amdgpu_connector_set_property, | 1504 | .set_property = amdgpu_connector_set_property, |
1505 | .early_unregister = amdgpu_connector_unregister, | ||
1496 | .destroy = amdgpu_connector_destroy, | 1506 | .destroy = amdgpu_connector_destroy, |
1497 | .force = amdgpu_connector_dvi_force, | 1507 | .force = amdgpu_connector_dvi_force, |
1498 | }; | 1508 | }; |
@@ -1502,6 +1512,7 @@ static const struct drm_connector_funcs amdgpu_connector_edp_funcs = { | |||
1502 | .detect = amdgpu_connector_dp_detect, | 1512 | .detect = amdgpu_connector_dp_detect, |
1503 | .fill_modes = drm_helper_probe_single_connector_modes, | 1513 | .fill_modes = drm_helper_probe_single_connector_modes, |
1504 | .set_property = amdgpu_connector_set_lcd_property, | 1514 | .set_property = amdgpu_connector_set_lcd_property, |
1515 | .early_unregister = amdgpu_connector_unregister, | ||
1505 | .destroy = amdgpu_connector_destroy, | 1516 | .destroy = amdgpu_connector_destroy, |
1506 | .force = amdgpu_connector_dvi_force, | 1517 | .force = amdgpu_connector_dvi_force, |
1507 | }; | 1518 | }; |