All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: Sven Peter <sven@svenpeter.dev>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Ferry Toth <fntoth@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Felipe Balbi <balbi@kernel.org>,
	Thinh Nguyen <thinhn@synopsys.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Subject: Re: [PATCH v4] usb: dwc3: Don't switch OTG -> peripheral if extcon is present
Date: Fri, 23 Sep 2022 18:07:13 -0700	[thread overview]
Message-ID: <CAHQ1cqHO+EWJP0TV2EQzrcqq=20dqagC-ThrTYQurKrWuZYnvQ@mail.gmail.com> (raw)
In-Reply-To: <Yy4Bw+jqDxshX4Dg@smile.fi.intel.com>

On Fri, Sep 23, 2022 at 11:58 AM Andy Shevchenko
<andriy.shevchenko@intel.com> wrote:
>
> +Stephen to help to realize what the mess we have now...
>
> On Fri, Sep 23, 2022 at 08:35:13PM +0200, Sven Peter wrote:
> > On Fri, Sep 23, 2022, at 20:23, Andrey Smirnov wrote:
> > > On Fri, Sep 23, 2022 at 9:42 AM Andy Shevchenko
> > > <andriy.shevchenko@intel.com> wrote:
> > >>
> > >> On Thu, Sep 22, 2022 at 04:32:55PM -0700, Andrey Smirnov wrote:
> > >> > On Thu, Sep 22, 2022 at 3:23 AM Ferry Toth <fntoth@gmail.com> wrote:
> > >> > > On 22-09-2022 12:08, Andy Shevchenko wrote:
> > >> > > On Sun, Apr 03, 2022 at 09:49:07AM -0700, Andrey Smirnov wrote:
> > >>
> > >> FYI: For now I sent a revert, but if we got a solution quicker we always
> > >> can choose the course of actions.
> > >>
> > >
> > > I think we have another problem. This patch happened in parallel to mine
> > >
> > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v6.0-rc6&id=ab7aa2866d295438dc60522f85c5421c6b4f1507
> > >
> > > so my changes didn't have that fix in mind and I think your revert
> > > will not preserve that fix. Can you update your revert to take care of
> > > that too, please?
> > >
> > > I'm really confused how the above commit could be followed up by:
> > >
> > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/usb/dwc3/drd.c?h=v6.0-rc6&id=0f01017191384e3962fa31520a9fd9846c3d352f
> > >
> > > the diffs in dwc3_drd_init seem contradictory
> >
> > I noticed this a while ago when I finally rebased the M1 USB3 PHY WIP branch
> > and have been meaning to send a fix. Then life unfortunately got in the way and
> > I completely forgot about it again.
> >
> > Both patches were sent at approximately the same time and I think got merged into
> > two separate branches. The conflict resolution [1] then went bad but I didn't notice
> > until weeks later :(
>
> Folks, I have no idea what you are talking about. Can you check that revert
> series [2] gets your change still in? Because I have no clue how it's involved at
> all into discussion.
>
> > [1] https://lore.kernel.org/lkml/20220426150842.473be40e@canb.auug.org.au/
>
> [2]: https://lore.kernel.org/linux-usb/20220923163051.36288-1-andriy.shevchenko@linux.intel.com/
>

Here's Sven's diff:

diff --git a/drivers/usb/dwc3/drd.c b/drivers/usb/dwc3/drd.c
index b60b5f7b6dff4..8cad9e7d33687 100644
--- a/drivers/usb/dwc3/drd.c
+++ b/drivers/usb/dwc3/drd.c
@@ -584,16 +584,15 @@ int dwc3_drd_init(struct dwc3 *dwc)
{
int ret, irq;
+ if (ROLE_SWITCH &&
+ device_property_read_bool(dwc->dev, "usb-role-switch"))
+ return dwc3_setup_role_switch(dwc);
+
dwc->edev = dwc3_get_extcon(dwc);
if (IS_ERR(dwc->edev))
return PTR_ERR(dwc->edev);
- if (ROLE_SWITCH &&
- device_property_read_bool(dwc->dev, "usb-role-switch")) {
- ret = dwc3_setup_role_switch(dwc);
- if (ret < 0)
- return ret;
- } else if (dwc->edev) {
+ if (dwc->edev) {


Here's your revert of my patch:

@@ -538,6 +584,10 @@ int dwc3_drd_init(struct dwc3 *dwc)
 {
        int ret, irq;

+       dwc->edev = dwc3_get_extcon(dwc);
+       if (IS_ERR(dwc->edev))
+               return PTR_ERR(dwc->edev);
+
        if (ROLE_SWITCH &&
            device_property_read_bool(dwc->dev, "usb-role-switch"))
                return dwc3_setup_role_switch(dwc);


There's an order of operations difference. Dwc3_get_extcon() Needs to
be happening after if (ROLE_SWITCH

  reply	other threads:[~2022-09-24  1:07 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-03 16:49 [PATCH v4] usb: dwc3: Don't switch OTG -> peripheral if extcon is present Andrey Smirnov
2022-09-22 10:08 ` Andy Shevchenko
2022-09-22 14:30   ` Ferry Toth
     [not found]   ` <691c3073-5105-9a2b-e6f2-ea0a4b8aaea8@gmail.com>
2022-09-22 13:29     ` Andy Shevchenko
2022-09-22 20:35       ` Ferry Toth
2022-09-22 23:32     ` Andrey Smirnov
2022-09-23 16:42       ` Andy Shevchenko
2022-09-23 18:23         ` Andrey Smirnov
2022-09-23 18:35           ` Sven Peter
2022-09-23 18:58             ` Andy Shevchenko
2022-09-24  1:07               ` Andrey Smirnov [this message]
2022-09-23 18:54           ` Andy Shevchenko
2022-09-24  1:27             ` Andrey Smirnov
2022-09-24 11:55               ` Ferry Toth
2022-09-23 20:10           ` Ferry Toth
2022-09-24 21:29           ` Ferry Toth
2022-09-25 19:21             ` Ferry Toth
2022-09-26  5:43               ` Andrey Smirnov
2022-09-26 10:19                 ` Andy Shevchenko
2022-09-26 18:31                   ` Andrey Smirnov
2022-09-27 12:21                     ` Andy Shevchenko
2022-09-26 10:45               ` Sven Peter
2022-09-23 21:12         ` Ferry Toth
2022-09-24  1:34           ` Andrey Smirnov
2022-09-24 16:06             ` Ferry Toth
2022-09-26 10:21               ` Andy Shevchenko

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='CAHQ1cqHO+EWJP0TV2EQzrcqq=20dqagC-ThrTYQurKrWuZYnvQ@mail.gmail.com' \
    --to=andrew.smirnov@gmail.com \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=balbi@kernel.org \
    --cc=fntoth@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=sven@svenpeter.dev \
    --cc=thinhn@synopsys.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.