linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: mika.westerberg@linux.intel.com
Cc: linux-usb@vger.kernel.org
Subject: [bug report] thunderbolt: Add initial support for USB4
Date: Tue, 7 Jan 2020 08:24:24 +0300	[thread overview]
Message-ID: <20200107052424.pidwn5f7wyayany2@kili.mountain> (raw)

[ 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

             reply	other threads:[~2020-01-07  5:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-07  5:24 Dan Carpenter [this message]
2020-01-07 10:25 ` [bug report] thunderbolt: Add initial support for USB4 Mika Westerberg

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=20200107052424.pidwn5f7wyayany2@kili.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=linux-usb@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).