linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] thunderbolt: Use the actual buffer in tb_async_error()
@ 2022-08-16 10:40 Mika Westerberg
  2022-08-16 10:40 ` [PATCH 2/2] thunderbolt: Check router generation before connecting xHCI Mika Westerberg
  2022-08-18  8:57 ` [PATCH 1/2] thunderbolt: Use the actual buffer in tb_async_error() Mika Westerberg
  0 siblings, 2 replies; 3+ messages in thread
From: Mika Westerberg @ 2022-08-16 10:40 UTC (permalink / raw)
  To: linux-usb
  Cc: Yehezkel Bernat, Michael Jamet, Lukas Wunner, Andreas Noever,
	Mika Westerberg

The received notification packet is held in pkg->buffer and not in pkg
itself. Fix this by using the correct buffer.

Fixes: 81a54b5e1986 ("thunderbolt: Let the connection manager handle all notifications")
Cc: stable@vger.kernel.org
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
 drivers/thunderbolt/ctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thunderbolt/ctl.c b/drivers/thunderbolt/ctl.c
index e5ede5debfb0..0c661a706160 100644
--- a/drivers/thunderbolt/ctl.c
+++ b/drivers/thunderbolt/ctl.c
@@ -407,7 +407,7 @@ static void tb_ctl_rx_submit(struct ctl_pkg *pkg)
 
 static int tb_async_error(const struct ctl_pkg *pkg)
 {
-	const struct cfg_error_pkg *error = (const struct cfg_error_pkg *)pkg;
+	const struct cfg_error_pkg *error = pkg->buffer;
 
 	if (pkg->frame.eof != TB_CFG_PKG_ERROR)
 		return false;
-- 
2.35.1


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

* [PATCH 2/2] thunderbolt: Check router generation before connecting xHCI
  2022-08-16 10:40 [PATCH 1/2] thunderbolt: Use the actual buffer in tb_async_error() Mika Westerberg
@ 2022-08-16 10:40 ` Mika Westerberg
  2022-08-18  8:57 ` [PATCH 1/2] thunderbolt: Use the actual buffer in tb_async_error() Mika Westerberg
  1 sibling, 0 replies; 3+ messages in thread
From: Mika Westerberg @ 2022-08-16 10:40 UTC (permalink / raw)
  To: linux-usb
  Cc: Yehezkel Bernat, Michael Jamet, Lukas Wunner, Andreas Noever,
	Mika Westerberg

Only Thunderbolt 3 routers need the xHCI connection flow. This also
ensures the router actually has both lane adapters (1 and 3). While
there move declaration of the boolean variables inside the block where
they are being used.

Fixes: 30a4eca69b76 ("thunderbolt: Add internal xHCI connect flows for Thunderbolt 3 devices")
Cc: stable@vger.kernel.org
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
 drivers/thunderbolt/switch.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c
index 244f8cd38b25..c63c1f4ff9dc 100644
--- a/drivers/thunderbolt/switch.c
+++ b/drivers/thunderbolt/switch.c
@@ -3786,14 +3786,18 @@ int tb_switch_pcie_l1_enable(struct tb_switch *sw)
  */
 int tb_switch_xhci_connect(struct tb_switch *sw)
 {
-	bool usb_port1, usb_port3, xhci_port1, xhci_port3;
 	struct tb_port *port1, *port3;
 	int ret;
 
+	if (sw->generation != 3)
+		return 0;
+
 	port1 = &sw->ports[1];
 	port3 = &sw->ports[3];
 
 	if (tb_switch_is_alpine_ridge(sw)) {
+		bool usb_port1, usb_port3, xhci_port1, xhci_port3;
+
 		usb_port1 = tb_lc_is_usb_plugged(port1);
 		usb_port3 = tb_lc_is_usb_plugged(port3);
 		xhci_port1 = tb_lc_is_xhci_connected(port1);
-- 
2.35.1


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

* Re: [PATCH 1/2] thunderbolt: Use the actual buffer in tb_async_error()
  2022-08-16 10:40 [PATCH 1/2] thunderbolt: Use the actual buffer in tb_async_error() Mika Westerberg
  2022-08-16 10:40 ` [PATCH 2/2] thunderbolt: Check router generation before connecting xHCI Mika Westerberg
@ 2022-08-18  8:57 ` Mika Westerberg
  1 sibling, 0 replies; 3+ messages in thread
From: Mika Westerberg @ 2022-08-18  8:57 UTC (permalink / raw)
  To: linux-usb; +Cc: Yehezkel Bernat, Michael Jamet, Lukas Wunner, Andreas Noever

On Tue, Aug 16, 2022 at 01:40:58PM +0300, Mika Westerberg wrote:
> The received notification packet is held in pkg->buffer and not in pkg
> itself. Fix this by using the correct buffer.
> 
> Fixes: 81a54b5e1986 ("thunderbolt: Let the connection manager handle all notifications")
> Cc: stable@vger.kernel.org
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>

Both applied to thunderbolt.git/fixes.

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

end of thread, other threads:[~2022-08-18  8:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-16 10:40 [PATCH 1/2] thunderbolt: Use the actual buffer in tb_async_error() Mika Westerberg
2022-08-16 10:40 ` [PATCH 2/2] thunderbolt: Check router generation before connecting xHCI Mika Westerberg
2022-08-18  8:57 ` [PATCH 1/2] thunderbolt: Use the actual buffer in tb_async_error() 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).