Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp5566202imm; Tue, 16 Oct 2018 12:16:39 -0700 (PDT) X-Google-Smtp-Source: ACcGV61x9hx8Y5h6pKtPNRrOS0+OgIPoIDfljcPJgLaancekyiqL87K8deuNsjg76uVqt/IoFsyY X-Received: by 2002:a63:c0f:: with SMTP id b15-v6mr21699789pgl.400.1539717399489; Tue, 16 Oct 2018 12:16:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539717399; cv=none; d=google.com; s=arc-20160816; b=jl9MObWME+GV9RJQ82VzE6QAFobDgaKEM/AqZf15imj2o+zq0l7X2QJs1UxV//HO8/ 7pNSQQ/1emaSl61r9Ev63PMRhH8cNhKXh1irvLolTxlpqOEMOMO2Ck96b82wausuOHU1 V/MRbL06qRs9OurNcwTZz2kITxFZoGZ1o5Sr8fO/XoWLOnt5FLkN6x21gervBv6aBIxx YbR8RtXZrE+iBkkX2pBhrCPjs0qvuXJaD1v4AT4c2hwrEM0K8r1Ev/+HsGirzMX5i1BV PUDoK3N5VBz9/lO5vK81wUWzZltZZVyChfojKd63hWFRGkqJuyGftvoBzKNGzQl/g0Wn xXQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=yqE/xKUkXOqRGZ3y1JQA4mipYpbPhvj3NWyrjDlqb58=; b=AXdgzpk0Whk5YVgd0WOHiO+MrGtlf9ntQy1QXHzTS6lVe3BjZHJzWft21NUWNXNNlc jCErvQcTkr5z1C7l4Guf4x7hWUQ5+qi54qUMZ6iuywtQMD5A+JSb9PlFKCfJ3s/tBFa3 V6TQ60HM6POF6WdAn29JGGIHyCJVYFs7thsKUBAAOnGqxv2D3OVNDvnq3oU9H913LKqM EDU3JPKxDvslTmCkdsMcFFo1e7Q/nIcFNK95YAH/pMzM+8wB5VfBFXqdrs4KNRyE01yM Hz6bsUpQSz9IFVHfnPYPAbM0SIK7YG2ZjrACIHHxEiw+ESk1ZahkhUXWjP1O1kwy7Gk7 JbTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=jMIehTXh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x1-v6si15204865pgo.144.2018.10.16.12.16.23; Tue, 16 Oct 2018 12:16:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=jMIehTXh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727370AbeJQDHT (ORCPT + 99 others); Tue, 16 Oct 2018 23:07:19 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:46174 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727007AbeJQDHS (ORCPT ); Tue, 16 Oct 2018 23:07:18 -0400 Received: by mail-qt1-f196.google.com with SMTP id d8-v6so27100991qtk.13 for ; Tue, 16 Oct 2018 12:15:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=yqE/xKUkXOqRGZ3y1JQA4mipYpbPhvj3NWyrjDlqb58=; b=jMIehTXhvV9cWi7AWaCO1aQ117tGZkd0N2pD5x0Ed+zEZ9v9g0Kn/5UTIuP2EFBrql Ye/IV9zBMBAecaq+3GcvyXfZYPhy4hb5KkiLy8bQwC0QwWTvhx5efPPyzMVA5KmyoPZk 3pOy4yXwdyLonhrYHPUuHEzwShUZUyvTjPAZ8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=yqE/xKUkXOqRGZ3y1JQA4mipYpbPhvj3NWyrjDlqb58=; b=doI9FTeSZXROBB5Iu3Tk0HADJFx+f7EgWhZPw3G5aYKv7/qmmudDydqNjm4iRrnxTY DKC0IIHX4Oq6QTHxWhXACSWIy3lV3w3tQ1Hg5IBGXY9s4QoSeuS7qQFIQEY025II2Hhc QRpYotREKGxNpk6oblfvtkt4le2TP1+VoTGOtKqoPwEf2OnRhEMZd3w4LWP8KsbLzAkp 7Ei3CiA5+3QhFrwLCOcgDsOCgHlEEa1BY/TCxcEIpyhS0uJR2t/NgcgcqUItk5Cw0gHr H8fgawVx0mASM7rfP/pKHLgZwmfhJ19lS/7HDE+MSzA5/Z3u1NauqYJDh+boNJIpVutH IhgQ== X-Gm-Message-State: ABuFfoh7jrQvNpyhHfsVnJ65rRW5kT48pQNfmbD6pP4zVc1sCDe7/uj2 Ebv8glIyuj8fo11QRJvTclEuYo+DD4aDnW41G4ydQw== X-Received: by 2002:ad4:42d0:: with SMTP id f16mr13616769qvr.54.1539717324863; Tue, 16 Oct 2018 12:15:24 -0700 (PDT) MIME-Version: 1.0 References: <20181012094639.1585-1-benjamin.gaignard@linaro.org> <20181012094639.1585-2-benjamin.gaignard@linaro.org> <20181015080033.GQ31561@phenom.ffwll.local> In-Reply-To: From: Daniel Vetter Date: Tue, 16 Oct 2018 21:15:13 +0200 Message-ID: Subject: Re: [PATCH] drm/sti: clean up after drm_atomic_helper_shutdown rework To: Benjamin Gaignard Cc: Dave Airlie , dri-devel , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 16, 2018 at 8:30 PM Benjamin Gaignard wrote: > > Le lun. 15 oct. 2018 =C3=A0 10:00, Daniel Vetter a =C3= =A9crit : > > > > On Fri, Oct 12, 2018 at 11:46:39AM +0200, Benjamin Gaignard wrote: > > > Since drm_atomic_helper_shutdown() rework it is possible to do additi= onal > > > clean up in sti driver: custom plane destroy functions become useless= and > > > clean up encoder is no more needed. > > > > > > Signed-off-by: Benjamin Gaignard > > > --- > > > drivers/gpu/drm/sti/sti_cursor.c | 9 +-------- > > > drivers/gpu/drm/sti/sti_gdp.c | 9 +-------- > > > drivers/gpu/drm/sti/sti_hqvdp.c | 9 +-------- > > > drivers/gpu/drm/sti/sti_tvout.c | 24 ------------------------ > > > 4 files changed, 3 insertions(+), 48 deletions(-) > > > > > > diff --git a/drivers/gpu/drm/sti/sti_cursor.c b/drivers/gpu/drm/sti/s= ti_cursor.c > > > index bc908453ffb3..e1ba253055c7 100644 > > > --- a/drivers/gpu/drm/sti/sti_cursor.c > > > +++ b/drivers/gpu/drm/sti/sti_cursor.c > > > @@ -328,13 +328,6 @@ static const struct drm_plane_helper_funcs sti_c= ursor_helpers_funcs =3D { > > > .atomic_disable =3D sti_cursor_atomic_disable, > > > }; > > > > > > -static void sti_cursor_destroy(struct drm_plane *drm_plane) > > > -{ > > > - DRM_DEBUG_DRIVER("\n"); > > > - > > > - drm_plane_cleanup(drm_plane); > > > -} > > > - > > > static int sti_cursor_late_register(struct drm_plane *drm_plane) > > > { > > > struct sti_plane *plane =3D to_sti_plane(drm_plane); > > > @@ -346,7 +339,7 @@ static int sti_cursor_late_register(struct drm_pl= ane *drm_plane) > > > static const struct drm_plane_funcs sti_cursor_plane_helpers_funcs = =3D { > > > .update_plane =3D drm_atomic_helper_update_plane, > > > .disable_plane =3D drm_atomic_helper_disable_plane, > > > - .destroy =3D sti_cursor_destroy, > > > + .destroy =3D drm_plane_cleanup, > > > .reset =3D sti_plane_reset, > > > .atomic_duplicate_state =3D drm_atomic_helper_plane_duplicate_s= tate, > > > .atomic_destroy_state =3D drm_atomic_helper_plane_destroy_state= , > > > diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_= gdp.c > > > index 3c19614d3f75..87b50451afd7 100644 > > > --- a/drivers/gpu/drm/sti/sti_gdp.c > > > +++ b/drivers/gpu/drm/sti/sti_gdp.c > > > @@ -879,13 +879,6 @@ static const struct drm_plane_helper_funcs sti_g= dp_helpers_funcs =3D { > > > .atomic_disable =3D sti_gdp_atomic_disable, > > > }; > > > > > > -static void sti_gdp_destroy(struct drm_plane *drm_plane) > > > -{ > > > - DRM_DEBUG_DRIVER("\n"); > > > - > > > - drm_plane_cleanup(drm_plane); > > > -} > > > - > > > static int sti_gdp_late_register(struct drm_plane *drm_plane) > > > { > > > struct sti_plane *plane =3D to_sti_plane(drm_plane); > > > @@ -897,7 +890,7 @@ static int sti_gdp_late_register(struct drm_plane= *drm_plane) > > > static const struct drm_plane_funcs sti_gdp_plane_helpers_funcs =3D = { > > > .update_plane =3D drm_atomic_helper_update_plane, > > > .disable_plane =3D drm_atomic_helper_disable_plane, > > > - .destroy =3D sti_gdp_destroy, > > > + .destroy =3D drm_plane_cleanup, > > > .reset =3D sti_plane_reset, > > > .atomic_duplicate_state =3D drm_atomic_helper_plane_duplicate_s= tate, > > > .atomic_destroy_state =3D drm_atomic_helper_plane_destroy_state= , > > > diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/st= i_hqvdp.c > > > index 23565f52dd71..065a5b08a702 100644 > > > --- a/drivers/gpu/drm/sti/sti_hqvdp.c > > > +++ b/drivers/gpu/drm/sti/sti_hqvdp.c > > > @@ -1256,13 +1256,6 @@ static const struct drm_plane_helper_funcs sti= _hqvdp_helpers_funcs =3D { > > > .atomic_disable =3D sti_hqvdp_atomic_disable, > > > }; > > > > > > -static void sti_hqvdp_destroy(struct drm_plane *drm_plane) > > > -{ > > > - DRM_DEBUG_DRIVER("\n"); > > > - > > > - drm_plane_cleanup(drm_plane); > > > -} > > > - > > > static int sti_hqvdp_late_register(struct drm_plane *drm_plane) > > > { > > > struct sti_plane *plane =3D to_sti_plane(drm_plane); > > > @@ -1274,7 +1267,7 @@ static int sti_hqvdp_late_register(struct drm_p= lane *drm_plane) > > > static const struct drm_plane_funcs sti_hqvdp_plane_helpers_funcs = =3D { > > > .update_plane =3D drm_atomic_helper_update_plane, > > > .disable_plane =3D drm_atomic_helper_disable_plane, > > > - .destroy =3D sti_hqvdp_destroy, > > > + .destroy =3D drm_plane_cleanup, > > > .reset =3D sti_plane_reset, > > > .atomic_duplicate_state =3D drm_atomic_helper_plane_duplicate_s= tate, > > > .atomic_destroy_state =3D drm_atomic_helper_plane_destroy_state= , > > > diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/st= i_tvout.c > > > index ea4a3b87fa55..4dc3b2ec40eb 100644 > > > --- a/drivers/gpu/drm/sti/sti_tvout.c > > > +++ b/drivers/gpu/drm/sti/sti_tvout.c > > > @@ -788,21 +788,6 @@ static void sti_tvout_create_encoders(struct drm= _device *dev, > > > tvout->dvo =3D sti_tvout_create_dvo_encoder(dev, tvout); > > > } > > > > > > -static void sti_tvout_destroy_encoders(struct sti_tvout *tvout) > > > -{ > > > - if (tvout->hdmi) > > > - drm_encoder_cleanup(tvout->hdmi); > > > - tvout->hdmi =3D NULL; > > > - > > > - if (tvout->hda) > > > - drm_encoder_cleanup(tvout->hda); > > > - tvout->hda =3D NULL; > > > - > > > - if (tvout->dvo) > > > - drm_encoder_cleanup(tvout->dvo); > > > - tvout->dvo =3D NULL; > > > -} > > > - > > > static int sti_tvout_bind(struct device *dev, struct device *master,= void *data) > > > { > > > struct sti_tvout *tvout =3D dev_get_drvdata(dev); > > > @@ -815,17 +800,8 @@ static int sti_tvout_bind(struct device *dev, st= ruct device *master, void *data) > > > return 0; > > > } > > > > > > -static void sti_tvout_unbind(struct device *dev, struct device *mast= er, > > > - void *data) > > > -{ > > > - struct sti_tvout *tvout =3D dev_get_drvdata(dev); > > > - > > > - sti_tvout_destroy_encoders(tvout); > > > -} > > > - > > > static const struct component_ops sti_tvout_ops =3D { > > > .bind =3D sti_tvout_bind, > > > - .unbind =3D sti_tvout_unbind, > > > > Hm, this here looks strange now. I'd put a comment somewhere that > > master_ops->unbind cleans up everything. Either way: > > > > Reviewed-by: Daniel Vetter > > Hi Daniel, > > unbind undo what has been done in bind even the functions aren't symetric= : > encoder creation are done is this level of the driver while they > destruction is done > in the top level of the driver by calling drm shutdown function. From > module point of view > bind and unbind are balanced correctly. > I have test it on board :-) Yes that's my understanding too, but then I stumbled over this revert (I cc'ed you on it): https://lore.kernel.org/patchwork/patch/1000524/ Now I'm not sure anymore whether my r-b is correct. What happens if only one of the components gets unbound, and not the top level? > I will not merge this patch until I get a clear review from you. You had one, but I just retracted it because of the revert ... -Daniel > > Regards, > Benjamin > > > > > }; > > > > > > static int sti_tvout_probe(struct platform_device *pdev) > > > -- > > > 2.15.0 > > > > > > > -- > > Daniel Vetter > > Software Engineer, Intel Corporation > > http://blog.ffwll.ch --=20 Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch