From: Sanjay R Mehta <sanmehta@amd.com>
To: Mika Westerberg <mika.westerberg@linux.intel.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 13:39:44 +0530 [thread overview]
Message-ID: <5ba4e184-d9cb-a120-8044-e200b6e47812@amd.com> (raw)
In-Reply-To: <YutwWI8xENDkAtg9@lahna>
On 8/4/2022 12:38 PM, Mika Westerberg wrote:
> On Thu, Aug 04, 2022 at 12:34:09PM +0530, Sanjay R Mehta wrote:
>>>> 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.
>>
>> Thanks. Agree, I will add check here and resend the patch.
>
> Please don't add the check here but move this to tb_start() as I
> suggested.
Sure Mika.
As you earlier suggested to move this function to either "tb_start() or
tb_discover_tunnels()".
Since adding of this DP OUT resource is required for each DP tunnel,
hence I felt it will be better if I move this function in
tb_discover_tunnels() where we can avoid extra for loop for tunnel.
Below is the place how I am thinking of adding
"tb_discover_dp_resources()" function.
static void tb_discover_tunnels(struct tb *tb)
{
struct tb_cm *tcm = tb_priv(tb);
struct tb_tunnel *tunnel;
tb_switch_discover_tunnels(tb->root_switch, &tcm->tunnel_list,
true);
list_for_each_entry(tunnel, &tcm->tunnel_list, list) {
if (tb_tunnel_is_pci(tunnel)) {
struct tb_switch *parent = tunnel->dst_port->sw;
while (parent != tunnel->src_port->sw) {
parent->boot = true;
parent = tb_switch_parent(parent);
}
} else if (tb_tunnel_is_dp(tunnel)) {
/* Keep the domain from powering down */
tb_discover_dp_resources(tb, tunnel->dst_port);
pm_runtime_get_sync(&tunnel->src_port->sw->dev);
pm_runtime_get_sync(&tunnel->dst_port->sw->dev);
}
}
}
Does this make sense? Please suggest me if I have to do it other way.
Appreciate your help.
next prev parent reply other threads:[~2022-08-04 8:09 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
2022-08-04 7:04 ` Sanjay R Mehta
2022-08-04 7:08 ` Mika Westerberg
2022-08-04 8:09 ` Sanjay R Mehta [this message]
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=5ba4e184-d9cb-a120-8044-e200b6e47812@amd.com \
--to=sanmehta@amd.com \
--cc=Basavaraj.Natikar@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 \
--cc=mika.westerberg@linux.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