Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754058AbbHMSrd (ORCPT ); Thu, 13 Aug 2015 14:47:33 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:45346 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1754031AbbHMSr3 (ORCPT ); Thu, 13 Aug 2015 14:47:29 -0400 Date: Thu, 13 Aug 2015 14:47:28 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Ramneek Mehresh cc: linux-kernel@vger.kernel.org, , , , Li Yang Subject: Re: [PATCH 3/8][v3]usb:fsl:otg: Add support to add/remove usb host driver In-Reply-To: <1439490305-29215-4-git-send-email-ramneek.mehresh@freescale.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2666 Lines: 85 On Thu, 13 Aug 2015, Ramneek Mehresh wrote: > Add workqueue to add/remove host driver (outside > interrupt context) upon each id change. > > Signed-off-by: Li Yang > Signed-off-by: Ramneek Mehresh > --- > Changes for v3: > - removed CONFIG_FSL_USB2_OTG and CONFIG_FSL_USB2_OTG_MODULE > macros > - removed call to usb_hcd_resume_root_hub(hcd) from > ehci_fsl_drv_resume() > > drivers/usb/host/ehci-fsl.c | 71 ++++++++++++++++++++++++++++++++------------- > drivers/usb/host/ehci-fsl.h | 18 ++++++++++++ > 2 files changed, 69 insertions(+), 20 deletions(-) > static int ehci_fsl_drv_suspend(struct device *dev) > { > struct usb_hcd *hcd = dev_get_drvdata(dev); > - struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd); > void __iomem *non_ehci = hcd->regs; > + struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd); > + struct usb_bus host = hcd->self; I just noticed this line. It does not look right at all; it does a structure copy instead of copying a pointer. > > if (of_device_is_compatible(dev->parent->of_node, > "fsl,mpc5121-usb2-dr")) { > return ehci_fsl_mpc512x_drv_suspend(dev); > } > > + if (host.is_otg) { > + /* remove hcd */ > + ehci_fsl->hcd_add = 0; > + schedule_work(&ehci_fsl->change_hcd_work); > + host.is_otg = 0; And here you turn off the flag in the local copy of the structure, which accomplishes nothing. > + return 0; > + } > + > ehci_prepare_ports_for_controller_suspend(hcd_to_ehci(hcd), > device_may_wakeup(dev)); > if (!fsl_deep_sleep()) > @@ -557,15 +579,24 @@ static int ehci_fsl_drv_suspend(struct device *dev) > static int ehci_fsl_drv_resume(struct device *dev) > { > struct usb_hcd *hcd = dev_get_drvdata(dev); > - struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd); > struct ehci_hcd *ehci = hcd_to_ehci(hcd); > void __iomem *non_ehci = hcd->regs; > + struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd); > + struct usb_bus host = hcd->self; Same here. > --- a/drivers/usb/host/ehci-fsl.h > +++ b/drivers/usb/host/ehci-fsl.h > @@ -63,4 +63,22 @@ > #define UTMI_PHY_EN (1<<9) > #define ULPI_PHY_CLK_SEL (1<<10) > #define PHY_CLK_VALID (1<<17) > + > +struct ehci_fsl { > +#ifdef CONFIG_PM > + /* Saved USB PHY settings, need to restore after deep sleep. */ > + u32 usb_ctrl; > +#endif Do you need this #ifdef? Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/