2023-11-16 10:29:58

by Sui Jingfeng

[permalink] [raw]
Subject: Re: [PATCH 8/8] drm/bridge: it66121: Allow link this driver as a lib

Hi,


On 2023/11/15 00:30, Dmitry Baryshkov wrote:
>> @@ -703,14 +704,32 @@ static int it66121_bridge_attach(struct drm_bridge *bridge,
>> enum drm_bridge_attach_flags flags)
>> {
>> struct it66121_ctx *ctx = bridge_to_it66121(bridge);
>> + struct drm_bridge *next_bridge = ctx->next_bridge;
>> + struct drm_encoder *encoder = bridge->encoder;
>> int ret;
>>
>> - if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR))
>> - return -EINVAL;
>> + if (next_bridge) {
>> + if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)) {
>> + WARN_ON(1);
> Why? At least use WARN() instead

If (next_bridge) is true, it says that the driver *already* known that
it66121 have a next bridges attached. Then it66121 driver should certainly
attach it, no matter what it is. Either a connector or another display bridge.
It also says that this is a DT-based system on such a case. CallingWARN_ON(1) here helps to see(print) which DC driver is doing the wired
things. Ok, I will remove the WARN_ON(1) on the next version.


2023-11-16 11:11:47

by Dmitry Baryshkov

[permalink] [raw]
Subject: Re: [PATCH 8/8] drm/bridge: it66121: Allow link this driver as a lib

On Thu, 16 Nov 2023 at 12:29, Sui Jingfeng <[email protected]> wrote:
>
> Hi,
>
>
> On 2023/11/15 00:30, Dmitry Baryshkov wrote:
> >> @@ -703,14 +704,32 @@ static int it66121_bridge_attach(struct drm_bridge *bridge,
> >> enum drm_bridge_attach_flags flags)
> >> {
> >> struct it66121_ctx *ctx = bridge_to_it66121(bridge);
> >> + struct drm_bridge *next_bridge = ctx->next_bridge;
> >> + struct drm_encoder *encoder = bridge->encoder;
> >> int ret;
> >>
> >> - if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR))
> >> - return -EINVAL;
> >> + if (next_bridge) {
> >> + if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)) {
> >> + WARN_ON(1);
> > Why? At least use WARN() instead
>
> If (next_bridge) is true, it says that the driver *already* known that
> it66121 have a next bridges attached. Then it66121 driver should certainly
> attach it, no matter what it is. Either a connector or another display bridge.
> It also says that this is a DT-based system on such a case. CallingWARN_ON(1) here helps to see(print) which DC driver is doing the wired
> things. Ok, I will remove the WARN_ON(1) on the next version.

That's why I pointed you to WARN(). WARN_ON(1) gives no information to
the user. WARN() allows you to add a message.

--
With best wishes
Dmitry

2023-11-16 11:16:49

by Jani Nikula

[permalink] [raw]
Subject: Re: [PATCH 8/8] drm/bridge: it66121: Allow link this driver as a lib

On Thu, 16 Nov 2023, Dmitry Baryshkov <[email protected]> wrote:
> On Thu, 16 Nov 2023 at 12:29, Sui Jingfeng <[email protected]> wrote:
>>
>> Hi,
>>
>>
>> On 2023/11/15 00:30, Dmitry Baryshkov wrote:
>> >> @@ -703,14 +704,32 @@ static int it66121_bridge_attach(struct drm_bridge *bridge,
>> >> enum drm_bridge_attach_flags flags)
>> >> {
>> >> struct it66121_ctx *ctx = bridge_to_it66121(bridge);
>> >> + struct drm_bridge *next_bridge = ctx->next_bridge;
>> >> + struct drm_encoder *encoder = bridge->encoder;
>> >> int ret;
>> >>
>> >> - if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR))
>> >> - return -EINVAL;
>> >> + if (next_bridge) {
>> >> + if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)) {
>> >> + WARN_ON(1);
>> > Why? At least use WARN() instead
>>
>> If (next_bridge) is true, it says that the driver *already* known that
>> it66121 have a next bridges attached. Then it66121 driver should certainly
>> attach it, no matter what it is. Either a connector or another display bridge.
>> It also says that this is a DT-based system on such a case. CallingWARN_ON(1) here helps to see(print) which DC driver is doing the wired
>> things. Ok, I will remove the WARN_ON(1) on the next version.
>
> That's why I pointed you to WARN(). WARN_ON(1) gives no information to
> the user. WARN() allows you to add a message.

Please use drm_WARN* while at it.

BR,
Jani.


--
Jani Nikula, Intel