diff mbox series

[v2,2/2] platform/chrome: cros_ec_typec: Set parent of partner PD object

Message ID 20221122220538.2991775-3-pmalani@chromium.org (mailing list archive)
State Accepted
Commit ab3593eeef606816bcc28b12690c51379c3d12eb
Headers show
Series platform/chrome: cros_ec_typec: Link PD object to partner | expand

Commit Message

Prashant Malani Nov. 22, 2022, 10:05 p.m. UTC
In order to tell what Type-C device a PD object belongs to, its parent
needs to be set. Use the Type-C partner USB PD registration wrapper
to set the parent appropriately for PD objects which are created for
connected Type-C partners.

Cc: Benson Leung <bleung@chromium.org>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Prashant Malani <pmalani@chromium.org>
---

Changes since v1:
- Use wrapper function introduced in Patch1 (v2).
- Update commit message to reflect that we are using the wrapper.

 drivers/platform/chrome/cros_ec_typec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Heikki Krogerus Nov. 23, 2022, 8:54 a.m. UTC | #1
On Tue, Nov 22, 2022 at 10:05:37PM +0000, Prashant Malani wrote:
> In order to tell what Type-C device a PD object belongs to, its parent
> needs to be set. Use the Type-C partner USB PD registration wrapper
> to set the parent appropriately for PD objects which are created for
> connected Type-C partners.
> 
> Cc: Benson Leung <bleung@chromium.org>
> Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Signed-off-by: Prashant Malani <pmalani@chromium.org>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
> 
> Changes since v1:
> - Use wrapper function introduced in Patch1 (v2).
> - Update commit message to reflect that we are using the wrapper.
> 
>  drivers/platform/chrome/cros_ec_typec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
> index 2a7ff14dc37e..d5bc4021aca2 100644
> --- a/drivers/platform/chrome/cros_ec_typec.c
> +++ b/drivers/platform/chrome/cros_ec_typec.c
> @@ -968,7 +968,7 @@ static void cros_typec_register_partner_pdos(struct cros_typec_data *typec,
>  	if (!resp->source_cap_count && !resp->sink_cap_count)
>  		return;
>  
> -	port->partner_pd = usb_power_delivery_register(NULL, &desc);
> +	port->partner_pd = typec_partner_usb_power_delivery_register(port->partner, &desc);
>  	if (IS_ERR(port->partner_pd)) {
>  		dev_warn(typec->dev, "Failed to register partner PD device, port: %d\n", port_num);
>  		return;

thanks,
diff mbox series

Patch

diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
index 2a7ff14dc37e..d5bc4021aca2 100644
--- a/drivers/platform/chrome/cros_ec_typec.c
+++ b/drivers/platform/chrome/cros_ec_typec.c
@@ -968,7 +968,7 @@  static void cros_typec_register_partner_pdos(struct cros_typec_data *typec,
 	if (!resp->source_cap_count && !resp->sink_cap_count)
 		return;
 
-	port->partner_pd = usb_power_delivery_register(NULL, &desc);
+	port->partner_pd = typec_partner_usb_power_delivery_register(port->partner, &desc);
 	if (IS_ERR(port->partner_pd)) {
 		dev_warn(typec->dev, "Failed to register partner PD device, port: %d\n", port_num);
 		return;