dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Grazvydas Ignotas <notasas@gmail.com>
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdgpu: use .early_unregister hook to remove DP AUX i2c
Date: Mon, 10 Oct 2016 11:25:23 +0200	[thread overview]
Message-ID: <20161010092523.GV20761@phenom.ffwll.local> (raw)
In-Reply-To: <1476034099-4549-1-git-send-email-notasas@gmail.com>

On Sun, Oct 09, 2016 at 08:28:19PM +0300, Grazvydas Ignotas 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@gmail.com>

would be nice to also split things up on the register side, for symmetry.
Just as one small step towards demidlayering amdgpu.
-Daniel

> ---
>  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
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-10-10  9:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-09 17:28 [PATCH] drm/amdgpu: use .early_unregister hook to remove DP AUX i2c Grazvydas Ignotas
2016-10-10  9:25 ` Daniel Vetter [this message]
2016-10-11 16:26 ` Alex Deucher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161010092523.GV20761@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=notasas@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox