From patchwork Thu Jun 20 09:36:02 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: 18009 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f70.google.com (mail-qe0-f70.google.com [209.85.128.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 037872393D for ; Thu, 20 Jun 2013 09:38:15 +0000 (UTC) Received: by mail-qe0-f70.google.com with SMTP id 2sf8628526qea.1 for ; Thu, 20 Jun 2013 02:38:14 -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=YoB3VTgy/ymAKQlXig6gQZUlbrzEqOebI3cznPIpRyA=; b=aUJfwJxzZJHPV0vDh4hugLAByt4y3pvXL2BPeFNtHmZDEcGJYI9zLltvOGfMWN0ZZm 4obvb+jXZCro6nIJHSQmHPZJCStuAnHzglIU6sVmMAMW6UFzTJ1jPs4EHPyZljMXoICF ekfoAkPHcrheJNyNxyQc8tH8NZsLcdM/L19tj9/H03jevKggFAf+NlrYJGu7aWBbqMLR Tn4xLFhX/y2xcI87QKzUkPg/zs2TlFe8s2BfOkwjowLCjGUbI8IenCP7WgZVmxAjWWKK viZ+TGtyujbm3O32ExVgKPY94ph+4xuV+k4qqMttApz+lm5GFlOxWQMGfBGVxGf1O9an uXsQ== X-Received: by 10.236.207.169 with SMTP id n29mr3739621yho.50.1371721094808; Thu, 20 Jun 2013 02:38:14 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.121.5 with SMTP id lg5ls611263qeb.21.gmail; Thu, 20 Jun 2013 02:38:14 -0700 (PDT) X-Received: by 10.220.169.146 with SMTP id z18mr2286525vcy.80.1371721094677; Thu, 20 Jun 2013 02:38:14 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id p8si7638867vdv.44.2013.06.20.02.38.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Jun 2013 02:38:14 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.175 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.175; Received: by mail-vc0-f175.google.com with SMTP id hr11so4527658vcb.20 for ; Thu, 20 Jun 2013 02:38:14 -0700 (PDT) X-Received: by 10.58.251.144 with SMTP id zk16mr2517323vec.37.1371721094605; Thu, 20 Jun 2013 02:38:14 -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 yu8csp13838veb; Thu, 20 Jun 2013 02:38:14 -0700 (PDT) X-Received: by 10.68.219.70 with SMTP id pm6mr6661373pbc.154.1371721093571; Thu, 20 Jun 2013 02:38:13 -0700 (PDT) Received: from mail-pd0-f176.google.com (mail-pd0-f176.google.com [209.85.192.176]) by mx.google.com with ESMTPS id iw6si53067pac.72.2013.06.20.02.38.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Jun 2013 02:38:13 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.176 is neither permitted nor denied by best guess record for domain of manjunath.goudar@linaro.org) client-ip=209.85.192.176; Received: by mail-pd0-f176.google.com with SMTP id t12so6011937pdi.21 for ; Thu, 20 Jun 2013 02:38:13 -0700 (PDT) X-Received: by 10.68.75.110 with SMTP id b14mr6735901pbw.89.1371721093012; Thu, 20 Jun 2013 02:38:13 -0700 (PDT) Received: from localhost.localdomain ([223.239.144.192]) by mx.google.com with ESMTPSA id kq2sm35530pab.19.2013.06.20.02.38.06 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Jun 2013 02:38:12 -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 V4 06/11] USB: OHCI: Properly handle ohci-exynos suspend Date: Thu, 20 Jun 2013 15:06:02 +0530 Message-Id: <1371720968-7533-7-git-send-email-manjunath.goudar@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1371720968-7533-1-git-send-email-manjunath.goudar@linaro.org> References: <1371050918-29472-1-git-send-email-manjunath.goudar@linaro.org> <1371720968-7533-1-git-send-email-manjunath.goudar@linaro.org> X-Gm-Message-State: ALoCoQn/0eG0FbUHe43b1aS7giSnnVvPlxUBqCHfHnLr+I57aiyY03xmcGGYrr2HhOHBtbuHLZfY X-Original-Sender: manjunath.goudar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.175 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". V4: -The do_wakeup and rc variable alignment is removed. --- drivers/usb/host/ohci-exynos.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c index ae6068d..17de3dd 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); + 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;