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 X-Patchwork-Id: 2750071 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 92D83C0AB1 for ; Wed, 19 Jun 2013 15:16:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C6090203DD for ; Wed, 19 Jun 2013 15:16:35 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AAAC8203DA for ; Wed, 19 Jun 2013 15:16:33 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UpHI7-0006zM-Ni; Wed, 19 Jun 2013 12:15:13 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UpHHK-0001CH-Av; Wed, 19 Jun 2013 12:14:22 +0000 Received: from mail-pd0-f180.google.com ([209.85.192.180]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UpHGQ-000119-P0 for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2013 12:13:28 +0000 Received: by mail-pd0-f180.google.com with SMTP id 10so5002880pdi.39 for ; Wed, 19 Jun 2013 05:13:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=thccch+kE2G3cqVhtEeU6wo8cD+24HGx/YjOJ+YzCqU=; b=NAb0A+N6wcuCVlbCFdzqLF48H/SCPeU9UCq6e23qCm6ndW22PAeg0NenBBfKKulNSA tTbiZKsp6xydztc5Ry/srDPJ/tHDofufSxZ9O4jEHqkbdUEvFPwCwoIkJiP4nxkJv1EV lolwtKLS1NxzQUHgFB25D1dEmKlDzkLr327EX+sW5DijXbpHCgHUCkDTZzum2IO1D2+n S+t7yERA9GN4Lxh/1pRn0asSU/xCunPUQrmPU7X6CJaia7uclbdcmwQlgkI0S2ujxtVv NsTRDB+0fA2zb/4TSLXzV17t6RcThR9kfi9lZ51luYjFfJBCH6uV6DyR5D4K82Kd1bII 2vHA== 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 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: ALoCoQnmdXNdaQb0ZYrGsCbF0dQ7JYFtaVCugQhbsS4OYTR8pHfxHeLDm42DblhR9mjIQ7dPeZ5n X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130619_081326_942484_31295C24 X-CRM114-Status: GOOD ( 14.31 ) X-Spam-Score: -1.1 (-) Cc: linaro-kernel@lists.linaro.org, Arnd Bergmann , patches@linaro.org, Greg KH , manjunath.goudar@linaro.org, stern@rowland.harvard.edu, arnd@linaro.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_WEB, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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;