lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 24 Nov 2021 15:10:12 -0800
From:   Prashant Malani <pmalani@...omium.org>
To:     linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org
Cc:     wonchung@...gle.com, bleung@...omium.org,
        heikki.krogerus@...ux.intel.com,
        Prashant Malani <pmalani@...omium.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
        Bjorn Helgaas <bhelgaas@...gle.com>,
        Rajat Jain <rajatja@...gle.com>,
        Rikard Falkeborn <rikard.falkeborn@...il.com>
Subject: [PATCH 3/4] usb: Link the ports to the connectors they are attached to

From: Heikki Krogerus <heikki.krogerus@...ux.intel.com>

Creating link to the USB Type-C connector for every new port
that is added when possible.

Originally submitted as commit 63cd78617350 ("usb: Link the ports to the
connectors they are attached to") but later reverted in
commit 5bdb080f9603 ("Revert "usb: Link the ports to the connectors they
are attached to"") due to a cyclic module dependency, which has since
been resolved.

Signed-off-by: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
Signed-off-by: Prashant Malani <pmalani@...omium.org>
---
 Documentation/ABI/testing/sysfs-bus-usb | 9 +++++++++
 drivers/usb/core/port.c                 | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-bus-usb b/Documentation/ABI/testing/sysfs-bus-usb
index 2ebe5708b4bc..a017cf610d9b 100644
--- a/Documentation/ABI/testing/sysfs-bus-usb
+++ b/Documentation/ABI/testing/sysfs-bus-usb
@@ -244,6 +244,15 @@ Description:
 		is permitted, "u2" if only u2 is permitted, "u1_u2" if both u1 and
 		u2 are permitted.
 
+What:		/sys/bus/usb/devices/.../(hub interface)/portX/connector
+Date:		April 2021
+Contact:	Heikki Krogerus <heikki.krogerus@...ux.intel.com>
+Description:
+		Link to the USB Type-C connector when available. This link is
+		only created when USB Type-C Connector Class is enabled, and
+		only if the system firmware is capable of describing the
+		connection between a port and its connector.
+
 What:		/sys/bus/usb/devices/.../power/usb2_lpm_l1_timeout
 Date:		May 2013
 Contact:	Mathias Nyman <mathias.nyman@...ux.intel.com>
diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
index 53a64ce76183..83f5eac6691c 100644
--- a/drivers/usb/core/port.c
+++ b/drivers/usb/core/port.c
@@ -585,6 +585,7 @@ int usb_hub_create_port_device(struct usb_hub *hub, int port1)
 	}
 
 	find_and_link_peer(hub, port1);
+	typec_link_port(&port_dev->dev);
 
 	/*
 	 * In some cases, the Type C port gets registered later, so
@@ -637,5 +638,6 @@ void usb_hub_remove_port_device(struct usb_hub *hub, int port1)
 	peer = port_dev->peer;
 	if (peer)
 		unlink_peers(port_dev, peer);
+	typec_unlink_port(&port_dev->dev);
 	device_unregister(&port_dev->dev);
 }
-- 
2.34.0.rc2.393.gf8c9666880-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ