Received: by 10.192.165.148 with SMTP id m20csp4129674imm; Tue, 8 May 2018 03:31:35 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo4Ax8K7ICiKiWQbvrCMP3RCZ0h8bs5VEP3fwPsy3B6z12zqgpBPwpByDYcLUqd8J1K9QmF X-Received: by 2002:a17:902:20cb:: with SMTP id v11-v6mr40087002plg.82.1525775495876; Tue, 08 May 2018 03:31:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525775495; cv=none; d=google.com; s=arc-20160816; b=W5SgmwuBriSWBqQwQ5IckcQ5SXQNyPOjPyeWUwC1MWLt9rypr3EvZSa0gr3/jiB7cL BIIDdeoQKA2tHi3hgQ1+cjrQWi+mzGCZcvXYb523j0RcrVf/rsGt/nOWMf4ynXoS0Gpw MlW97tr6lXrCcYpFua0j937X4JHymjLnHQ3fMekGA/9VJG1eOuj7GTd24WobrstEVLMz yO1T2OCwChh8uYdDIAAdcSDE0RUpwgDlIWVszOvRdsrhL766BCtoy05gyc+nk9e4hE2v MebxZjfgUIoRoiSyR4VbcEw1dZBs5fZvRCkueIGniGfrL5puMCcMWVKHQuOusx4PiqSl l3oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=P7OSMpunGN4AuPzTNkvi71pgrb3UZ0g7ljfB3eyC3gw=; b=sdIUkemMt96V2k9Sbh+D4JMbqmZflZ07jPGoFWXm9MZRi3TEaEF/5HMpcZKPP0Ie61 GOnZMlpWoHMPr6LiD6Pz413HAF/wmSjiOFbFUv1FiWs9pPjnBXNXnXC/wIkirobAC/2H IRtHQuhG608PCGZqkc9rJaHfNYkLv9+oEH8mY80qtHAf42r+qOISh5PikEAN+ZvWle9c QgZPzKlmY0pNODukgJZJW2Rb87GPGVoOT2zhUUbdYhyoANa6i2FwDgdRFV56IE+lmySK 7n2I6toKyb8Ek0Bi2carh+mb/1CUd8ehb02kNfkqEW20Mv23vpMav92nqcPKCyMnUOTd mRlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=SSj7OD+c; 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 a204si22110324pfa.148.2018.05.08.03.31.21; Tue, 08 May 2018 03:31:35 -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=fail header.i=@ffwll.ch header.s=google header.b=SSj7OD+c; 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 S932102AbeEHKaz (ORCPT + 99 others); Tue, 8 May 2018 06:30:55 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:50886 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754371AbeEHKax (ORCPT ); Tue, 8 May 2018 06:30:53 -0400 Received: by mail-wm0-f66.google.com with SMTP id t11so17995945wmt.0 for ; Tue, 08 May 2018 03:30:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=P7OSMpunGN4AuPzTNkvi71pgrb3UZ0g7ljfB3eyC3gw=; b=SSj7OD+c0L9dV1F0QpSK3SppUJE4jsbEcz7QcuBx+e6LVH0lBsGZ4RNnyOuO7u+Wtj PwbwKIeg6RwJFSe0w7Rad13lD7lxlVJvSJzwVB31AGoEmig0kKqlMaGgqcRhS1agWZVi y8FiVa5+PrxGbEyFnpCu6HQ4YbqYtokeBfpus= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=P7OSMpunGN4AuPzTNkvi71pgrb3UZ0g7ljfB3eyC3gw=; b=lZzGl0DbRVGOswQ9rqwt4WdzIQUD4OC+pjFYT3bx0T+TVTHTj7SmEHs/88wRb0jN5I e4+a9Ki5lodsLi+1teADAJ6zcf2BsB5M/ECYa/dTDWsSeiSG4fl+55sEXGyiqotA4ibU SGvV0hgN72ebcxA7/ciBvSq26IAJxPTLA0NK02LZ0aiVhlupFsdLWt3cQLLYM09x11Q5 +wlm7Qx1JKQM7pkefguqnCX785+VO2yIJv23fanXr5aGThv5H3zhK0OS5FKOTNgivcY0 b2j6+QPZcQg386cO2qvmFdd0laTGKu2BNuRo7HUdNykYviH6KCPVONO2vbkM4/zwDL8J tApA== X-Gm-Message-State: ALQs6tBCOzUanw7Cl+jnaSp82PYVdgJASSw0cpPiFoLmZNSEqssPlO59 OB7DlPcgBOok5hSB4wN450nQeA== X-Received: by 2002:a50:ca43:: with SMTP id e3-v6mr20616363edi.222.1525775452414; Tue, 08 May 2018 03:30:52 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:5635:0:39d2:f87e:2033:9f6]) by smtp.gmail.com with ESMTPSA id r48-v6sm14233488edd.16.2018.05.08.03.30.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 May 2018 03:30:51 -0700 (PDT) Date: Tue, 8 May 2018 12:30:49 +0200 From: Daniel Vetter To: Peter Rosin Cc: Jyri Sarha , linux-kernel@vger.kernel.org, Archit Taneja , Andrzej Hajda , Laurent Pinchart , David Airlie , dri-devel@lists.freedesktop.org, Daniel Vetter Subject: Re: [PATCH v2 10/26] drm/bridge: panel: provide an owner .odev device Message-ID: <20180508103049.GP28661@phenom.ffwll.local> Mail-Followup-To: Peter Rosin , Jyri Sarha , linux-kernel@vger.kernel.org, Archit Taneja , Andrzej Hajda , Laurent Pinchart , David Airlie , dri-devel@lists.freedesktop.org References: <20180504135212.26977-1-peda@axentia.se> <20180504135212.26977-11-peda@axentia.se> <5130ea2e-e1cd-53dd-25da-038deb91a13d@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: Linux phenom 4.15.0-3-amd64 User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 08, 2018 at 09:58:49AM +0200, Peter Rosin wrote: > On 2018-05-08 08:51, Jyri Sarha wrote: > > On 05/04/18 16:51, Peter Rosin wrote: > >> It gets rid of an #ifdef and the .of_node member is going away. > >> > >> Signed-off-by: Peter Rosin > >> --- > >> drivers/gpu/drm/bridge/panel.c | 4 +--- > >> 1 file changed, 1 insertion(+), 3 deletions(-) > >> > >> diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c > >> index 6d99d4a3beb3..f43d77b5ed20 100644 > >> --- a/drivers/gpu/drm/bridge/panel.c > >> +++ b/drivers/gpu/drm/bridge/panel.c > >> @@ -169,10 +169,8 @@ struct drm_bridge *drm_panel_bridge_add(struct drm_panel *panel, > >> panel_bridge->connector_type = connector_type; > >> panel_bridge->panel = panel; > >> > >> + panel_bridge->bridge.odev = panel->dev; > > > > I am afraid this approach will eventually conflict with my lately > > accepted patch[1]. > > I don't see how? The links are refcounted. So, if there is one link > each for the panel and bridge between the drm device and the panel > device that link will simply get two references. If/when the panel > device then goes away, the drm device will be brought down because > of that link (with two references, but that is irrelevant). When > the drm device is brought down, it will (presumably) bring down the > bridge as well (which will fix the refcount as the bridge link is > killed as part of that). > > Or have you done some test and seen an actual problem? > > > The panel already has a device pointer of its own, and technically the > > bridge element created here is created by the master drm device itself. > > Not always, some bridges also call drm_panel_bridge_add for connecting > its output to either a panel or another bridge. > > And by that line of argument, the devm_kzalloc in drm_panel_bridge_add > attaches the bridge memory to the wrong device as well. Maybe that > should be fixed? Seems orthogonal though, but it would introduce a > natural struct device in that function to assign to .odev. I think > the device owning the bridge memory should be the same as the .odev > device of the bridge. Drive-by comment: You can't allocate anything with devm_* functions that represents a core drm struct attached to a drm_device. There's no struct device anywhere that has the right lifetime (since the drm_device can easily outlive any physical device). Yes that makes roughly 100% of all armsoc drm drivers buggy :-/ But it doesn't matter, since you can't really unplug those devices physically, hence will only blow up if you force an unbind through sysfs, and then you get to keep all the pieces. Ignorance is bliss meanwhile ... -Daniel > > > I suggest assigning odev here to NULL or to master drm device itself. > > I'd rather not use NULL, since it is nice to be able to rely on the > .odev being there, and WARN if it isn't. > > Cheers, > Peter > > > Best regards, > > Jyri > > > >> panel_bridge->bridge.funcs = &panel_bridge_bridge_funcs; > >> -#ifdef CONFIG_OF > >> - panel_bridge->bridge.of_node = panel->dev->of_node; > >> -#endif > >> > >> drm_bridge_add(&panel_bridge->bridge); > >> > >> > > > > [1] https://lists.freedesktop.org/archives/dri-devel/2018-April/174559.html > > > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch