From patchwork Wed Jun 19 12:12:11 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: 17988 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f70.google.com (mail-qa0-f70.google.com [209.85.216.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 84FA82397B for ; Wed, 19 Jun 2013 12:13:06 +0000 (UTC) Received: by mail-qa0-f70.google.com with SMTP id cr7sf867819qab.5 for ; Wed, 19 Jun 2013 05:13:06 -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=thccch+kE2G3cqVhtEeU6wo8cD+24HGx/YjOJ+YzCqU=; b=VfOL+Url4Kgf72TIog9muLBmL33D88Q5gUW+Of7WlUcgq5IZo0Iz31ZvUjMJObqnu1 YoXZwrrScmnLRl0tKxMDfChmvCENW64NgAcEyxrlVkBoVxTm4qIuXHu9cM7pRFfqyIyQ Vx7iPrNAwDcDlku/ifpT2+JxJPayXSvWFi05NBhakuhFd486q7xVVaJVis353CY7QrGc /OOi3kwZ3qS4Iv9MH/E9UHLH3guRyjrdYzETlqyYpe9ohAclFoET9TM1iVhOAN2HvZ9p QPhe4Vffvy6zwb+Y9vhZgu6noTYEg2sVCv7nHNcH+pb+Ljykshu5AAhZLPzb29kL7+s4 1uAA== X-Received: by 10.224.86.200 with SMTP id t8mr3266770qal.0.1371643986330; Wed, 19 Jun 2013 05:13:06 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.24.162 with SMTP id v2ls126276qef.8.gmail; Wed, 19 Jun 2013 05:13:06 -0700 (PDT) X-Received: by 10.52.171.80 with SMTP id as16mr680981vdc.81.1371643986150; Wed, 19 Jun 2013 05:13:06 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id n3si5385054vcr.68.2013.06.19.05.13.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Jun 2013 05:13:06 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id kw10so3660126vcb.5 for ; Wed, 19 Jun 2013 05:13:06 -0700 (PDT) X-Received: by 10.220.105.9 with SMTP id r9mr535027vco.60.1371643986057; Wed, 19 Jun 2013 05:13:06 -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.165.8 with SMTP id yu8csp106229veb; Wed, 19 Jun 2013 05:13:05 -0700 (PDT) X-Received: by 10.66.11.168 with SMTP id r8mr6378579pab.221.1371643984989; Wed, 19 Jun 2013 05:13:04 -0700 (PDT) Received: from mail-pd0-f174.google.com (mail-pd0-f174.google.com [209.85.192.174]) by mx.google.com with ESMTPS id xx2si10764112pac.16.2013.06.19.05.13.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Jun 2013 05:13:04 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.174 is neither permitted nor denied by best guess record for domain of manjunath.goudar@linaro.org) client-ip=209.85.192.174; Received: by mail-pd0-f174.google.com with SMTP id 10so4996686pdc.33 for ; Wed, 19 Jun 2013 05:13:04 -0700 (PDT) X-Received: by 10.66.197.201 with SMTP id iw9mr6252558pac.198.1371643984450; Wed, 19 Jun 2013 05:13:04 -0700 (PDT) Received: from manjunath-Latitude-E6420.LGE.NET ([203.247.149.152]) by mx.google.com with ESMTPSA id e2sm22925142pbc.23.2013.06.19.05.12.59 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Jun 2013 05:13:03 -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-kernel@lists.linaro.org, Arnd Bergmann , Greg KH Subject: [PATCH V3 06/11] USB: OHCI: Properly handle ohci-exynos suspend Date: Wed, 19 Jun 2013 17:42:11 +0530 Message-Id: <1371643936-3314-7-git-send-email-manjunath.goudar@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1371643936-3314-1-git-send-email-manjunath.goudar@linaro.org> References: <1371050918-29472-1-git-send-email-manjunath.goudar@linaro.org> <1371643936-3314-1-git-send-email-manjunath.goudar@linaro.org> X-Gm-Message-State: ALoCoQlZjAdQoWgjl/MnwTOP9RUc1zFyE1i1ZMSDWopG6f8sF5+Cu3ealKCT3wkpjk3kshTTZrqi X-Original-Sender: manjunath.goudar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.174 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-exynos glue was not properly handled as it was not suspending generic part of ohci controller. Calling explicitly the ohci_suspend() routine in exynos_ohci_suspend() will ensure proper handling of suspend scenario. Signed-off-by: Manjunath Goudar Cc: Arnd Bergmann Cc: Alan Stern Cc: Greg KH Cc: linux-usb@vger.kernel.org V2: -Incase ohci_suspend() fails, return right away without executing further. V3: -rid of unwanted code from ohci_hcd_s3c2410_drv_suspend() which already ohci_suspend() does it. -Aligned variable "do_wakeup" and "ret". --- drivers/usb/host/ohci-exynos.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c index ae6068d..b5926f8 100644 --- a/drivers/usb/host/ohci-exynos.c +++ b/drivers/usb/host/ohci-exynos.c @@ -203,24 +203,15 @@ static int exynos_ohci_suspend(struct device *dev) struct exynos_ohci_hcd *exynos_ohci = to_exynos_ohci(hcd); struct ohci_hcd *ohci = hcd_to_ohci(hcd); struct platform_device *pdev = to_platform_device(dev); - unsigned long flags; - int rc = 0; + bool do_wakeup = device_may_wakeup(dev); + unsigned long flags; + int rc = 0; - /* - * Root hub was already suspended. Disable irq emission and - * mark HW unaccessible, bail out if RH has been resumed. Use - * the spinlock to properly synchronize with possible pending - * RH suspend or resume activity. - */ - spin_lock_irqsave(&ohci->lock, flags); - if (ohci->rh_state != OHCI_RH_SUSPENDED && - ohci->rh_state != OHCI_RH_HALTED) { - rc = -EINVAL; - goto fail; - } - - clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); + rc = ohci_suspend(hcd, do_wakeup); + if (rc) + return rc; + spin_lock_irqsave(&ohci->lock, flags); if (exynos_ohci->otg) exynos_ohci->otg->set_host(exynos_ohci->otg, &hcd->self); @@ -228,7 +219,6 @@ static int exynos_ohci_suspend(struct device *dev) clk_disable_unprepare(exynos_ohci->clk); -fail: spin_unlock_irqrestore(&ohci->lock, flags); return rc;