From patchwork Thu Jul 25 10:53:55 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: 18564 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ye0-f198.google.com (mail-ye0-f198.google.com [209.85.213.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E78E425DF6 for ; Thu, 25 Jul 2013 10:54:35 +0000 (UTC) Received: by mail-ye0-f198.google.com with SMTP id m13sf466962yen.1 for ; Thu, 25 Jul 2013 03:54:35 -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=OnD3smpd+tVXBGYBuP1MxukA9TaVKVhSsIXh2u4SF6M=; b=fJJWtHDt0tV3KUOjEIIGoqDLcC3+QxJdrmi09k9NG5PW9c3L0a2QzzdqDsjaF6Ee1C BqK1Zzln4JNgavT7cx/l98FnwwvFne50GLpde6UjJkwBb5KsMHLlg04xL/IZ1hPTVQng +AVRWkEk7PFp3OPHn17dtZc8hs0LO2DdPm6sRxp0v6G0IkFBYmm+jGp7HWQ9UaQZF9Tu Ndii7ce2rhB4kSPE0X+RyI2Y3UX7qjR6LZwTD5OGjazdcey7hyc0w4k3UpxBW/gmU+Kh dDZQrz+JQgBwCJF0EwDXGZxDxgMqiqhFPHV6S0s+hScZglhpRmSAOQhj5eFAUeUbEf52 nxSw== X-Received: by 10.236.70.105 with SMTP id o69mr4029971yhd.53.1374749675654; Thu, 25 Jul 2013 03:54:35 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.15.131 with SMTP id x3ls529044qec.76.gmail; Thu, 25 Jul 2013 03:54:35 -0700 (PDT) X-Received: by 10.220.43.71 with SMTP id v7mr218310vce.63.1374749675550; Thu, 25 Jul 2013 03:54:35 -0700 (PDT) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by mx.google.com with ESMTPS id ha3si12156655vdb.134.2013.07.25.03.54.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 25 Jul 2013 03:54:35 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.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.128.174; Received: by mail-ve0-f174.google.com with SMTP id cy12so388710veb.5 for ; Thu, 25 Jul 2013 03:54:35 -0700 (PDT) X-Received: by 10.52.165.71 with SMTP id yw7mr2227050vdb.82.1374749675436; Thu, 25 Jul 2013 03:54:35 -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 yu8csp71160veb; Thu, 25 Jul 2013 03:54:34 -0700 (PDT) X-Received: by 10.68.163.165 with SMTP id yj5mr47113396pbb.141.1374749674249; Thu, 25 Jul 2013 03:54:34 -0700 (PDT) Received: from mail-pb0-f42.google.com (mail-pb0-f42.google.com [209.85.160.42]) by mx.google.com with ESMTPS id l2si30930880pan.141.2013.07.25.03.54.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 25 Jul 2013 03:54:34 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.42 is neither permitted nor denied by best guess record for domain of manjunath.goudar@linaro.org) client-ip=209.85.160.42; Received: by mail-pb0-f42.google.com with SMTP id un1so608029pbc.29 for ; Thu, 25 Jul 2013 03:54:33 -0700 (PDT) X-Received: by 10.68.129.39 with SMTP id nt7mr1915702pbb.178.1374749673740; Thu, 25 Jul 2013 03:54:33 -0700 (PDT) Received: from localhost.localdomain ([223.239.156.49]) by mx.google.com with ESMTPSA id nm10sm53355013pbc.28.2013.07.25.03.54.31 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 25 Jul 2013 03:54:33 -0700 (PDT) From: Manjunath Goudar To: manjunath.goudar@linaro.org Cc: arnd@linaro.org, patches@linaro.org Subject: [PATCH V4 06/11] USB: OHCI: Properly handle ohci-exynos suspend Date: Thu, 25 Jul 2013 16:23:55 +0530 Message-Id: <1374749640-30062-7-git-send-email-manjunath.goudar@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1374749640-30062-1-git-send-email-manjunath.goudar@linaro.org> References: <1374749640-30062-1-git-send-email-manjunath.goudar@linaro.org> X-Gm-Message-State: ALoCoQktNpRdlt+/CKbLPsuhWF5/nL4VKdDLxlMcT70tWzaC1yZdUVc3cXrBiqkVlEsPR5BNhevq X-Original-Sender: manjunath.goudar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.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 Acked-by: Alan Stern Cc: Arnd Bergmann 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;