Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933413AbdDGMBS (ORCPT ); Fri, 7 Apr 2017 08:01:18 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:62231 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932601AbdDGMBI (ORCPT ); Fri, 7 Apr 2017 08:01:08 -0400 X-AuditID: cbfec7f1-f796e6d00000116b-f2-58e77f81c3aa Subject: Re: [PATCH v5 04/12] drm: bridge: analogix: Destroy connector & encoder when unbinding To: Jeffy Chen , linux-kernel@vger.kernel.org Cc: Marek Vasut , Tomeu Vizoso , briannorris@chromium.org, dianders@chromium.org, dri-devel@lists.freedesktop.org, tfiga@chromium.org, zyw@rock-chips.com, Yakir Yang From: Andrzej Hajda Message-id: <59da511f-5243-fffb-f366-a51807b04a20@samsung.com> Date: Fri, 07 Apr 2017 14:01:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-version: 1.0 In-reply-to: <1491481885-13775-5-git-send-email-jeffy.chen@rock-chips.com> Content-type: text/plain; charset=utf-8 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrNKsWRmVeSWpSXmKPExsWy7djP87qN9c8jDA5sULHY9PE9q8XZZQfZ LK58fc9m8f3GWTaLC/tPM1lc3jWHzeJNWyOjxefWf2wWfWsvsVnMf7CD2YHLY3bDRRaPHXeX MHrMm3WCxWPnrLvsHve7jzN5/J21n8Xj8ya5APYoLpuU1JzMstQifbsErozVnZ9YC5r5Ktad /crWwHiJu4uRk0NCwERif/cJFghbTOLCvfVsXYxcHEICSxklej+tZoRwPjNK7G1ZygjT8Xd3 IwtEYhmjxPvFW5khnGeMEvO6nrB3MXJwCAskShx8KQfSICLgIXH+ymEmkBpmgbeMEnOvrmEG SbAJaEr83XyTDaSeV8BO4skHbZAwi4CqxM0H08FOEhWIkLg+Z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6xJQpuSBhZgF5ic1r3jJP YBSYhaRjFkLVLCRVCxiZVzGKpJYW56bnFhvpFSfmFpfmpesl5+duYgRG4rZjP7fsYOx6F3yI UYCDUYmHd8HTJxFCrIllxZW5hxglOJiVRHiP1j6PEOJNSaysSi3Kjy8qzUktPsRoCvTCRGYp 0eR8YJLIK4k3NDE0tzQ0MrawMDcyUhLnnfrhSriQQHpiSWp2ampBahFMHxMHp1QD47qLAesu vp6yt3v59S1FHwrCQoXLWrgrTpXvm6Bpq+MuIWc3vfGO1+bpByuSkzP/Za/Njw/LrTa6l5y4 2TCW/dEWhteHamJuv5OKF2nUefutRzZTMzgk76Op9QHBF0kXK3sEJTrubDaVuPKrIveJ/Oa6 VxyXFb++dGQ//MLy0F9Vx2dR574HK7EUZyQaajEXFScCADl9hdTaAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170407120105eucas1p2dc12eb632b027129845c3188318bb273 X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?UTF-8?B?QW5kcnplaiBIYWpkYRtTUlBPTC1LZXJuZWwgKFRQKRvsgrw=?= =?UTF-8?B?7ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?QW5kcnplaiBIYWpkYRtTUlBPTC1LZXJuZWwgKFRQKRtTYW1z?= =?UTF-8?B?dW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170406232740epcas2p41dd575b4e156a3d69bc6056e5a54c106 X-RootMTR: 20170406232740epcas2p41dd575b4e156a3d69bc6056e5a54c106 References: <1491481885-13775-1-git-send-email-jeffy.chen@rock-chips.com> <1491481885-13775-5-git-send-email-jeffy.chen@rock-chips.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1744 Lines: 49 On 06.04.2017 14:31, Jeffy Chen wrote: > Normally we do this in drm_mode_config_cleanup. But: > 1/ analogix dp's connector is allocated in bind, and freed after unbind. > So we need to destroy it in unbind to avoid further access. > 2/ the drm bridge is attached in bind, and detached in encoder cleanup. > So we need to destroy encoder in unbind. > > Signed-off-by: Jeffy Chen In general drm core should free drm resources, doing it in component can hurt some day. Maybe it would be good to move some stuff from bind/unbind to probe/remove if necessary, to allow connector and encoder to live little bit longer, and be destroyed by drm core. This is just suggestion, I am not familiar enough with the driver to make stronger statements :) Reviewed-by: Andrzej Hajda -- Regards Andrzej > --- > > Changes in v5: None > Changes in v4: > Address Andrzej Hajda 's comments. > > Changes in v3: None > Changes in v2: None > > drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c > index d05ade4..4c758ed 100644 > --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c > +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c > @@ -1439,6 +1439,8 @@ void analogix_dp_unbind(struct device *dev, struct device *master, > struct analogix_dp_device *dp = dev_get_drvdata(dev); > > analogix_dp_bridge_disable(dp->bridge); > + dp->connector.funcs->destroy(&dp->connector); > + dp->encoder->funcs->destroy(dp->encoder); > > if (dp->plat_data->panel) { > if (drm_panel_unprepare(dp->plat_data->panel))