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]
Message-Id: <20241114-usb-typec-controller-enhancements-v2-2-362376856aea@zuehlke.com>
Date: Thu, 14 Nov 2024 09:02:07 +0100
From: Oliver Facklam <oliver.facklam@...hlke.com>
To: Heikki Krogerus <heikki.krogerus@...ux.intel.com>, 
 Biju Das <biju.das@...renesas.com>, 
 Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org, 
 Benedict von Heyl <benedict.vonheyl@...hlke.com>, 
 Mathis Foerst <mathis.foerst@...hlke.com>, 
 Michael Glettig <michael.glettig@...hlke.com>, 
 Oliver Facklam <oliver.facklam@...hlke.com>
Subject: [PATCH v2 2/4] usb: typec: hd3ss3220: use typec_get_fw_cap() to
 fill typec_cap

The type, data, and prefer_role properties were previously hard-coded
when creating the struct typec_capability.

Use typec_get_fw_cap() to populate these fields based on the
respective fwnode properties, if present.

Signed-off-by: Oliver Facklam <oliver.facklam@...hlke.com>
---
 drivers/usb/typec/hd3ss3220.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/typec/hd3ss3220.c b/drivers/usb/typec/hd3ss3220.c
index 56f74bf70895ca701083bde44a5bbe0b691551e1..e581272bb47de95dee8363a5491f543354fcbbf8 100644
--- a/drivers/usb/typec/hd3ss3220.c
+++ b/drivers/usb/typec/hd3ss3220.c
@@ -264,7 +264,14 @@ static int hd3ss3220_probe(struct i2c_client *client)
 	typec_cap.type = TYPEC_PORT_DRP;
 	typec_cap.data = TYPEC_PORT_DRD;
 	typec_cap.ops = &hd3ss3220_ops;
-	typec_cap.fwnode = connector;
+
+	/*
+	 * Try to get properties from connector,
+	 * but continue with defaults anyway if they are not found
+	 */
+	ret = typec_get_fw_cap(&typec_cap, connector);
+	if (ret != 0 && ret != -EINVAL && ret != -ENXIO)
+		goto err_put_role;
 
 	hd3ss3220->port = typec_register_port(&client->dev, &typec_cap);
 	if (IS_ERR(hd3ss3220->port)) {

-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ