[PATCH v2 11/22] thunderbolt: Find Apple VSE capability during startup
Sven Peter
sven at kernel.org
Tue Sep 8 13:24:27 PDT 2026
On 9/7/26 15:38, Joshua Peisach wrote:
> On Sun Sep 6, 2026 at 2:36 PM EDT, Sven Peter wrote:
>> Only Apple Silicon host routers have the Apple vendor-specific extended
>> capability. Look it up when the software connection manager starts and
>> store its offset in the root switch.
>>
>> The Apple NHI driver can then use the stored offset when programming
>> cable information without searching the router capabilities itself.
>>
>> Signed-off-by: Sven Peter <sven at kernel.org>
>> ---
>> drivers/thunderbolt/tb.c | 4 ++++
>> drivers/thunderbolt/tb.h | 2 ++
>> drivers/thunderbolt/tb_regs.h | 1 +
>> 3 files changed, 7 insertions(+)
>>
>> diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
>> index bf1c192ec10a..d2832323cc36 100644
>> --- a/drivers/thunderbolt/tb.c
>> +++ b/drivers/thunderbolt/tb.c
>> @@ -3025,6 +3025,10 @@ static int tb_start(struct tb *tb, bool reset)
>> return dev_err_probe(tb->nhi->dev, PTR_ERR(tb->root_switch),
>> "failed to allocate host router\n");
>>
>> + ret = tb_switch_find_vse_cap(tb->root_switch, TB_VSE_CAP_APPLE);
>> + if (ret > 0)
>> + tb->root_switch->cap_vsec_apple = ret;
>> +
>
> Nitpick: I *think* based on the surrounding code that this can be
> simplified to "if (ret)"
>
No, ret < 0 is an error and if something goes wrong cap_vsec_apple must
remain zero and not whatever errno tb_switch_find_vse_cap returned.
Sven
More information about the linux-arm-kernel
mailing list