From patchwork Tue Feb 11 16:03:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 212915 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6731FC352A3 for ; Tue, 11 Feb 2020 16:03:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3885620714 for ; Tue, 11 Feb 2020 16:03:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=crapouillou.net header.i=@crapouillou.net header.b="KKmkEw7p" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730560AbgBKQDo (ORCPT ); Tue, 11 Feb 2020 11:03:44 -0500 Received: from outils.crapouillou.net ([89.234.176.41]:35570 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728252AbgBKQDo (ORCPT ); Tue, 11 Feb 2020 11:03:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1581437018; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Eqz+dXWlx2geLx0boHuaL+MtB8wylUNe2oXXeMBk+b4=; b=KKmkEw7pd22w0XgOCjrbIn8PNXgZwPr6PRuxA/FyfEjE/JPYgR35m30PIIgztpPcbfmxzv YA1ncxuCcjkmEQcRXJuki64g3cZYqkzduz05OCyuynCtM9eJJFFDvED6KXWGB6MP4uwrDP Qv3ZweTZTU5hkOHryP25EXSu/kJj3AU= From: Paul Cercueil To: "Rafael J . Wysocki" , Len Brown , Pavel Machek Cc: Ulf Hansson , od@zcrc.me, linux-pm@vger.kernel.org, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil Subject: [RFC PATCH 1/3] PM: introduce pm_ptr() and pm_sleep_ptr() Date: Tue, 11 Feb 2020 13:03:19 -0300 Message-Id: <20200211160321.22124-2-paul@crapouillou.net> In-Reply-To: <20200211160321.22124-1-paul@crapouillou.net> References: <20200211160321.22124-1-paul@crapouillou.net> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org These macros are analogous to the infamous of_match_ptr(). If CONFIG_PM or CONFIG_PM_SLEEP are enabled (respectively), these macros will resolve to their argument, otherwise to NULL. Signed-off-by: Paul Cercueil --- include/linux/pm.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/linux/pm.h b/include/linux/pm.h index e057d1fa2469..1e183d78a1ae 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h @@ -374,6 +374,18 @@ const struct dev_pm_ops name = { \ SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \ } +#ifdef CONFIG_PM +#define pm_ptr(_ptr) (_ptr) +#else +#define pm_ptr(_ptr) NULL +#endif + +#ifdef CONFIG_PM_SLEEP +#define pm_sleep_ptr(_ptr) (_ptr) +#else +#define pm_sleep_ptr(_ptr) NULL +#endif + /* * PM_EVENT_ messages *