[PATCH] drm/amdgpu: use .early_unregister hook to remove DP AUX i2c

Alex Deucher alexdeucher at gmail.com
Tue Oct 11 16:26:10 UTC 2016


On Sun, Oct 9, 2016 at 1:28 PM, Grazvydas Ignotas <notasas at gmail.com> wrote:
> 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 at gmail.com>

Applied.  thanks!

Alex

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> index 76a7830..09b76a8 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)
>         return ret;
>  }
>
> -static void amdgpu_connector_destroy(struct drm_connector *connector)
> +static void amdgpu_connector_unregister(struct drm_connector *connector)
>  {
>         struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector);
>
> @@ -773,6 +773,12 @@ static void amdgpu_connector_destroy(struct drm_connector *connector)
>                 drm_dp_aux_unregister(&amdgpu_connector->ddc_bus->aux);
>                 amdgpu_connector->ddc_bus->has_aux = false;
>         }
> +}
> +
> +static void amdgpu_connector_destroy(struct drm_connector *connector)
> +{
> +       struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector);
> +
>         amdgpu_connector_free_edid(connector);
>         kfree(amdgpu_connector->con_priv);
>         drm_connector_unregister(connector);
> @@ -826,6 +832,7 @@ static const struct drm_connector_funcs amdgpu_connector_lvds_funcs = {
>         .dpms = drm_helper_connector_dpms,
>         .detect = amdgpu_connector_lvds_detect,
>         .fill_modes = drm_helper_probe_single_connector_modes,
> +       .early_unregister = amdgpu_connector_unregister,
>         .destroy = amdgpu_connector_destroy,
>         .set_property = amdgpu_connector_set_lcd_property,
>  };
> @@ -936,6 +943,7 @@ static const struct drm_connector_funcs amdgpu_connector_vga_funcs = {
>         .dpms = drm_helper_connector_dpms,
>         .detect = amdgpu_connector_vga_detect,
>         .fill_modes = drm_helper_probe_single_connector_modes,
> +       .early_unregister = amdgpu_connector_unregister,
>         .destroy = amdgpu_connector_destroy,
>         .set_property = amdgpu_connector_set_property,
>  };
> @@ -1203,6 +1211,7 @@ static const struct drm_connector_funcs amdgpu_connector_dvi_funcs = {
>         .detect = amdgpu_connector_dvi_detect,
>         .fill_modes = drm_helper_probe_single_connector_modes,
>         .set_property = amdgpu_connector_set_property,
> +       .early_unregister = amdgpu_connector_unregister,
>         .destroy = amdgpu_connector_destroy,
>         .force = amdgpu_connector_dvi_force,
>  };
> @@ -1493,6 +1502,7 @@ static const struct drm_connector_funcs amdgpu_connector_dp_funcs = {
>         .detect = amdgpu_connector_dp_detect,
>         .fill_modes = drm_helper_probe_single_connector_modes,
>         .set_property = amdgpu_connector_set_property,
> +       .early_unregister = amdgpu_connector_unregister,
>         .destroy = amdgpu_connector_destroy,
>         .force = amdgpu_connector_dvi_force,
>  };
> @@ -1502,6 +1512,7 @@ static const struct drm_connector_funcs amdgpu_connector_edp_funcs = {
>         .detect = amdgpu_connector_dp_detect,
>         .fill_modes = drm_helper_probe_single_connector_modes,
>         .set_property = amdgpu_connector_set_lcd_property,
> +       .early_unregister = amdgpu_connector_unregister,
>         .destroy = amdgpu_connector_destroy,
>         .force = amdgpu_connector_dvi_force,
>  };
> --
> 2.7.4
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list