From patchwork Thu Jun 13 09:16:22 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: 17880 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f72.google.com (mail-yh0-f72.google.com [209.85.213.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1612C25BE0 for ; Thu, 13 Jun 2013 09:16:58 +0000 (UTC) Received: by mail-yh0-f72.google.com with SMTP id z20sf5371620yhz.3 for ; Thu, 13 Jun 2013 02:16:57 -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=2RQ3xFqC2vgkrEhv2vbDH6VkLmkgZtCuKnyY6RSFlrI=; b=goVeMVwx22XUNq1h7EBlqFRCQrpkVIRRcuVmbL2X+lwCL3Sz0i/OIneYJ71DCyQ6Xa AFHrAaoxv//7OJbqANMq6R4UMGn8vGI5Ch5jRC79NyC9yLqwCFazqOzXJPTAwJOiGJSg FhmtptRLFJRwBom0MjLtd/utO3tYiDnpba9lO/uoW1msesTsLvRZVD/QHcyjTNWfYXlq HroeU9XNm28qlV2iUPaZvFX3IA4889d2oJGJvXESRJE/s7FnzRwW+VESxryyKduMQpWP VIjtSsGDbbaumZwBnQn/S9Md1924hG3b4IA+MHhIv5nEA2UzxeADRl3QAwG/+C6bs27e oGIA== X-Received: by 10.224.174.145 with SMTP id t17mr1166005qaz.4.1371115017847; Thu, 13 Jun 2013 02:16:57 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.86.7 with SMTP id l7ls439618qez.51.gmail; Thu, 13 Jun 2013 02:16:57 -0700 (PDT) X-Received: by 10.52.26.140 with SMTP id l12mr9533475vdg.29.1371115017721; Thu, 13 Jun 2013 02:16:57 -0700 (PDT) Received: from mail-ve0-x232.google.com (mail-ve0-x232.google.com [2607:f8b0:400c:c01::232]) by mx.google.com with ESMTPS id xs10si565893vcb.43.2013.06.13.02.16.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 13 Jun 2013 02:16:57 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::232 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:c01::232; Received: by mail-ve0-f178.google.com with SMTP id pb11so7486663veb.37 for ; Thu, 13 Jun 2013 02:16:57 -0700 (PDT) X-Received: by 10.52.170.148 with SMTP id am20mr9528299vdc.75.1371115017601; Thu, 13 Jun 2013 02:16:57 -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 gx3csp13732vec; Thu, 13 Jun 2013 02:16:57 -0700 (PDT) X-Received: by 10.66.119.35 with SMTP id kr3mr1879616pab.149.1371115016624; Thu, 13 Jun 2013 02:16:56 -0700 (PDT) Received: from mail-pd0-f180.google.com (mail-pd0-f180.google.com [209.85.192.180]) by mx.google.com with ESMTPS id tq5si13482706pab.146.2013.06.13.02.16.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 13 Jun 2013 02:16:56 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.180 is neither permitted nor denied by best guess record for domain of manjunath.goudar@linaro.org) client-ip=209.85.192.180; Received: by mail-pd0-f180.google.com with SMTP id 10so11088788pdi.11 for ; Thu, 13 Jun 2013 02:16:56 -0700 (PDT) X-Received: by 10.66.146.65 with SMTP id ta1mr1986994pab.7.1371115016239; Thu, 13 Jun 2013 02:16:56 -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.16.51 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 13 Jun 2013 02:16:55 -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 03/10] USB: OHCI: Properly handle ohci-da8xx suspend Date: Thu, 13 Jun 2013 14:46:22 +0530 Message-Id: <1371114989-2342-4-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: ALoCoQnRSBWf1SqbUFF5wqD4bJYaDTlCKTfDrkDPVMLCq0iXeCGwA9oZA8GVe1tPDQwvd0SPJg5q X-Original-Sender: manjunath.goudar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::232 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-da8xx glue was not properly handled as it was not suspending generic part of ohci controller.Calling explicitly the ohci_suspend() routine in ohci_da8xx_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-da8xx.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c index 6aaa9c9..8d4914d 100644 --- a/drivers/usb/host/ohci-da8xx.c +++ b/drivers/usb/host/ohci-da8xx.c @@ -406,10 +406,21 @@ static int ohci_hcd_da8xx_drv_remove(struct platform_device *dev) } #ifdef CONFIG_PM -static int ohci_da8xx_suspend(struct platform_device *dev, pm_message_t message) +static int ohci_da8xx_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); + 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); @@ -417,8 +428,8 @@ static int ohci_da8xx_suspend(struct platform_device *dev, pm_message_t message) ohci_da8xx_clock(0); hcd->state = HC_STATE_SUSPENDED; - dev->dev.power.power_state = PMSG_SUSPEND; - return 0; + pdev->dev.power.power_state = PMSG_SUSPEND; + return ret; } static int ohci_da8xx_resume(struct platform_device *dev)