All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/bridge: ti-sn65dsi83: Implement .detach callback
@ 2021-09-07  2:40 Marek Vasut
  2021-10-06  9:47 ` Robert Foss
  0 siblings, 1 reply; 4+ messages in thread
From: Marek Vasut @ 2021-09-07  2:40 UTC (permalink / raw)
  To: dri-devel
  Cc: Marek Vasut, Jagan Teki, Laurent Pinchart, Linus Walleij,
	Robert Foss, Sam Ravnborg

Move detach implementation from sn65dsi83_remove() to dedicated
.detach callback. There is no functional change to the code, but
that detach is now in the correct location.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Robert Foss <robert.foss@linaro.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: dri-devel@lists.freedesktop.org
---
 drivers/gpu/drm/bridge/ti-sn65dsi83.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
index 4ea71d7f0bfbc..13ee313daba96 100644
--- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c
+++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
@@ -288,6 +288,19 @@ static int sn65dsi83_attach(struct drm_bridge *bridge,
 	return ret;
 }
 
+static void sn65dsi83_detach(struct drm_bridge *bridge)
+{
+	struct sn65dsi83 *ctx = bridge_to_sn65dsi83(bridge);
+
+	if (!ctx->dsi)
+		return;
+
+	mipi_dsi_detach(ctx->dsi);
+	mipi_dsi_device_unregister(ctx->dsi);
+	drm_bridge_remove(&ctx->bridge);
+	ctx->dsi = NULL;
+}
+
 static void sn65dsi83_atomic_pre_enable(struct drm_bridge *bridge,
 					struct drm_bridge_state *old_bridge_state)
 {
@@ -588,6 +601,7 @@ sn65dsi83_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
 
 static const struct drm_bridge_funcs sn65dsi83_funcs = {
 	.attach			= sn65dsi83_attach,
+	.detach			= sn65dsi83_detach,
 	.atomic_pre_enable	= sn65dsi83_atomic_pre_enable,
 	.atomic_enable		= sn65dsi83_atomic_enable,
 	.atomic_disable		= sn65dsi83_atomic_disable,
@@ -702,9 +716,6 @@ static int sn65dsi83_remove(struct i2c_client *client)
 {
 	struct sn65dsi83 *ctx = i2c_get_clientdata(client);
 
-	mipi_dsi_detach(ctx->dsi);
-	mipi_dsi_device_unregister(ctx->dsi);
-	drm_bridge_remove(&ctx->bridge);
 	of_node_put(ctx->host_node);
 
 	return 0;
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/bridge: ti-sn65dsi83: Implement .detach callback
  2021-09-07  2:40 [PATCH] drm/bridge: ti-sn65dsi83: Implement .detach callback Marek Vasut
@ 2021-10-06  9:47 ` Robert Foss
  2021-10-07 19:51   ` Marek Vasut
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Foss @ 2021-10-06  9:47 UTC (permalink / raw)
  To: Marek Vasut
  Cc: dri-devel, Jagan Teki, Laurent Pinchart, Linus Walleij, Sam Ravnborg

>
On Tue, 7 Sept 2021 at 04:40, Marek Vasut <marex@denx.de> wrote:
>
> Move detach implementation from sn65dsi83_remove() to dedicated
 .detach callback. There is no functional change to the code, but
> that detach is now in the correct location.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Jagan Teki <jagan@amarulasolutions.com>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Robert Foss <robert.foss@linaro.org>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Cc: dri-devel@lists.freedesktop.org
> ---
>  drivers/gpu/drm/bridge/ti-sn65dsi83.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> index 4ea71d7f0bfbc..13ee313daba96 100644
> --- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> +++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> @@ -288,6 +288,19 @@ static int sn65dsi83_attach(struct drm_bridge *bridge,
>         return ret;
>  }
>
> +static void sn65dsi83_detach(struct drm_bridge *bridge)
> +{
> +       struct sn65dsi83 *ctx = bridge_to_sn65dsi83(bridge);
> +
> +       if (!ctx->dsi)
> +               return;
> +
> +       mipi_dsi_detach(ctx->dsi);
> +       mipi_dsi_device_unregister(ctx->dsi);
> +       drm_bridge_remove(&ctx->bridge);
> +       ctx->dsi = NULL;

Is this assignment necessary? I'm not seeing it in the other drivers.

WIth this cleared up feel free to add my r-b.
Reviewed-by: Robert Foss <robert.foss@linaro.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/bridge: ti-sn65dsi83: Implement .detach callback
  2021-10-06  9:47 ` Robert Foss
@ 2021-10-07 19:51   ` Marek Vasut
  2021-10-08  9:02     ` Robert Foss
  0 siblings, 1 reply; 4+ messages in thread
From: Marek Vasut @ 2021-10-07 19:51 UTC (permalink / raw)
  To: Robert Foss
  Cc: dri-devel, Jagan Teki, Laurent Pinchart, Linus Walleij, Sam Ravnborg

On 10/6/21 11:47 AM, Robert Foss wrote:
>>
> On Tue, 7 Sept 2021 at 04:40, Marek Vasut <marex@denx.de> wrote:
>>
>> Move detach implementation from sn65dsi83_remove() to dedicated
>   .detach callback. There is no functional change to the code, but
>> that detach is now in the correct location.
>>
>> Signed-off-by: Marek Vasut <marex@denx.de>
>> Cc: Jagan Teki <jagan@amarulasolutions.com>
>> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>> Cc: Linus Walleij <linus.walleij@linaro.org>
>> Cc: Robert Foss <robert.foss@linaro.org>
>> Cc: Sam Ravnborg <sam@ravnborg.org>
>> Cc: dri-devel@lists.freedesktop.org
>> ---
>>   drivers/gpu/drm/bridge/ti-sn65dsi83.c | 17 ++++++++++++++---
>>   1 file changed, 14 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
>> index 4ea71d7f0bfbc..13ee313daba96 100644
>> --- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c
>> +++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
>> @@ -288,6 +288,19 @@ static int sn65dsi83_attach(struct drm_bridge *bridge,
>>          return ret;
>>   }
>>
>> +static void sn65dsi83_detach(struct drm_bridge *bridge)
>> +{
>> +       struct sn65dsi83 *ctx = bridge_to_sn65dsi83(bridge);
>> +
>> +       if (!ctx->dsi)
>> +               return;
>> +
>> +       mipi_dsi_detach(ctx->dsi);
>> +       mipi_dsi_device_unregister(ctx->dsi);
>> +       drm_bridge_remove(&ctx->bridge);
>> +       ctx->dsi = NULL;
> 
> Is this assignment necessary? I'm not seeing it in the other drivers.
> 
> WIth this cleared up feel free to add my r-b.
> Reviewed-by: Robert Foss <robert.foss@linaro.org>

It works in tandem with the if (!ctx->dsi) return; at the beginning to 
prevent crash in case the detach callback was called multiple times for 
whatever reason.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/bridge: ti-sn65dsi83: Implement .detach callback
  2021-10-07 19:51   ` Marek Vasut
@ 2021-10-08  9:02     ` Robert Foss
  0 siblings, 0 replies; 4+ messages in thread
From: Robert Foss @ 2021-10-08  9:02 UTC (permalink / raw)
  To: Marek Vasut
  Cc: dri-devel, Jagan Teki, Laurent Pinchart, Linus Walleij, Sam Ravnborg

Applied to drm-misc-next

On Thu, 7 Oct 2021 at 21:51, Marek Vasut <marex@denx.de> wrote:
>
> On 10/6/21 11:47 AM, Robert Foss wrote:
> >>
> > On Tue, 7 Sept 2021 at 04:40, Marek Vasut <marex@denx.de> wrote:
> >>
> >> Move detach implementation from sn65dsi83_remove() to dedicated
> >   .detach callback. There is no functional change to the code, but
> >> that detach is now in the correct location.
> >>
> >> Signed-off-by: Marek Vasut <marex@denx.de>
> >> Cc: Jagan Teki <jagan@amarulasolutions.com>
> >> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> >> Cc: Linus Walleij <linus.walleij@linaro.org>
> >> Cc: Robert Foss <robert.foss@linaro.org>
> >> Cc: Sam Ravnborg <sam@ravnborg.org>
> >> Cc: dri-devel@lists.freedesktop.org
> >> ---
> >>   drivers/gpu/drm/bridge/ti-sn65dsi83.c | 17 ++++++++++++++---
> >>   1 file changed, 14 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> >> index 4ea71d7f0bfbc..13ee313daba96 100644
> >> --- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> >> +++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> >> @@ -288,6 +288,19 @@ static int sn65dsi83_attach(struct drm_bridge *bridge,
> >>          return ret;
> >>   }
> >>
> >> +static void sn65dsi83_detach(struct drm_bridge *bridge)
> >> +{
> >> +       struct sn65dsi83 *ctx = bridge_to_sn65dsi83(bridge);
> >> +
> >> +       if (!ctx->dsi)
> >> +               return;
> >> +
> >> +       mipi_dsi_detach(ctx->dsi);
> >> +       mipi_dsi_device_unregister(ctx->dsi);
> >> +       drm_bridge_remove(&ctx->bridge);
> >> +       ctx->dsi = NULL;
> >
> > Is this assignment necessary? I'm not seeing it in the other drivers.
> >
> > WIth this cleared up feel free to add my r-b.
> > Reviewed-by: Robert Foss <robert.foss@linaro.org>
>
> It works in tandem with the if (!ctx->dsi) return; at the beginning to
> prevent crash in case the detach callback was called multiple times for
> whatever reason.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-10-08  9:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-07  2:40 [PATCH] drm/bridge: ti-sn65dsi83: Implement .detach callback Marek Vasut
2021-10-06  9:47 ` Robert Foss
2021-10-07 19:51   ` Marek Vasut
2021-10-08  9:02     ` Robert Foss

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.