From: "Linyu Yuan (QUIC)" <quic_linyyuan@quicinc.com>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
"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 08:00:35 +0000 [thread overview]
Message-ID: <DM8PR02MB819850DA69CED34F1B31B6EBE3EC9@DM8PR02MB8198.namprd02.prod.outlook.com> (raw)
In-Reply-To: <YlZ/wrIRUD7HpMDB@kuha.fi.intel.com>
> From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Sent: Wednesday, April 13, 2022 3:46 PM
> To: Linyu Yuan (QUIC) <quic_linyyuan@quicinc.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.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
>
> On Tue, Apr 12, 2022 at 06:30:07PM +0800, Linyu Yuan wrote:
> > When role switch enabled, return -EAGAIN if fail to find it due to
> > module load ordering issue, then restart ucsi init work to find
> > it again every 100ms.
> >
> > It also means change ucsi init work to delayed_work.
> >
> > Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com>
> > ---
> > drivers/usb/typec/ucsi/ucsi.c | 28 ++++++++++++++++------------
> > drivers/usb/typec/ucsi/ucsi.h | 2 +-
> > 2 files changed, 17 insertions(+), 13 deletions(-)
> >
> > diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
> > index 684fc4f..fabd4df 100644
> > --- a/drivers/usb/typec/ucsi/ucsi.c
> > +++ b/drivers/usb/typec/ucsi/ucsi.c
> > @@ -1053,6 +1053,14 @@ static int ucsi_register_port(struct ucsi *ucsi, int
> index)
> > con->num = index + 1;
> > con->ucsi = ucsi;
> >
> > + cap->fwnode = ucsi_find_fwnode(con);
> > + 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",
> > + index + 1);
> > + return -EAGAIN;
> > + }
>
> No, this is wrong. If there is a role switch assigned in the firmware
> for the port, then fwnode_usb_role_switch_get() will return
> -EPROBE_DEFER until the switch has been registered.
>
> So I think what you want to do is just make the failure to get the
> role switch fatal in this driver. Just return PTR_ERR(con->usb_role_sw).
Thanks, will change it to check -EPROBE_DEFER.
>
> thanks,
>
> --
> heikki
next prev parent reply other threads:[~2022-04-13 8:01 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) [this message]
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
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=DM8PR02MB819850DA69CED34F1B31B6EBE3EC9@DM8PR02MB8198.namprd02.prod.outlook.com \
--to=quic_linyyuan@quicinc.com \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=linux-usb@vger.kernel.org \
--cc=quic_jackp@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).