From: Peter Rosin <peda@axentia.se>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: "Andrzej Hajda" <a.hajda@samsung.com>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
"Archit Taneja" <architt@codeaurora.org>,
"Laurent Pinchart" <Laurent.pinchart@ideasonboard.com>,
"David Airlie" <airlied@linux.ie>,
"Peter Senna Tschudin" <peter.senna@collabora.com>,
"Martin Donnelly" <martin.donnelly@ge.com>,
"Martyn Welch" <martyn.welch@collabora.co.uk>,
"Gustavo Padovan" <gustavo@padovan.org>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Sean Paul" <seanpaul@chromium.org>,
"Inki Dae" <inki.dae@samsung.com>,
"Joonyoung Shim" <jy0922.shim@samsung.com>,
"Seung-Woo Kim" <sw0312.kim@samsung.com>,
"Kyungmin Park" <kyungmin.park@samsung.com>,
"Kukjin Kim" <kgene@kernel.org>,
"Krzysztof Kozlowski" <krzk@kernel.org>,
"CK Hu" <ck.hu@mediatek.com>,
"Philipp Zabel" <p.zabel@pengutronix.de>,
"Matthias Brugger" <matthias.bgg@gmail.com>,
"Rob Clark" <robdclark@gmail.com>,
"Sandy Huang" <hjc@rock-chips.com>,
"Heiko Stübner" <heiko@sntech.de>,
"Benjamin Gaignard" <benjamin.gaignard@linaro.org>,
"Vincent Abriou" <vincent.abriou@st.com>,
dri-devel <dri-devel@lists.freedesktop.org>,
"Linux ARM" <linux-arm-kernel@lists.infradead.org>,
linux-samsung-soc <linux-samsung-soc@vger.kernel.org>,
"moderated list:ARM/Mediatek SoC support"
<linux-mediatek@lists.infradead.org>,
linux-arm-msm <linux-arm-msm@vger.kernel.org>,
freedreno <freedreno@lists.freedesktop.org>,
"open list:DRM DRIVERS FOR RENESAS"
<linux-renesas-soc@vger.kernel.org>,
"open list:ARM/Rockchip SoC..."
<linux-rockchip@lists.infradead.org>,
"Jyri Sarha" <jsarha@ti.com>
Subject: Re: [PATCH v2 26/26] drm/bridge: establish a link between the bridge supplier and consumer
Date: Tue, 15 May 2018 13:09:59 +0200 [thread overview]
Message-ID: <f8215ba1-4cdb-69b9-39ff-68feca3ec502@axentia.se> (raw)
In-Reply-To: <CAKMK7uECSUo5k6uG3-y+yKQTGxB3FfGcwzMT+ZP5uux2SbpfUg@mail.gmail.com>
On 2018-05-15 12:22, Daniel Vetter wrote:
> On Mon, May 14, 2018 at 10:40 PM, Peter Rosin <peda@axentia.se> wrote:
>> On 2018-05-14 18:28, Daniel Vetter wrote:
>>> On Fri, May 11, 2018 at 09:37:47AM +0200, Peter Rosin wrote:
>>>> On 2018-05-10 10:10, Andrzej Hajda wrote:
>>>>> On 04.05.2018 15:52, Peter Rosin wrote:
>>>>>> If the bridge supplier is unbound, this will bring the bridge consumer
>>>>>> down along with the bridge. Thus, there will no longer linger any
>>>>>> dangling pointers from the bridge consumer (the drm_device) to some
>>>>>> non-existent bridge supplier.
>>>>>>
>>>>>> Signed-off-by: Peter Rosin <peda@axentia.se>
>>>>>> ---
>>>>>> drivers/gpu/drm/drm_bridge.c | 18 ++++++++++++++++++
>>>>>> include/drm/drm_bridge.h | 2 ++
>>>>>> 2 files changed, 20 insertions(+)
>>>>>>
>>>>>> diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
>>>>>> index 78d186b6831b..0259f0a3ff27 100644
>>>>>> --- a/drivers/gpu/drm/drm_bridge.c
>>>>>> +++ b/drivers/gpu/drm/drm_bridge.c
>>>>>> @@ -26,6 +26,7 @@
>>>>>> #include <linux/mutex.h>
>>>>>>
>>>>>> #include <drm/drm_bridge.h>
>>>>>> +#include <drm/drm_device.h>
>>>>>> #include <drm/drm_encoder.h>
>>>>>>
>>>>>> #include "drm_crtc_internal.h"
>>>>>> @@ -127,12 +128,25 @@ int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge,
>>>>>> if (bridge->dev)
>>>>>> return -EBUSY;
>>>>>>
>>>>>> + if (encoder->dev->dev != bridge->odev) {
>>>>>
>>>>> I wonder why device_link_add does not handle this case (self dependency)
>>>>> silently as noop, as it seems to be a correct behavior.
>>>>
>>>> It's kind-of a silly corner-case though, so perfectly understandable
>>>> that it isn't handled.
>>>>
>>>>>> + bridge->link = device_link_add(encoder->dev->dev,
>>>>>> + bridge->odev, 0);
>>>>>> + if (!bridge->link) {
>>>>>> + dev_err(bridge->odev, "failed to link bridge to %s\n",
>>>>>> + dev_name(encoder->dev->dev));
>>>>>> + return -EINVAL;
>>>>>> + }
>>>>>> + }
>>>>>> +
>>>>>> bridge->dev = encoder->dev;
>>>>>> bridge->encoder = encoder;
>>>>>>
>>>>>> if (bridge->funcs->attach) {
>>>>>> ret = bridge->funcs->attach(bridge);
>>>>>> if (ret < 0) {
>>>>>> + if (bridge->link)
>>>>>> + device_link_del(bridge->link);
>>>>>> + bridge->link = NULL;
>>>>>> bridge->dev = NULL;
>>>>>> bridge->encoder = NULL;
>>>>>> return ret;
>>>>>> @@ -159,6 +173,10 @@ void drm_bridge_detach(struct drm_bridge *bridge)
>>>>>> if (bridge->funcs->detach)
>>>>>> bridge->funcs->detach(bridge);
>>>>>>
>>>>>> + if (bridge->link)
>>>>>> + device_link_del(bridge->link);
>>>>>> + bridge->link = NULL;
>>>>>> +
>>>>>> bridge->dev = NULL;
>>>>>> }
>>>>>>
>>>>>> diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
>>>>>> index b656e505d11e..804189c63a4c 100644
>>>>>> --- a/include/drm/drm_bridge.h
>>>>>> +++ b/include/drm/drm_bridge.h
>>>>>> @@ -261,6 +261,7 @@ struct drm_bridge_timings {
>>>>>> * @list: to keep track of all added bridges
>>>>>> * @timings: the timing specification for the bridge, if any (may
>>>>>> * be NULL)
>>>>>> + * @link: drm consumer <-> bridge supplier
>>>>>
>>>>> Nitpick: "<->" suggests symmetry, maybe "device link from drm consumer
>>>>> to the bridge" would be better.
>>>>
>>>> I meant "<->" to indicate that the link is bidirectional, not that the
>>>> relationship is in any way symmetric. I wasn't aware of any implication
>>>> of a symmetric relationship when using "<->", do you have a reference?
>>>> But I guess the different arrow notations in math are somewhat overloaded
>>>> and that someone at some point must have used "<->" to indicate a
>>>> symmetric relationship...
>>>
>>> Yeah I agree with Andrzej here, for me <-> implies a symmetric
>>> relationship. Spelling it out like Andrzej suggested sounds like the
>>> better idea.
>>> -Daniel
>>
>> Ok, I guess that means I have to do a v3 after all. Or can this
>> trivial documentation update be done by the committer? I hate to
>> spam everyone with another volley...
>>
>> Or perhaps I should squash patches 2-23 that are all rather similar
>> and mechanic? I separated them to allow for easier review from
>> individual driver maintainers, but that didn't seem to happen
>> anyway...
>
> Do another volley of the full set, or in-reply-to to just replace the
> patch that needs to be respun (but some people don't like that).
>
> When resending just make sure you're picking up all the acks/r-bs you
> have already.
Right, I always try to do that. One Ack that I did not include in v2
was the one you had on v1 24/24 (i.e. this patch). The reason I did
not add your Ack for v2 even on the patch where it obviously applied
was that I didn't know if you'd barf on the odev name.
But it was (and still is) a bit unclear if that was on Ack on the
last patch only, or if it was for the whole series? I think it might
have been for the whole series, but I'm not sure and I hate to be a
presumptuous idiot...
Cheers,
Peter
> -Daniel
>> Cheers,
>> Peter
>>
>>>
>>>>
>>>>> Anyway:
>>>>> Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
>>>>
>>>> Thanks!
>>>>
>>>> Cheers,
>>>> Peter
>>>>
>>>>> --
>>>>> Regards
>>>>> Andrzej
>>>>>
>>>>>> * @funcs: control functions
>>>>>> * @driver_private: pointer to the bridge driver's internal context
>>>>>> */
>>>>>> @@ -271,6 +272,7 @@ struct drm_bridge {
>>>>>> struct drm_bridge *next;
>>>>>> struct list_head list;
>>>>>> const struct drm_bridge_timings *timings;
>>>>>> + struct device_link *link;
>>>>>>
>>>>>> const struct drm_bridge_funcs *funcs;
>>>>>> void *driver_private;
>>>>>
>>>>>
>>>>
>>>
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
>
>
next prev parent reply other threads:[~2018-05-15 11:10 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-04 13:51 [PATCH v2 00/26] device link, bridge supplier <-> drm device Peter Rosin
2018-05-04 13:51 ` [PATCH v2 01/26] drm/bridge: allow optionally specifying an owner .odev device Peter Rosin
2018-05-09 15:08 ` Andrzej Hajda
2018-05-09 15:53 ` Peter Rosin
2018-05-09 22:21 ` Peter Rosin
2018-05-10 7:00 ` Andrzej Hajda
2018-05-04 13:51 ` [PATCH v2 02/26] drm/bridge: adv7511: provide " Peter Rosin
2018-05-04 13:51 ` [PATCH v2 03/26] drm/bridge/analogix: core: specify the owner .odev of the bridge Peter Rosin
2018-05-04 13:51 ` [PATCH v2 04/26] drm/bridge: analogix-anx78xx: provide an owner .odev device Peter Rosin
2018-05-04 13:51 ` [PATCH v2 05/26] drm/bridge: cdns-dsi: " Peter Rosin
2018-05-04 13:51 ` [PATCH v2 06/26] drm/bridge: vga-dac: " Peter Rosin
2018-05-04 13:51 ` [PATCH v2 07/26] drm/bridge: lvds-encoder: " Peter Rosin
2018-05-04 13:51 ` [PATCH v2 08/26] drm/bridge: megachips-stdpxxxx-ge-b850v3-fw: " Peter Rosin
2018-05-04 13:51 ` [PATCH v2 09/26] drm/bridge: nxp-ptn3460: " Peter Rosin
2018-05-04 13:51 ` [PATCH v2 10/26] drm/bridge: panel: " Peter Rosin
2018-05-08 6:51 ` Jyri Sarha
2018-05-08 7:58 ` Peter Rosin
2018-05-08 10:30 ` Daniel Vetter
2018-05-08 12:25 ` Jyri Sarha
2018-05-04 13:51 ` [PATCH v2 11/26] drm/bridge: ps8622: " Peter Rosin
2018-05-04 13:51 ` [PATCH v2 12/26] drm/bridge: sii902x: " Peter Rosin
2018-05-04 13:51 ` [PATCH v2 13/26] drm/bridge: sii9234: " Peter Rosin
2018-05-04 13:52 ` [PATCH v2 14/26] drm/bridge: sii8620: " Peter Rosin
2018-05-04 13:52 ` [PATCH v2 15/26] drm/bridge: synopsys: provide an owner .odev device for the bridges Peter Rosin
2018-05-04 13:52 ` [PATCH v2 16/26] drm/bridge: tc358767: provide an owner .odev device Peter Rosin
2018-05-04 13:52 ` [PATCH v2 17/26] drm/bridge: thc63lvd1024: " Peter Rosin
2018-05-04 13:52 ` [PATCH v2 18/26] drm/bridge: ti-tfp410: " Peter Rosin
2018-05-04 13:52 ` [PATCH v2 19/26] drm/exynos: mic: provide an owner .odev device for the bridge Peter Rosin
2018-05-04 13:52 ` [PATCH v2 20/26] drm/mediatek: hdmi: " Peter Rosin
2018-05-04 13:52 ` [PATCH v2 21/26] drm/msm: specify the owner .odev of the bridges Peter Rosin
2018-05-04 13:52 ` [PATCH v2 22/26] drm/rcar-du: lvds: provide an owner .odev device for the bridge Peter Rosin
2018-05-04 13:52 ` [PATCH v2 23/26] drm/sti: provide an owner .odev device for the bridges Peter Rosin
2018-05-04 13:52 ` [PATCH v2 24/26] drm/bridge: remove the .of_node member Peter Rosin
2018-05-04 13:52 ` [PATCH v2 25/26] drm/bridge: require the owner .odev to be filled in on drm_bridge_add/attach Peter Rosin
2018-05-10 7:13 ` Andrzej Hajda
2018-05-04 13:52 ` [PATCH v2 26/26] drm/bridge: establish a link between the bridge supplier and consumer Peter Rosin
2018-05-07 12:59 ` Andrzej Hajda
2018-05-07 13:43 ` Peter Rosin
2018-05-08 9:03 ` Andrzej Hajda
2018-05-07 13:53 ` Daniel Vetter
2018-05-08 6:36 ` Andrzej Hajda
2018-05-10 8:10 ` Andrzej Hajda
2018-05-11 7:37 ` Peter Rosin
2018-05-14 16:28 ` Daniel Vetter
2018-05-14 20:40 ` Peter Rosin
2018-05-15 10:22 ` Daniel Vetter
2018-05-15 11:09 ` Peter Rosin [this message]
2018-05-16 9:31 ` Daniel Vetter
2018-05-07 13:56 ` [PATCH v2 00/26] device link, bridge supplier <-> drm device Daniel Vetter
2018-05-07 14:09 ` Peter Rosin
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=f8215ba1-4cdb-69b9-39ff-68feca3ec502@axentia.se \
--to=peda@axentia.se \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=a.hajda@samsung.com \
--cc=airlied@linux.ie \
--cc=architt@codeaurora.org \
--cc=benjamin.gaignard@linaro.org \
--cc=ck.hu@mediatek.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=gustavo@padovan.org \
--cc=heiko@sntech.de \
--cc=hjc@rock-chips.com \
--cc=inki.dae@samsung.com \
--cc=jsarha@ti.com \
--cc=jy0922.shim@samsung.com \
--cc=kgene@kernel.org \
--cc=krzk@kernel.org \
--cc=kyungmin.park@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=martin.donnelly@ge.com \
--cc=martyn.welch@collabora.co.uk \
--cc=matthias.bgg@gmail.com \
--cc=p.zabel@pengutronix.de \
--cc=peter.senna@collabora.com \
--cc=robdclark@gmail.com \
--cc=seanpaul@chromium.org \
--cc=sw0312.kim@samsung.com \
--cc=vincent.abriou@st.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;
as well as URLs for NNTP newsgroup(s).