From mboxrd@z Thu Jan 1 00:00:00 1970 From: marex@denx.de (Marek Vasut) Date: Tue, 10 Jul 2012 05:22:20 +0200 Subject: [PATCH v9 REBASE 6/9] USB: notify phy when root hub port connect change In-Reply-To: <20120710031426.GG26888@b20223-02.ap.freescale.net> References: <1341673008-29808-1-git-send-email-richard.zhao@freescale.com> <1341673008-29808-7-git-send-email-richard.zhao@freescale.com> <20120710031426.GG26888@b20223-02.ap.freescale.net> Message-ID: <201207100522.21162.marex@denx.de> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Dear Richard Zhao, > On Sat, Jul 07, 2012 at 10:56:45PM +0800, Richard Zhao wrote: > > Phy may need to change settings when port connect change. > > > > Signed-off-by: Richard Zhao > > Tested-by: Subodh Nijsure > > --- > > > > 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 4cc8dc9..2ba9d84 100644 > > --- a/drivers/usb/core/hub.c > > +++ b/drivers/usb/core/hub.c > > @@ -20,6 +20,7 @@ > > > > #include > > #include > > #include > > > > +#include > > > > #include > > #include > > #include > > > > @@ -4037,6 +4038,13 @@ static void hub_port_connect_change(struct usb_hub > > *hub, int port1, > > > > } > > > > } > > > > + if (unlikely(hcd->phy && !hdev->parent)) { > > + if (portstatus & USB_PORT_STAT_CONNECTION) > > + usb_phy_notify_connect(hcd->phy, port1); > > + else > > + usb_phy_notify_disconnect(hcd->phy, port1); > > There's another issue. When hcd is removed, notify disconnect is not > called. Is it ok, if I remove the above two line and add below patch: > > --- a/drivers/usb/core/hub.c > +++ b/drivers/usb/core/hub.c > @@ -1924,6 +1924,11 @@ void usb_disconnect(struct usb_device **pdev) > */ > device_del(&udev->dev); > > + if (udev->parent && !udev->parent->parent) { > + struct usb_hcd *hcd = bus_to_hcd(udev->bus); > + usb_phy_notify_disconnect(hcd->phy, udev->portnum); > + } Shouldn't that go before device_del() ? > + > /* Free the device number and delete the parent's children[] > * (or root_hub) pointer. > */ > > > Thanks > Richard Best regards, Marek Vasut