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 v3 4/4] usb: typec: ucsi: retry find role swithch when module load late
Date: Thu, 21 Apr 2022 10:54:24 +0300 [thread overview]
Message-ID: <YmENsCn6q3dcCMNq@kuha.fi.intel.com> (raw)
In-Reply-To: <DM8PR02MB81981200B7B2E422CA7248D6E3F49@DM8PR02MB8198.namprd02.prod.outlook.com>
Hi,
On Thu, Apr 21, 2022 at 07:40:56AM +0000, Linyu Yuan (QUIC) wrote:
> > > > static void ucsi_init_work(struct work_struct *work)
> > > > {
> > > > - struct ucsi *ucsi = container_of(work, struct ucsi, work);
> > > > + struct ucsi *ucsi = container_of(work, struct ucsi, work.work);
> > > > int ret;
> > > >
> > > > ret = ucsi_init(ucsi);
> > > > if (ret)
> > > > dev_err(ucsi->dev, "PPM init failed (%d)\n", ret);
> > > > +
> > > > +
> > >
> > > Extra line.
> > >
> > > > + if (ret == -EPROBE_DEFER)
> > > > + queue_delayed_work(system_long_wq, &ucsi->work,
> > > HZ/10);
> > >
> > > You have to stop queueing that eventually. You need a counter.
> > >
> > > I'm still not sure why do you want to queue this same work again and
> > > again? Why not just call ucsi_init() in a loop?
> >
> > Will follow your suggestion below.
> >
> > >
> > > int my_counter = 1000;
> > So you prefer 10 second in total ?
> > If so, next version, I will change it to 500, as msleep(20), check next.
> > >
> > > while (ucsi_init(ucsi) == -EPROBE_DEFER && my_counter--)
> > > msleep(10);
> > In checkpatch.pl, it suggest msleep no less than 20ms each time.
> > msleep(20) ?
> >
> > >
> > > > }
> >
> > Great idea, it will be less code change.
>
>
> Sorry, I think there is one concern of your suggestion is that
> As the while loop inside the worker, if we can this worker,
> It may spent too much time.
>
> Although my original design is crazy(queue worker again inside it),
> but it allow cancel worker wait short time.
>
> please let me know what is your suggestion now.
OK, that's a good point. So just re-schedule the work like you do.
thanks,
--
heikki
prev parent reply other threads:[~2022-04-21 7:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-13 9:58 [PATCH v3 0/4] usb: typec: ucsi: allow retry to find role switch Linyu Yuan
2022-04-13 9:58 ` [PATCH v3 1/4] usb: typec: ucsi: set con->port to NULL when register port fail Linyu Yuan
2022-04-13 11:31 ` Heikki Krogerus
2022-04-13 13:16 ` Linyu Yuan (QUIC)
2022-04-13 9:58 ` [PATCH v3 2/4] usb: typec: ucsi: add a common function ucsi_unregister_connectors() Linyu Yuan
2022-04-13 12:08 ` Heikki Krogerus
2022-04-13 13:27 ` Linyu Yuan (QUIC)
2022-04-21 8:00 ` Heikki Krogerus
2022-04-21 8:13 ` Linyu Yuan (QUIC)
2022-04-13 9:58 ` [PATCH v3 3/4] usb: typec: ucsi: do not allocate one extra unused connector Linyu Yuan
2022-04-13 9:58 ` [PATCH v3 4/4] usb: typec: ucsi: retry find role swithch when module load late Linyu Yuan
2022-04-13 12:39 ` Heikki Krogerus
2022-04-13 13:42 ` Linyu Yuan (QUIC)
2022-04-21 7:40 ` Linyu Yuan (QUIC)
2022-04-21 7:54 ` 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=YmENsCn6q3dcCMNq@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox