From patchwork Tue Apr 22 00:30:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Capella X-Patchwork-Id: 4027721 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E4E109F387 for ; Tue, 22 Apr 2014 00:31:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 16EDC20340 for ; Tue, 22 Apr 2014 00:31:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3D624201FE for ; Tue, 22 Apr 2014 00:31:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753810AbaDVAav (ORCPT ); Mon, 21 Apr 2014 20:30:51 -0400 Received: from mail-pb0-f47.google.com ([209.85.160.47]:40810 "EHLO mail-pb0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753252AbaDVAau (ORCPT ); Mon, 21 Apr 2014 20:30:50 -0400 Received: by mail-pb0-f47.google.com with SMTP id up15so4287549pbc.34 for ; Mon, 21 Apr 2014 17:30:49 -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=c7lRHoj463qtS7P6Ke0in7mvnNDrayvOSJTpeUr1tt4=; b=Kufgq9QBR+m5cebR+jo/dj5CB+eWvr+3917e8pWTOJWrcr2IMXVbO5v/0Xjea7jgMB 3SYkUgVHOA8/91ARhf2eki/3HxQo4Dh2J/2Uu/x5nsj6IydRfOVueeEWcD/Eu9vX/M7w MvVkKhS8PwbVpTC+d6parNcwlF9rHR5o0NerOUJFze0Rxr/h4tkFmzowAe0tjLyMNrwT 0mCD5esWfAoux/6aEAyZCTo29n5ei3zdHtHyFIiys8cjpLKJYdSNl9ZOpPPifPoeKPFQ I5t07MZJyqEsym3AU5/l+fYEHkYNH5HjLG9hu0cYBqx+bMbCq0O8OBFh1ehSoAVyPUco pC1A== X-Gm-Message-State: ALoCoQkJkQgGx1R7MYh1SBs70PN5MKtjZx/edkTEdoQkzD7V2EmLWoIyIMR/Ne8Fh4ndXnT6N8O5 X-Received: by 10.68.106.130 with SMTP id gu2mr40888560pbb.59.1398126649433; Mon, 21 Apr 2014 17:30:49 -0700 (PDT) Received: from localhost (cpe-76-93-135-111.san.res.rr.com. [76.93.135.111]) by mx.google.com with ESMTPSA id yv7sm193071915pac.33.2014.04.21.17.30.47 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 21 Apr 2014 17:30:48 -0700 (PDT) From: Sebastian Capella To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linaro-kernel@lists.linaro.org Cc: Sebastian Capella , Len Brown , Pavel Machek , "Rafael J. Wysocki" , Russell King , One Thousand Gnomes Subject: [PATCH v2] PM / Hibernate: no kernel_power_off when pm_power_off NULL Date: Mon, 21 Apr 2014 17:30:46 -0700 Message-Id: <1398126646-29518-1-git-send-email-sebastian.capella@linaro.org> X-Mailer: git-send-email 1.7.9.5 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Reboot logic in kernel/reboot will avoid calling kernel_power_off when pm_power_off is null, and instead uses kernel_halt. Change hibernate's power_down to follow the behavior in the reboot call. Calling the notifier twice (once for SYS_POWER_OFF and again for SYS_HALT) causes a panic during hibernation on Kirkwood Openblocks A6 board. Signed-off-by: Sebastian Capella Reported-by: Ezequiel Garcia Cc: Len Brown Cc: Pavel Machek Cc: "Rafael J. Wysocki" Cc: Russell King Cc: One Thousand Gnomes Reviewed-by: Pavel Machek --- kernel/power/hibernate.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index f4f2073..7642932 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c @@ -595,7 +595,8 @@ static void power_down(void) case HIBERNATION_PLATFORM: hibernation_platform_enter(); case HIBERNATION_SHUTDOWN: - kernel_power_off(); + if (pm_power_off) + kernel_power_off(); break; #ifdef CONFIG_SUSPEND case HIBERNATION_SUSPEND: @@ -623,7 +624,8 @@ static void power_down(void) * corruption after resume. */ printk(KERN_CRIT "PM: Please power down manually\n"); - while(1); + while (1) + cpu_relax(); } /**