Re: [PATCH v3 2/4] usb: typec: ucsi: add a common function ucsi_unregister_connectors()

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

 



On Wed, Apr 13, 2022 at 01:27:52PM +0000, Linyu Yuan (QUIC) wrote:
> > From: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>
> > Sent: Wednesday, April 13, 2022 8:09 PM
> > To: Linyu Yuan (QUIC) <quic_linyyuan@xxxxxxxxxxx>
> > Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>; linux-
> > usb@xxxxxxxxxxxxxxx; Jack Pham (QUIC) <quic_jackp@xxxxxxxxxxx>
> > Subject: Re: [PATCH v3 2/4] usb: typec: ucsi: add a common function
> > ucsi_unregister_connectors()
> > 
> > On Wed, Apr 13, 2022 at 05:58:09PM +0800, Linyu Yuan wrote:
> > > In error path of ucsi_init(), it will unregister all valid ucsi connector,
> > > and samiliar operation also happen in ucsi_unregister(),
> > 
> > Sorry but I have to confirm this: with "samiliar" you mean "the same",
> > right?
> 
> Only one small difference for original code which is no cancel_work_sync() of each connector in ucsi _init(),
> But in ucsi_register_port(), we get role switch after connector work initialized,
> So I think it is safe to call cancel_work_sync() to connector work if role switch return -EPROBE_DEFER.
> 
> > 
> > > add a common function for two places.
> > >
> > > Signed-off-by: Linyu Yuan <quic_linyyuan@xxxxxxxxxxx>
> > > ---
> > > v2: improve ucsi_connector_clean(), check total number of connector.
> > > v3: rename to ucsi_unregister_connectors(), suggest by maintainer
> > >
> > >  drivers/usb/typec/ucsi/ucsi.c | 51 ++++++++++++++++++++++++-----------
> > --------
> > >  1 file changed, 28 insertions(+), 23 deletions(-)
> > >
> > > diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
> > > index 77ac0b7..af9a2a1 100644
> > > --- a/drivers/usb/typec/ucsi/ucsi.c
> > > +++ b/drivers/usb/typec/ucsi/ucsi.c
> > > @@ -1187,6 +1187,32 @@ static int ucsi_register_port(struct ucsi *ucsi, int
> > index)
> > >  	return ret;
> > >  }
> > >
> > > +static void ucsi_unregister_connectors(struct ucsi *ucsi)
> > > +{
> > > +	struct ucsi_connector *con;
> > > +	int i;
> > > +
> > > +	if (!ucsi->connector)
> > > +		return;
> > 
> > Can that actually ever happen?
> 
> Consider a case, ucsi_init() failed, we will call ucsi_unregister_connectors() to free all connectors,
> After that the UCSI implementation like ucsi_acpi call ucsi_unregister() again,
> It should not unregister connectors again.

I'm sorry but I don't understand your answer. I'm trying to ask what
are you trying to say with the word "samiliar"?

I do not believe there is a word "samiliar" in English language.

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