Commit 24dab538 authored by Heikki Krogerus's avatar Heikki Krogerus Committed by Greg Kroah-Hartman

usb: typec: hd3ss3220: Give the connector fwnode to the port device

The driver already finds the node in order to get reference
to the USB role switch.
Signed-off-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
Tested-by: default avatarBiju Das <biju.das@bp.renesas.com>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20191104142435.29960-11-heikki.krogerus@linux.intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 61d78ee2
...@@ -178,15 +178,17 @@ static int hd3ss3220_probe(struct i2c_client *client, ...@@ -178,15 +178,17 @@ static int hd3ss3220_probe(struct i2c_client *client,
return -ENODEV; return -ENODEV;
hd3ss3220->role_sw = fwnode_usb_role_switch_get(connector); hd3ss3220->role_sw = fwnode_usb_role_switch_get(connector);
fwnode_handle_put(connector); if (IS_ERR(hd3ss3220->role_sw)) {
if (IS_ERR(hd3ss3220->role_sw)) ret = PTR_ERR(hd3ss3220->role_sw);
return PTR_ERR(hd3ss3220->role_sw); goto err_put_fwnode;
}
typec_cap.prefer_role = TYPEC_NO_PREFERRED_ROLE; typec_cap.prefer_role = TYPEC_NO_PREFERRED_ROLE;
typec_cap.driver_data = hd3ss3220; typec_cap.driver_data = hd3ss3220;
typec_cap.type = TYPEC_PORT_DRP; typec_cap.type = TYPEC_PORT_DRP;
typec_cap.data = TYPEC_PORT_DRD; typec_cap.data = TYPEC_PORT_DRD;
typec_cap.ops = &hd3ss3220_ops; typec_cap.ops = &hd3ss3220_ops;
typec_cap.fwnode = connector;
hd3ss3220->port = typec_register_port(&client->dev, &typec_cap); hd3ss3220->port = typec_register_port(&client->dev, &typec_cap);
if (IS_ERR(hd3ss3220->port)) { if (IS_ERR(hd3ss3220->port)) {
...@@ -220,6 +222,8 @@ static int hd3ss3220_probe(struct i2c_client *client, ...@@ -220,6 +222,8 @@ static int hd3ss3220_probe(struct i2c_client *client,
if (ret < 0) if (ret < 0)
goto err_unreg_port; goto err_unreg_port;
fwnode_handle_put(connector);
dev_info(&client->dev, "probed revision=0x%x\n", ret); dev_info(&client->dev, "probed revision=0x%x\n", ret);
return 0; return 0;
...@@ -227,6 +231,8 @@ static int hd3ss3220_probe(struct i2c_client *client, ...@@ -227,6 +231,8 @@ static int hd3ss3220_probe(struct i2c_client *client,
typec_unregister_port(hd3ss3220->port); typec_unregister_port(hd3ss3220->port);
err_put_role: err_put_role:
usb_role_switch_put(hd3ss3220->role_sw); usb_role_switch_put(hd3ss3220->role_sw);
err_put_fwnode:
fwnode_handle_put(connector);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment