linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] thunderbolt: Add initial support for USB4
@ 2020-01-07  5:24 Dan Carpenter
  2020-01-07 10:25 ` Mika Westerberg
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-01-07  5:24 UTC (permalink / raw)
  To: mika.westerberg; +Cc: linux-usb

[ Should linux-usb be listed in MAINTAINERS? - dan]

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.

   243                          val |= ROUTER_CS_5_HCO;
   244          }
   245  
   246          /* TBT3 supported by the CM */
   247          val |= ROUTER_CS_5_C3S;


regards,
dan carpenter

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

end of thread, other threads:[~2020-01-07 10:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-07  5:24 [bug report] thunderbolt: Add initial support for USB4 Dan Carpenter
2020-01-07 10:25 ` Mika Westerberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).