Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2058719ybz; Sun, 26 Apr 2020 10:11:01 -0700 (PDT) X-Google-Smtp-Source: APiQypLJdo7ZZp64pgGcCRuUyMoqPD6JBEvAEuvKJ0HPEAEogKzQlReSzePDa1JpBcz+jEGlXABB X-Received: by 2002:a17:906:400a:: with SMTP id v10mr15671080ejj.300.1587921061489; Sun, 26 Apr 2020 10:11:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587921061; cv=none; d=google.com; s=arc-20160816; b=BSB0d0cadkFv1rcoqldD07k6LyM9dsr+QTWHSwDnTm9JSYjd9TW+X5eW4D5ki8a5Kv 7X9a0Ggn3e3BAIy68DNm3OGBlHf1Sf+qw2sPSl+HiGSsUhfqEITqVxlm4MYhfiWZ+yN3 iCI1tsqnAN1y6HtD8Ls/Bds+Mjn/v8Ja0NLYU1he7YenO+Jwx908mwj0XRbBSQqJvpYy fD0FCEQB29HU4mXQSjRz0lD3QaHOpXI/gAj5g7rvbvT8ekZAdPYVQ5Xld3Y8lRIlFsia 0s3FFpPVFxLjXxPF0vz0pqHIVajJJQPeagIRa0tHcswY4Bvw5is/f3glKBVT/PMB59NA y9tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:cc:to:subject:from:date :dkim-signature; bh=jTqCfxZBmTk09D67QB/ptZSM/wzN2C9X9u64qCP4L04=; b=0pGipslD71q1k96orf72jZumKGBVdLu7BRrMnlg9umudrVkenl+oPom48PqgFqkNLd zv4CbhqZ3h8s8+5mLo8T+1CxRlQpOjv6gQkh5JA87nRNEbQoUmwY7UA2hJvifbe2V4KC OlyVTR3Q72l0bR/fQ2eydyxLyzQ7vMuTAVv8sjgtTPi/U3ilqT7AgOmKD3SH4rGE8boC Js/DDfMgrEUtINy6/vvR/VyLJ1mmqLw/CPZthoINdz5+RNcwXy+HInoMC59ib9eIE509 s/5eRVPWPFtZukEiN+lVmL2uPF+dgEpSQEj31hoGJnIU1PcnDcDt1rrm3AzSPUZOaIRe jI5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@crapouillou.net header.s=mail header.b="Ybd/6Lup"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ld23si6976817ejb.242.2020.04.26.10.10.37; Sun, 26 Apr 2020 10:11:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@crapouillou.net header.s=mail header.b="Ybd/6Lup"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726185AbgDZRGy (ORCPT + 99 others); Sun, 26 Apr 2020 13:06:54 -0400 Received: from outils.crapouillou.net ([89.234.176.41]:45962 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726143AbgDZRGy (ORCPT ); Sun, 26 Apr 2020 13:06:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1587920811; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jTqCfxZBmTk09D67QB/ptZSM/wzN2C9X9u64qCP4L04=; b=Ybd/6LupQKabv0CLwPuklV2cLPT+1BYCbip7YvN2vRxljCCsK8W+b/ryb0r4GWtbTQOzer T3v4Fjg9/9aEuO++arc6fxNvxB0TfeQkVvQkkbh32M8kiMLGwRaTGUXJniBvOccf3fCaOR 0i5Eu2tdYj3KR/s7gkra/EzzdnEjnqU= Date: Sun, 26 Apr 2020 19:06:40 +0200 From: Paul Cercueil Subject: Re: [PATCH v2 1/3] PM: introduce pm_ptr() macro To: "Rafael J. Wysocki" Cc: Ulf Hansson , Pavel Machek , Len Brown , od@zcrc.me, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Message-Id: <4JNE9Q.Y5HBZ952XKLI@crapouillou.net> In-Reply-To: <2708095.iQXV2FnTNx@kreacher> References: <20200413123207.74552-1-paul@crapouillou.net> <2708095.iQXV2FnTNx@kreacher> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Rafael, Le dim. 26 avril 2020 =E0 17:40, Rafael J. Wysocki a=20 =E9crit : > On Monday, April 13, 2020 2:32:05 PM CEST Paul Cercueil wrote: >> This macro is analogous to the infamous of_match_ptr(). If CONFIG_PM >> is enabled, this macro will resolve to its argument, otherwise to=20 >> NULL. >=20 > Well, this is going to result in quite a bit of unused code being > added to the kernels built with CONFIG_PM unset. >=20 > Is there any way to avoid that somehow? Using __maybe_unused on the dev_pm_ops struct and the callbacks, as=20 long as they are static, they should be dropped by the compiler when=20 CONFIG_PM is not set. -Paul >=20 >> Signed-off-by: Paul Cercueil >> --- >>=20 >> Notes: >> v2: Remove pm_sleep_ptr() macro >>=20 >> include/linux/pm.h | 6 ++++++ >> 1 file changed, 6 insertions(+) >>=20 >> diff --git a/include/linux/pm.h b/include/linux/pm.h >> index e057d1fa2469..1c0eec06905d 100644 >> --- a/include/linux/pm.h >> +++ b/include/linux/pm.h >> @@ -374,6 +374,12 @@ const struct dev_pm_ops name =3D { \ >> SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \ >> } >>=20 >> +#ifdef CONFIG_PM >> +#define pm_ptr(_ptr) (_ptr) >> +#else >> +#define pm_ptr(_ptr) NULL >> +#endif >> + >> /* >> * PM_EVENT_ messages >> * >>=20 >=20 >=20 >=20 >=20