From patchwork Thu Jun 20 09:35:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manjunath Goudar X-Patchwork-Id: 2754231 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 39A46C0AB1 for ; Thu, 20 Jun 2013 09:41:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 81D6A2044C for ; Thu, 20 Jun 2013 09:41:42 +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 89B532044A for ; Thu, 20 Jun 2013 09:41:37 +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 1UpbKD-00043H-4t; Thu, 20 Jun 2013 09:38:42 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UpbJe-0000Vk-P6; Thu, 20 Jun 2013 09:38:06 +0000 Received: from mail-pb0-x232.google.com ([2607:f8b0:400e:c01::232]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UpbJa-0000UT-4d for linux-arm-kernel@lists.infradead.org; Thu, 20 Jun 2013 09:38:02 +0000 Received: by mail-pb0-f50.google.com with SMTP id wz7so6033848pbc.9 for ; Thu, 20 Jun 2013 02:37:40 -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=UTfIlaZEc1Eswj3CPoS1o6A4z4k5u/MaWC6FlaA7Sng=; b=atqqgNCWZ/v/EmbMFi/2/JgV2RPD6E6+GXbVosNV5vIJ/wt1FNVtJ8FRb8ENhzixjO T5e3oJptqxD7S7nv2MUYYXkqtWk6J6kWI/lo3cKBllZIsWrvn+1DTORTvKklNJm/TJza Vz68H6Lu9R/mx/KbopmLFLNhA5kkSyRIwmWw94az0Y16KQAmnkL4kT1JzmaoYfgdKnDF Pu79lmJp/xcWubVhoeE6O+I61tTbd4wHAJJIOKRK835BLNlQ9Vyf9BjxzMLVuTOY1rfq Jvv/xZlDMdT1dNbXKJ/uNsAHeBco5hyoSn6dpzk+GtBCLGawa/fdA8eeWBSUpO9HYRQb Csvg== X-Received: by 10.68.96.193 with SMTP id du1mr6725844pbb.142.1371721060372; Thu, 20 Jun 2013 02:37:40 -0700 (PDT) Received: from localhost.localdomain ([223.239.144.192]) by mx.google.com with ESMTPSA id kq2sm35530pab.19.2013.06.20.02.36.55 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Jun 2013 02:37:39 -0700 (PDT) From: Manjunath Goudar To: linux-usb@vger.kernel.org Subject: [PATCH V4 03/11] USB: OHCI: Properly handle ohci-s3c2410 suspend Date: Thu, 20 Jun 2013 15:05:59 +0530 Message-Id: <1371720968-7533-4-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: ALoCoQlb3EHNZhLButKr1ubOtj/o4F2BfmdQnmzgUSdZBInbZeDsVCdWGBBsF/iLQD9IM7CMppr0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130620_053802_280789_493E883C X-CRM114-Status: GOOD ( 12.91 ) X-Spam-Score: -1.9 (-) 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=-5.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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-s3c2410 glue was not properly handled as it was not suspending generic part of ohci controller. Calling explicitly the ohci_suspend() routine in ohci_hcd_s3c2410_drv_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. V4: -The do_wakeup variable alignment is removed. --- drivers/usb/host/ohci-s3c2410.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c index 8018bb1..4ccf156 100644 --- a/drivers/usb/host/ohci-s3c2410.c +++ b/drivers/usb/host/ohci-s3c2410.c @@ -428,26 +428,15 @@ static int ohci_hcd_s3c2410_drv_suspend(struct device *dev) struct usb_hcd *hcd = dev_get_drvdata(dev); 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) { - rc = -EINVAL; - goto bail; - } - - clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); + rc = ohci_suspend(hcd, do_wakeup); + if (rc) + return rc; s3c2410_stop_hc(pdev); -bail: - spin_unlock_irqrestore(&ohci->lock, flags); return rc; }