From patchwork Fri Apr 24 11:57:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Grygorii.Strashko@linaro.org" X-Patchwork-Id: 6269381 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BD955BF4A6 for ; Fri, 24 Apr 2015 12:00:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C5ECB20109 for ; Fri, 24 Apr 2015 12:00:28 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B06D120120 for ; Fri, 24 Apr 2015 12:00:27 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YlcEo-0007xJ-Fo; Fri, 24 Apr 2015 11:57:42 +0000 Received: from mail-lb0-f180.google.com ([209.85.217.180]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YlcEl-0007wg-Cu for linux-arm-kernel@lists.infradead.org; Fri, 24 Apr 2015 11:57:40 +0000 Received: by lbbqq2 with SMTP id qq2so34568832lbb.3 for ; Fri, 24 Apr 2015 04:57:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=0BJAE3xTSob9bGwnYtlv1/ecf+K519PzKoKwBFrCDgY=; b=mASyA7ky4IwHK/2/BpLJ2AYiOG6uxeECPgsrAQway6xquMOFsor/RByAfour+xQqPp tUVfjBQjF6VPaaQqfFYgKZDPwryOg33jN7cT/PI12c+16GQ0ASLoS4QMPnxeb++0ZvHg Tm7p+ee851ftapowCKydfiAA52s4JWJyf2LSi6OHOCX97eVQc4ZHiFHVUAQp2rw6MY5e 5uu15M+jJHPdWi8DWc4iPvCzakSRMLTcqCrh+DcZxfEvqvov6gblN7rS4W77KljoZYWO LCVBrWpTGX8hmVryfrsw5TXGGULkc7OfvfDf2B0/PyzZqKvMgYIj+/lgMp9Z+4besgzP wp3g== X-Gm-Message-State: ALoCoQki7qaMh6IhobIdpV6xK2WMA10XX0VF7nxFXdNI2sFnJtgp45SV5ZZc1k3g7EomonC3QMe8 X-Received: by 10.152.87.164 with SMTP id az4mr6666131lab.123.1429876636949; Fri, 24 Apr 2015 04:57:16 -0700 (PDT) Received: from localhost ([195.238.92.128]) by mx.google.com with ESMTPSA id xg4sm2573902lac.0.2015.04.24.04.57.16 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 24 Apr 2015 04:57:16 -0700 (PDT) From: To: Bryan Wu , Richard Purdie , Kevin Hilman , Subject: [PATCH RESEND v2] leds: fix hibernation on arm when gpio-led used with CPU led trigger Date: Fri, 24 Apr 2015 14:57:10 +0300 Message-Id: <1429876630-15952-1-git-send-email-grygorii.strashko@linaro.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150424_045739_616130_C1560564 X-CRM114-Status: GOOD ( 12.05 ) X-Spam-Score: -0.7 (/) Cc: Grygorii Strashko , linux-pm@vger.kernel.org, Greg Kroah-Hartman , rjw@rjwysocki.net, sumit.semwal@linaro.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 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.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_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 From: Grygorii Strashko Setting a dev_pm_ops suspend/resume pair of callbacks but not a set of hibernation callbacks means those pm functions will not be called upon hibernation - that leads to system crash on ARM during freezing if gpio-led is used in combination with CPU led trigger. It may happen after freeze_noirq stage (GPIO is suspended) and before syscore_suspend stage (CPU led trigger is suspended) - usually when disable_nonboot_cpus() is called. Log: PM: noirq freeze of devices complete after 1.425 msecs Disabling non-boot CPUs ... ^ system may crash or stuck here with message (TI AM572x) WARNING: CPU: 0 PID: 3100 at drivers/bus/omap_l3_noc.c:148 l3_interrupt_handler+0x22c/0x370() 44000000.ocp:L3 Custom Error: MASTER MPU TARGET L4_PER1_P3 (Idle): Data Access in Supervisor mode during Functional access CPU1: shutdown ^ or here Fix this by using SIMPLE_DEV_PM_OPS, which appropriately assigns the suspend and hibernation callbacks and move led_suspend/led_resume under CONFIG_PM_SLEEP to avoid build warnings. Fixes: 73e1ab41a80d (leds: Convert led class driver from legacy pm ops to dev_pm_ops) Signed-off-by: Grygorii Strashko Acked-by: Jacek Anaszewski --- Hi All, Could you pls pay attention on this patch? This trivial patch was posted at Feb 2015 and it's missed two merge windows already ((. Rebased on top of next (4.1). Changes in v2: - fixed compile time warnings when !CONFIG_PM_SLEEP - updated commit message v2: https://lkml.org/lkml/2015/2/5/323 v1: https://lkml.org/lkml/2015/2/2/476 drivers/leds/led-class.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index 728681d..7fb2a19 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c @@ -187,6 +187,7 @@ void led_classdev_resume(struct led_classdev *led_cdev) } EXPORT_SYMBOL_GPL(led_classdev_resume); +#ifdef CONFIG_PM_SLEEP static int led_suspend(struct device *dev) { struct led_classdev *led_cdev = dev_get_drvdata(dev); @@ -206,11 +207,9 @@ static int led_resume(struct device *dev) return 0; } +#endif -static const struct dev_pm_ops leds_class_dev_pm_ops = { - .suspend = led_suspend, - .resume = led_resume, -}; +static SIMPLE_DEV_PM_OPS(leds_class_dev_pm_ops, led_suspend, led_resume); static int match_name(struct device *dev, const void *data) {