From mboxrd@z Thu Jan 1 00:00:00 1970 From: richard.zhao@freescale.com (Richard Zhao) Date: Thu, 14 Jun 2012 08:36:53 +0800 Subject: [Patch v5 03/13] USB: notify phy when root hub port connect change In-Reply-To: References: <1339590863-10564-4-git-send-email-richard.zhao@freescale.com> Message-ID: <20120614003653.GA29684@b20223-02.ap.freescale.net> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Wed, Jun 13, 2012 at 02:25:17PM -0400, Alan Stern wrote: > On Wed, 13 Jun 2012, Richard Zhao wrote: > > > Phy may need to change settings when port connect change. > > > > Signed-off-by: Richard Zhao > > --- > > drivers/usb/core/hub.c | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > > > diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c > > index 04fb834..e1a6d31 100644 > > --- a/drivers/usb/core/hub.c > > +++ b/drivers/usb/core/hub.c > > @@ -20,6 +20,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -4034,6 +4035,13 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1, > > } > > } > > > > + if (unlikely(hcd->phy && !hdev->level)) { > > This is okay, but it's more common to test for root hubs with > "!hdev->parent". So it will be like: if (unlikely(hcd->phy && !hdev->parent)) { And, I didn't check (portchange & USB_PORT_STAT_C_CONNECTION), because if the device is connected on boot, there'll be no USB_PORT_STAT_C_CONNECTION. Is it acceptable? Thanks Richard > > + if (portstatus & USB_PORT_STAT_CONNECTION) > > + usb_phy_notify_connect(hcd->phy, port1); > > + else > > + usb_phy_notify_disconnect(hcd->phy, port1); > > + } > > + > > /* Return now if debouncing failed or nothing is connected or > > * the device was "removed". > > */ > > Alan Stern > >