Linux USB
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Sanjay R Mehta <Sanju.Mehta@amd.com>
Cc: andreas.noever@gmail.com, michael.jamet@intel.com,
	YehezkelShB@gmail.com, Basavaraj.Natikar@amd.com,
	mario.limonciello@amd.com, linux-usb@vger.kernel.org
Subject: Re: [PATCH v3] thunderbolt: Add DP out resource when DP tunnel is discovered.
Date: Thu, 4 Aug 2022 09:30:38 +0300	[thread overview]
Message-ID: <Yutnjq64OO07QbAR@lahna> (raw)
In-Reply-To: <1659587394-115256-1-git-send-email-Sanju.Mehta@amd.com>

On Wed, Aug 03, 2022 at 11:29:54PM -0500, Sanjay R Mehta wrote:
> From: Sanjay R Mehta <sanju.mehta@amd.com>
> 
> If the boot firmware implements a connection manager of its
> own it may create a DP tunnel and will be handed off to Linux
> CM, but the DP out resource is not saved in the dp_resource
> list.
> 
> This patch adds tunnelled DP out port to the dp_resource list
> once the DP tunnel is discovered.
> 
> Signed-off-by: Sanjay R Mehta <sanju.mehta@amd.com>
> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
> 
> ---
> v3: make tb_dp_resource_available_discovered as static function.

Hmm, I suggested this:

  Please call this tb_discover_dp_resources() make it static and call it
  right after tb_discover_tunnels() in tb_start() or in
  tb_discover_tunnels().      

Anything preventing you to do that? Or you missed my comment?

> v2: Re-ordering the function declaration as per Greg's comment.
> ---
>  drivers/thunderbolt/tb.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
> index 9a3214f..53abce3 100644
> --- a/drivers/thunderbolt/tb.c
> +++ b/drivers/thunderbolt/tb.c
> @@ -105,6 +105,21 @@ static void tb_remove_dp_resources(struct tb_switch *sw)
>  	}
>  }
>  
> +static void tb_dp_resource_available_discovered(struct tb *tb, struct tb_port *port)
> +{
> +	struct tb_cm *tcm = tb_priv(tb);
> +	struct tb_port *p;
> +
> +	list_for_each_entry(p, &tcm->dp_resources, list) {
> +		if (p == port)
> +			return;
> +	}
> +
> +	tb_port_dbg(port, "DP %s resource available discovered\n",
> +		    tb_port_is_dpin(port) ? "IN" : "OUT");
> +	list_add_tail(&port->list, &tcm->dp_resources);
> +}
> +
>  static void tb_switch_discover_tunnels(struct tb_switch *sw,
>  				       struct list_head *list,
>  				       bool alloc_hopids)
> @@ -118,6 +133,7 @@ static void tb_switch_discover_tunnels(struct tb_switch *sw,
>  		switch (port->config.type) {
>  		case TB_TYPE_DP_HDMI_IN:
>  			tunnel = tb_tunnel_discover_dp(tb, port, alloc_hopids);

Here tunnel can be NULL...

> +			tb_dp_resource_available_discovered(tb, tunnel->dst_port);

... so this will crash and burn.

  reply	other threads:[~2022-08-04  6:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-04  4:29 [PATCH v3] thunderbolt: Add DP out resource when DP tunnel is discovered Sanjay R Mehta
2022-08-04  6:30 ` Mika Westerberg [this message]
2022-08-04  7:04   ` Sanjay R Mehta
2022-08-04  7:08     ` Mika Westerberg
2022-08-04  8:09       ` Sanjay R Mehta
2022-08-04  8:31         ` Mika Westerberg
2022-08-04  8:57           ` Sanjay R Mehta
2022-08-04  9:15             ` Mika Westerberg
2022-08-04  9:25               ` Sanjay R Mehta

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=Yutnjq64OO07QbAR@lahna \
    --to=mika.westerberg@linux.intel.com \
    --cc=Basavaraj.Natikar@amd.com \
    --cc=Sanju.Mehta@amd.com \
    --cc=YehezkelShB@gmail.com \
    --cc=andreas.noever@gmail.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=michael.jamet@intel.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