Re: [bug report] thunderbolt: Add initial support for USB4

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 07, 2020 at 08:24:24AM +0300, Dan Carpenter wrote:
> [ Should linux-usb be listed in MAINTAINERS? - dan]

Yes, I think so. I'll make a patch for that.

> Hello Mika Westerberg,
> 
> The patch b04079837b20: "thunderbolt: Add initial support for USB4"
> from Dec 17, 2019, leads to the following static checker warning:
> 
> 	drivers/thunderbolt/usb4.c:242 usb4_switch_setup()
> 	warn: bool mask it always valse 'xhci & ((((1))) << (18))'
> 
> drivers/thunderbolt/usb4.c
>    206          bool tbt3, xhci;
>                 ^^^^       ^^^^
> 
>    207          u32 val = 0;
>    208          int ret;
>    209  
>    210          if (!tb_route(sw))
>    211                  return 0;
>    212  
>    213          ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, ROUTER_CS_6, 1);
>    214          if (ret)
>    215                  return ret;
>    216  
>    217          xhci = val & ROUTER_CS_6_HCI;
>    218          tbt3 = !(val & ROUTER_CS_6_TNS);
>    219  
>    220          tb_sw_dbg(sw, "TBT3 support: %s, xHCI: %s\n",
>    221                    tbt3 ? "yes" : "no", xhci ? "yes" : "no");
>    222  
>    223          ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, ROUTER_CS_5, 1);
>    224          if (ret)
>    225                  return ret;
>    226  
>    227          parent = tb_switch_parent(sw);
>    228  
>    229          if (tb_switch_find_port(parent, TB_TYPE_USB3_DOWN)) {
>    230                  val |= ROUTER_CS_5_UTO;
>    231                  xhci = false;
>    232          }
>    233  
>    234          /* Only enable PCIe tunneling if the parent router supports it */
>    235          if (tb_switch_find_port(parent, TB_TYPE_PCIE_DOWN)) {
>    236                  val |= ROUTER_CS_5_PTO;
>    237                  /*
>    238                   * xHCI can be enabled if PCIe tunneling is supported
>    239                   * and the parent does not have any USB3 dowstream
>    240                   * adapters (so we cannot do USB 3.x tunneling).
>    241                   */
>    242                  if (xhci & ROUTER_CS_6_HCI)
>                             ^^^^^^^^^^^^^^^^^^^^^^
> "xhci" is bool so BIT(18) is not set.

Good finding. It should be

	if (xhci)
		val |= ROUTER_CS_5_HCO;

I think. I'll make patch fixing it as well.



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux