Re: [PATCH 4/7] usb: typec: tcpm: Start using struct typec_operations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 01, 2019 at 06:30:42AM -0700, Guenter Roeck wrote:
> > @@ -4082,10 +4074,9 @@ static int tcpm_pr_set(const struct typec_capability *cap,
> >   	return ret;
> >   }
> > -static int tcpm_vconn_set(const struct typec_capability *cap,
> > -			  enum typec_role role)
> > +static int tcpm_vconn_set(struct typec_port *p, bool source)
> >   {
> > -	struct tcpm_port *port = typec_cap_to_tcpm(cap);
> > +	struct tcpm_port *port = typec_get_drvdata(p);
> >   	int ret;
> >   	mutex_lock(&port->swap_lock);
> > @@ -4096,7 +4087,7 @@ static int tcpm_vconn_set(const struct typec_capability *cap,
> >   		goto port_unlock;
> >   	}
> > -	if (role == port->vconn_role) {
> > +	if (source == port->vconn_role) {
> 
> source is boolean, vconn_role is enum typec_role.
> The original typec code took advantage of typec_role == TYPEC_SINK matching false,
> and typec_role == TYPEC_SOURCE matching true, but I don't think it is a good
> idea to carry that down to low level drivers. This will confuse everyone who wants
> to contribute a driver in the future.

OK, I'll keep the parameter as emum typec_role.


thanks,

-- 
heikki



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux