From patchwork Wed Feb 25 11:53:00 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: kim kyuwon X-Patchwork-Id: 8730 X-Patchwork-Delegate: me@felipebalbi.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n1PBr6uv017504 for ; Wed, 25 Feb 2009 11:53:06 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752834AbZBYLxG (ORCPT ); Wed, 25 Feb 2009 06:53:06 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753100AbZBYLxF (ORCPT ); Wed, 25 Feb 2009 06:53:05 -0500 Received: from rv-out-0506.google.com ([209.85.198.237]:36371 "EHLO rv-out-0506.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752834AbZBYLxC (ORCPT ); Wed, 25 Feb 2009 06:53:02 -0500 Received: by rv-out-0506.google.com with SMTP id g37so2992284rvb.1 for ; Wed, 25 Feb 2009 03:53:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=ShlAYQnnTfAKNDkxA3uXLZeT8xAsGCTS4P03QyEOV2o=; b=engTfO+qgn+rqISO1HV+8WZFPglg67jghz2oIidmRGoToPSMG/lm8wvmxWh2cosT+s LxBRTNY9nIdVLI2bpkhFvBeOSidvhihMJK6KIxU8Uog+If554uX+xf5I4CSdJUivJOpe rC81979ffBpRBvonktxHPx3XBKB3MV6sueIUI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=nZKE0bwQxbL73bUMVQV0O820CWf2zZvzDJHcgLT4ekLg7bhBzwvT7GawIDsrqope2P wXH29cQcSb5npS8zc64+4+HsHzgvTTGrWvayqwXIADvaBxerI7HcidzqDX/XxkUXpQWI wTjuWL/1Sr0/UvK77Angq1E0lKAMBk7yTHzIc= MIME-Version: 1.0 Received: by 10.142.185.21 with SMTP id i21mr12429wff.220.1235562780901; Wed, 25 Feb 2009 03:53:00 -0800 (PST) Date: Wed, 25 Feb 2009 20:53:00 +0900 Message-ID: <4d34a0a70902250353i3c6e072bnd41af327bc77601b@mail.gmail.com> Subject: [PATCH 1/2] usb: musb: fix the possible panic while resuming From: Kim Kyuwon To: linux-usb@vger.kernel.org Cc: OMAP , David Brownell , me@felipebalbi.com, q1.kim@samsung.com, Minkyu Kang Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: Kim Kyuwon While waking up, musb can cause a kernel panic. This patch is fixing it by enabling the clock in the resume_early method. Signed-off-by: Kim Kyuwon --- drivers/usb/musb/musb_core.c | 21 +++++++-------------- 1 files changed, 7 insertions(+), 14 deletions(-) * the system up quickly enough to respond ... @@ -2165,20 +2162,17 @@ static int musb_suspend(struct platform_device *pdev, pm_message_t message) musb->set_clock(musb->clock, 0); else clk_disable(musb->clock); - spin_unlock_irqrestore(&musb->lock, flags); + return 0; } -static int musb_resume(struct platform_device *pdev) +static int musb_resume_early(struct platform_device *pdev) { - unsigned long flags; - struct musb *musb = dev_to_musb(&pdev->dev); + struct musb *musb = dev_to_musb(&pdev->dev); if (!musb->clock) return 0; - spin_lock_irqsave(&musb->lock, flags); - if (musb->set_clock) musb->set_clock(musb->clock, 1); else @@ -2188,7 +2182,6 @@ static int musb_resume(struct platform_device *pdev) * unless for some reason the whole soc powered down and we're * not treating that as a whole-system restart (e.g. swsusp) */ - spin_unlock_irqrestore(&musb->lock, flags); return 0; } @@ -2205,8 +2198,8 @@ static struct platform_driver musb_driver = { }, .remove = __devexit_p(musb_remove), .shutdown = musb_shutdown, - .suspend = musb_suspend, - .resume = musb_resume, + .suspend_late = musb_suspend_late, + .resume_early = musb_resume_early, }; /*-------------------------------------------------------------------------*/ diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 2cc34fa..ae76ad7 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -2141,16 +2141,13 @@ static int __devexit musb_remove(struct platform_device *pdev) #ifdef CONFIG_PM -static int musb_suspend(struct platform_device *pdev, pm_message_t message) +static int musb_suspend_late(struct platform_device *pdev, pm_message_t state) { - unsigned long flags; - struct musb *musb = dev_to_musb(&pdev->dev); + struct musb *musb = dev_to_musb(&pdev->dev); if (!musb->clock) return 0; - spin_lock_irqsave(&musb->lock, flags); - if (is_peripheral_active(musb)) { /* FIXME force disconnect unless we know USB will wake