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: 47556 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 16BCA20553 for ; Fri, 24 Apr 2015 11:57:23 +0000 (UTC) Received: by wgtl5 with SMTP id l5sf11172905wgt.1 for ; Fri, 24 Apr 2015 04:57:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=HmnS6qBYRcvgZqAywcd/UW2SVZOmpi5A27e6X3AmLRo=; b=M9UzJHS7nFLLWdh7lgeZd866JcgDlIGl+1YHuh697dN58AsUubOFz6TuG7bRWjFV0c 8nR3noowPkaj/RPaMEJihOCukz2FzAIaxbbtzB5k6wv3ykO2iCk8j5tcSpPwVThB0B8X yxH34pD2vNSzUcprEL/2Xjgjk33/bBjhv7ge/iO9qlH8TIYeZJ9d0hcVj08iA/tsekWE SOZxOoZ53gNhdq8ZqcuA9smysNsq//LHyg0KW9ZSakR71xmqkCGmOGeM2l72dBlf21Ej nHYW4VjUwzdx1HbxgbjEOpT9WvMS9a5Y6+ov3tJXWsI4Z3vrE/8PGS6kK7VpfUj1NrYK wZgA== X-Gm-Message-State: ALoCoQm0U/s1rhvqK/db+kIB6l8ubSERQM8hG3XhbTdz2FsCnRWDVhItQfufrz1n1FzwmxllL0wy X-Received: by 10.112.122.39 with SMTP id lp7mr3980487lbb.5.1429876642401; Fri, 24 Apr 2015 04:57:22 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.44.135 with SMTP id e7ls387752lam.79.gmail; Fri, 24 Apr 2015 04:57:22 -0700 (PDT) X-Received: by 10.153.5.36 with SMTP id cj4mr6531033lad.69.1429876642251; Fri, 24 Apr 2015 04:57:22 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id xs10si8095092lbb.86.2015.04.24.04.57.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Apr 2015 04:57:21 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by labbd9 with SMTP id bd9so33410005lab.2 for ; Fri, 24 Apr 2015 04:57:21 -0700 (PDT) X-Received: by 10.112.140.231 with SMTP id rj7mr6472116lbb.76.1429876641640; Fri, 24 Apr 2015 04:57:21 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.67.65 with SMTP id l1csp1140926lbt; Fri, 24 Apr 2015 04:57:20 -0700 (PDT) X-Received: by 10.68.232.194 with SMTP id tq2mr14374917pbc.90.1429876640579; Fri, 24 Apr 2015 04:57:20 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id oe2si17168807pdb.149.2015.04.24.04.57.19 for ; Fri, 24 Apr 2015 04:57:20 -0700 (PDT) Received-SPF: none (google.com: linux-leds-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751216AbbDXL5T (ORCPT ); Fri, 24 Apr 2015 07:57:19 -0400 Received: from mail-lb0-f173.google.com ([209.85.217.173]:33405 "EHLO mail-lb0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751031AbbDXL5S (ORCPT ); Fri, 24 Apr 2015 07:57:18 -0400 Received: by lbbzk7 with SMTP id zk7so34630550lbb.0 for ; Fri, 24 Apr 2015 04:57:17 -0700 (PDT) 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 , Cc: , , rjw@rjwysocki.net, , Greg Kroah-Hartman , Grygorii Strashko 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 Sender: linux-leds-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-leds@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: grygorii.strashko@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 --- 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) {