From patchwork Thu Jun 13 09:16:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: manjunath.goudar@linaro.org X-Patchwork-Id: 17887 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f199.google.com (mail-vc0-f199.google.com [209.85.220.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D95B225BE0 for ; Thu, 13 Jun 2013 09:17:31 +0000 (UTC) Received: by mail-vc0-f199.google.com with SMTP id gf11sf2918059vcb.2 for ; Thu, 13 Jun 2013 02:17:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=3uC+nLV5Z59MTT8ntSFxruT+ixcuHCa5AeuDsQrreNI=; b=Y/u7dixqPsS4OUPzWKHmpmMnW2PRuKJpVc0YeNcWl9oPcfQE4bpe4ibQf41Jku0C0J DO2RbnaL7RpNbDLwzMHF+ILWpRuTC/eB76z3GE0DnatWzSFBrE4ltvEKrUrvcGcXT/TT 1jpZ85lPui13DHnuCMctlx06Oy3DbJvbyTGesDeh45QQ65JUjsj4R9YCS6HZgpZFmLZb 3JoRLBvUYnzNZ4I6/TAZmxCgf/Qa4k9vx9OJ4Phllu8leuUGr7y4rfqvXRo8Z9fChoxB 1y8yHWYEdGKSXQ4eU0ciaKTXqvnr36wpFC53JWpILfCwliJrKEavvzYorUTeQZxHR5zz l6/w== X-Received: by 10.224.200.202 with SMTP id ex10mr1157056qab.8.1371115051616; Thu, 13 Jun 2013 02:17:31 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.34.130 with SMTP id z2ls3378791qei.98.gmail; Thu, 13 Jun 2013 02:17:31 -0700 (PDT) X-Received: by 10.220.112.210 with SMTP id x18mr15400vcp.0.1371115051483; Thu, 13 Jun 2013 02:17:31 -0700 (PDT) Received: from mail-vb0-x235.google.com (mail-vb0-x235.google.com [2607:f8b0:400c:c02::235]) by mx.google.com with ESMTPS id ha3si10092331vdb.95.2013.06.13.02.17.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 13 Jun 2013 02:17:31 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::235 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::235; Received: by mail-vb0-f53.google.com with SMTP id p12so6671387vbe.26 for ; Thu, 13 Jun 2013 02:17:31 -0700 (PDT) X-Received: by 10.220.53.7 with SMTP id k7mr5810971vcg.52.1371115051349; Thu, 13 Jun 2013 02:17:31 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.191.99 with SMTP id gx3csp13749vec; Thu, 13 Jun 2013 02:17:30 -0700 (PDT) X-Received: by 10.66.155.138 with SMTP id vw10mr1909164pab.91.1371115050376; Thu, 13 Jun 2013 02:17:30 -0700 (PDT) Received: from mail-pb0-x22e.google.com (mail-pb0-x22e.google.com [2607:f8b0:400e:c01::22e]) by mx.google.com with ESMTPS id wu4si11371768pbc.18.2013.06.13.02.17.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 13 Jun 2013 02:17:30 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400e:c01::22e is neither permitted nor denied by best guess record for domain of manjunath.goudar@linaro.org) client-ip=2607:f8b0:400e:c01::22e; Received: by mail-pb0-f46.google.com with SMTP id rq2so5126328pbb.19 for ; Thu, 13 Jun 2013 02:17:30 -0700 (PDT) X-Received: by 10.66.164.161 with SMTP id yr1mr1926292pab.77.1371115049987; Thu, 13 Jun 2013 02:17:29 -0700 (PDT) Received: from manjunath-Latitude-E6420.LGE.NET ([203.247.149.152]) by mx.google.com with ESMTPSA id dc3sm22602113pbc.9.2013.06.13.02.17.25 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 13 Jun 2013 02:17:29 -0700 (PDT) From: Manjunath Goudar To: linux-usb@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, patches@linaro.org, stern@rowland.harvard.edu, arnd@linaro.org, manjunath.goudar@linaro.org, linaro-dev@lists.linaro.org, Arnd Bergmann , Greg KH Subject: [PATCH V2 10/10] USB: OHCI: Properly handle ohci-spear suspend Date: Thu, 13 Jun 2013 14:46:29 +0530 Message-Id: <1371114989-2342-11-git-send-email-manjunath.goudar@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1371114989-2342-1-git-send-email-manjunath.goudar@linaro.org> References: <1371050918-29472-1-git-send-email-manjunath.goudar@linaro.org> <1371114989-2342-1-git-send-email-manjunath.goudar@linaro.org> X-Gm-Message-State: ALoCoQkyYy+7H0foS+Jfb88RKOU4QUhvPfghIiXT29msnDLMCWdyXPu3C/ixl/I8Nb2GkLK4XKuc X-Original-Sender: manjunath.goudar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::235 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Suspend scenario in case of ohci-spear glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in spear_ohci_hcd_drv_suspend() will ensure proper handling of suspend scenario. V2: -Incase ohci_suspend() fails, return right away without executing further. Signed-off-by: Manjunath Goudar Cc: Arnd Bergmann Cc: Alan Stern Cc: Greg KH Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-spear.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c index 31ff3fc..2ff867b 100644 --- a/drivers/usb/host/ohci-spear.c +++ b/drivers/usb/host/ohci-spear.c @@ -130,12 +130,22 @@ static int spear_ohci_hcd_drv_remove(struct platform_device *pdev) } #if defined(CONFIG_PM) -static int spear_ohci_hcd_drv_suspend(struct platform_device *dev, +static int spear_ohci_hcd_drv_suspend(struct platform_device *pdev, pm_message_t message) { - struct usb_hcd *hcd = platform_get_drvdata(dev); + struct usb_hcd *hcd = platform_get_drvdata(pdev); struct ohci_hcd *ohci = hcd_to_ohci(hcd); struct spear_ohci *sohci_p = to_spear_ohci(hcd); + bool do_wakeup = device_may_wakeup(&pdev->dev); + int ret; + + ret = ohci_suspend(hcd, do_wakeup); + if (ret == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) { + ohci_resume(hcd, false); + ret = -EBUSY; + } + if (ret) + return ret; if (time_before(jiffies, ohci->next_statechange)) msleep(5); @@ -143,7 +153,7 @@ static int spear_ohci_hcd_drv_suspend(struct platform_device *dev, clk_disable_unprepare(sohci_p->clk); - return 0; + return ret; } static int spear_ohci_hcd_drv_resume(struct platform_device *dev)