All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: "Linyu Yuan (QUIC)" <quic_linyyuan@quicinc.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"Jack Pham (QUIC)" <quic_jackp@quicinc.com>
Subject: Re: [PATCH 3/3] usb: typec: ucsi: retry find role swithch when module load late
Date: Wed, 13 Apr 2022 14:30:32 +0300	[thread overview]
Message-ID: <Yla0WABuNc2AzLNC@kuha.fi.intel.com> (raw)
In-Reply-To: <Ylax0XUIjKUd9Cls@kuha.fi.intel.com>

On Wed, Apr 13, 2022 at 02:19:49PM +0300, Heikki Krogerus wrote:
> On Wed, Apr 13, 2022 at 11:01:23AM +0000, Linyu Yuan (QUIC) wrote:
> > > From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> > > Sent: Wednesday, April 13, 2022 6:24 PM
> > > > > No, you don't check that, you just return that.
> > > > Yes, I do like it.
> > > > >
> > > > > So you don't need that crazy polling mechanism where you queue a work
> > > > > until you get the resource. Just let the driver core handle the
> > > > > situation.
> > > > The issue is when a UCSI implementation driver probe, it call ucsi_register(),
> > > > But this function will not return -EPROBE_DEFER,
> > > > It just queue a work to start connector discovery.
> > > 
> > > Ah, right right. This is a library. But we should be able use
> > > wait_for_device_probe().
> > > 
> > > So if fwnode_usb_role_switch_get() returns -EPROBE_DEFER, you call
> > > wait_for_device_probe() and try again.
> > Do you mean do as below,
> > 
> > find_role_switch:
> > 	con->usb_role_sw = fwnode_usb_role_switch_get(cap->fwnode);
> > 	if (IS_ERR(con->usb_role_sw)) {
> > 		dev_err(ucsi->dev, "con%d: failed to get usb role switch\n",
> > 			con->num);
> > 		if (con->usb_role_sw == -EPROBE_DEFER) {
> > 			wait_for_device_probe();
> > 			goto find_role_switch;
> > 		}
> > 
> > 		return PTR_ERR(con->usb_role_sw);
> > 	}
> 
> Yes, something like that. Perhaps you could just do that in a loop,
> and you should have a delay there.
> 
> > Seem wait_for_device_probe() will wait all drivers probe,
> > Can we accept it ?
> 
> That part is not a problem, but I'm not sure if it appropriate to call
> the function from drivers. Let me check if there is something else
> that we can do...

OK, I don't think we should use that in drivers, and I don't have any
better ideas. Sorry for the noise.

I notised that you have already send a couple of new versions of this
series. I'll review the last one of those, but in the future please
don't send the new versions so fast.

thanks,

-- 
heikki

      reply	other threads:[~2022-04-13 11:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-12 10:30 [PATCH 0/3] usb: typec: ucsi: allow retry to find role switch Linyu Yuan
2022-04-12 10:30 ` [PATCH 1/3] usb: typec: ucsi: set con->port to NULL when register port fail Linyu Yuan
2022-04-12 10:30 ` [PATCH 2/3] usb: typec: ucsi: add a common function ucsi_connector_clean() Linyu Yuan
2022-04-13  7:38   ` Heikki Krogerus
2022-04-13  7:45     ` Linyu Yuan (QUIC)
2022-04-12 10:30 ` [PATCH 3/3] usb: typec: ucsi: retry find role swithch when module load late Linyu Yuan
2022-04-13  7:46   ` Heikki Krogerus
2022-04-13  8:00     ` Linyu Yuan (QUIC)
2022-04-13  8:09       ` Heikki Krogerus
2022-04-13  8:16         ` Linyu Yuan (QUIC)
2022-04-13 10:24           ` Heikki Krogerus
2022-04-13 11:01             ` Linyu Yuan (QUIC)
2022-04-13 11:19               ` Heikki Krogerus
2022-04-13 11:30                 ` Heikki Krogerus [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yla0WABuNc2AzLNC@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=quic_jackp@quicinc.com \
    --cc=quic_linyyuan@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.