Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754577AbbGCMdb (ORCPT ); Fri, 3 Jul 2015 08:33:31 -0400 Received: from down.free-electrons.com ([37.187.137.238]:35617 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754931AbbGCMdW (ORCPT ); Fri, 3 Jul 2015 08:33:22 -0400 Date: Fri, 3 Jul 2015 14:33:19 +0200 From: Thomas Petazzoni To: Gregory CLEMENT Cc: Jason Cooper , Andrew Lunn , Sebastian Hesselbarth , Ezequiel Garcia , linux-arm-kernel@lists.infradead.org, Maxime Ripard , Boris BREZILLON , Lior Amsalem , Tawfik Bayouk , Nadav Haklai , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/4] ARM: mvebu: Add standby support Message-ID: <20150703143319.1af14c99@free-electrons.com> In-Reply-To: <55967E35.8050002@free-electrons.com> References: <1435684740-24912-1-git-send-email-gregory.clement@free-electrons.com> <1435684740-24912-3-git-send-email-gregory.clement@free-electrons.com> <20150701174709.2d55007d@free-electrons.com> <55967485.2010607@free-electrons.com> <20150703141716.785a27c5@free-electrons.com> <55967E35.8050002@free-electrons.com> Organization: Free Electrons X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.27; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1521 Lines: 37 Hello, On Fri, 03 Jul 2015 14:21:09 +0200, Gregory CLEMENT wrote: > No it is called during boot and if the method is not there then it is no > more available for the user. I made te test and with a cat on /sys/power/state > I only got "freeze" and "standby" but not "mem". Argh, indeed it's called by suspend_set_ops() itself. So now, I wonder why the heck ->valid() is a function pointer in this case, rather than just an argument passed to suspend_set_ops(). Having a function pointer would precisely be useful to change at runtime which states are available, and which states are not available. It is being called again when actually entering the state, but apparently for no useful reason. Another option is to have ->valid() always say that suspend to RAM is available, and just make ->enter() return -EINVAL if we're trying to enter the PM_SUSPEND_MEM state and the mvebu_pm_board_enter pointer is NULL. The only drawback is that the kernel will have done all its suspend procedure (freezing processes, suspend devices) before telling the user that it is not possible to enter suspend to RAM. But it's probably not a big deal. Best regards, Thomas -- Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/