From patchwork Thu Feb 5 14:37:04 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: 44460 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f197.google.com (mail-we0-f197.google.com [74.125.82.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 438E621173 for ; Thu, 5 Feb 2015 14:37:21 +0000 (UTC) Received: by mail-we0-f197.google.com with SMTP id l61sf5670315wev.0 for ; Thu, 05 Feb 2015 06:37:20 -0800 (PST) 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=Z5ZceYVGBbsU5NUSyZS5uXbhoYeBkeVzYzMamsBkXTo=; b=GeKzBcIeEnHSmv1jLRd40QGaVk/O12tCQJazPnLEfEWAySnosgTYi9Tl0jRKF0KALE /A3IdYk280QEtqsfe65ZPu95fEDqTJai9hthBGJFLpzIleijxmJ1zCtznFmD+FaXw3Pn tnIk12lWjd30N51mymIb3bL5oG7wYzqUvR5xF+G+2f8iYRrns+0jKu6vBtnWn0OY/m3+ lRW2+hSYs26QcrJexlgGTx1iGa8Hr5xZkdl5JJlPIPswpLZXL3E93zse1lBLiPnP0iu7 5vnr5E11Hb8wIlgECu6lSNGIuNVcLSSaYkqQUotOpBDNccHMyUixwJ5/EhvyNloXCmer k4PQ== X-Gm-Message-State: ALoCoQktROIYy2xRh/50HkIyNYI2l6B/WrG5mytDb9jeQV9eA6sM+1X4KfvltwV5FJCr3yeX+ugO X-Received: by 10.194.201.10 with SMTP id jw10mr536371wjc.3.1423147040114; Thu, 05 Feb 2015 06:37:20 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.30.38 with SMTP id p6ls168724lah.52.gmail; Thu, 05 Feb 2015 06:37:19 -0800 (PST) X-Received: by 10.112.30.135 with SMTP id s7mr3760553lbh.63.1423147039733; Thu, 05 Feb 2015 06:37:19 -0800 (PST) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id ml8si4083229lbc.77.2015.02.05.06.37.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Feb 2015 06:37:19 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by mail-lb0-f169.google.com with SMTP id f15so7817664lbj.0 for ; Thu, 05 Feb 2015 06:37:19 -0800 (PST) X-Received: by 10.152.8.104 with SMTP id q8mr3898330laa.56.1423147039571; Thu, 05 Feb 2015 06:37:19 -0800 (PST) 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.35.133 with SMTP id h5csp1180180lbj; Thu, 5 Feb 2015 06:37:18 -0800 (PST) X-Received: by 10.70.52.234 with SMTP id w10mr5985808pdo.50.1423147037826; Thu, 05 Feb 2015 06:37:17 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l3si4243989pdj.247.2015.02.05.06.37.17 for ; Thu, 05 Feb 2015 06:37:17 -0800 (PST) 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 S1757504AbbBEOhQ (ORCPT ); Thu, 5 Feb 2015 09:37:16 -0500 Received: from mail-lb0-f180.google.com ([209.85.217.180]:58521 "EHLO mail-lb0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757281AbbBEOhO (ORCPT ); Thu, 5 Feb 2015 09:37:14 -0500 Received: by mail-lb0-f180.google.com with SMTP id b6so7784531lbj.11 for ; Thu, 05 Feb 2015 06:37:13 -0800 (PST) X-Received: by 10.152.2.41 with SMTP id 9mr3844563lar.59.1423147033145; Thu, 05 Feb 2015 06:37:13 -0800 (PST) Received: from localhost ([195.238.92.128]) by mx.google.com with ESMTPSA id cb5sm999577lad.3.2015.02.05.06.37.12 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 05 Feb 2015 06:37:12 -0800 (PST) From: To: Bryan Wu , Richard Purdie , linux-leds@vger.kernel.org Cc: sumit.semwal@linaro.org, linux-arm-kernel@lists.infradead.org, , linux-pm@vger.kernel.org, Grygorii Strashko Subject: [PATCH v2] leds: fix hibernation on arm when gpio-led used with CPU led trigger Date: Thu, 5 Feb 2015 16:37:04 +0200 Message-Id: <1423147024-4744-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.217.169 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. Signed-off-by: Grygorii Strashko --- This patch actually fixes commit: 73e1ab4 "leds: Convert led class driver from legacy pm ops to dev_pm_ops" Changes in v2: - fixed compile time warnings when !CONFIG_PM_SLEEP - updated commit message 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 dbeebac..5033e0d 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c @@ -183,6 +183,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); @@ -202,11 +203,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); /** * led_classdev_register - register a new object of led_classdev class.