Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp6017981rwp; Mon, 17 Jul 2023 13:23:29 -0700 (PDT) X-Google-Smtp-Source: APBJJlFDmCYBg+hQ8ff7JKUT3iInD7n4kU265f9eTwB+p4ts9UC8zpKCGKl9Up+y88wZIN6cg3xe X-Received: by 2002:a05:6512:4003:b0:4fb:91c5:fd38 with SMTP id br3-20020a056512400300b004fb91c5fd38mr9975117lfb.0.1689625408723; Mon, 17 Jul 2023 13:23:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689625408; cv=none; d=google.com; s=arc-20160816; b=d5lHnEj9n9IeSZ0+bgUWaPlehCFANGDBaF2l8989RkQ6QbtBEZFqUYhQX+R4OS+bGg y6hMAaxChfiMBQMva/gHEy+xzRsL2awTsew7OkbqlZJJcsRZaSBMnajH6gOUf9w1yy6p gJHFG3ycew/SUQ4146hzH170jxpnTn05cywz1DRaT9oJKtDIFubPu650KzXiIZnIog0N 36oY6f7LaAVpV2z4i8pn1k43KpKn7wlIJsgHvVFFExtLhtpd6czEw4evqfiP5UWtEVnN 2PeOQNmnpLV9sCST2Lh3+VDS/zMeHuZvX29azswqnRj0US2UmB24VWGSZNx1DO310hY7 b/qQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=fEo4GP83lIE+lgHyH0OgrfVUmqIaUGHnS8773OANhBk=; fh=7/kV83Ara2+7txn8ysFhXjAxbo5VMetMPtvKbZcaYQs=; b=UPS+2drRZU7r3MYQRU9SKYgwM3Cbz6C7czxcofg72Me/1UW6ay4SD2p2SDlYEI13Bv 81Ng1PkbtUBmI9rY7zm1iHxQeixjc8IR/RYPZSs7HuKiHWgathmhx5jcL0Tqm+hMGTjj hBrHugCuwiby/u4Gp8c/1zcepEm/BQC3Tleos9VKYDP3w8sId6XcFzw4y5n33H/DpVc4 GEN4xA3GL/Nk4rLLgL3b1gNZpT0PIjV8uLHb2fE8BEME87bbBV5sDLdgcfugIRUCDTK4 r9bDMdDpx0Qu7KjK073HP5/zrKaGEDfyn2l+Kwjr9XruHMMiBdt3dTL+/sSbBZtEtNui A8jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=l0iyJWMp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z20-20020aa7d414000000b005149e1735bcsi113879edq.33.2023.07.17.13.23.04; Mon, 17 Jul 2023 13:23:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=l0iyJWMp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229579AbjGQT4y (ORCPT + 99 others); Mon, 17 Jul 2023 15:56:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231352AbjGQT4r (ORCPT ); Mon, 17 Jul 2023 15:56:47 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10BB2170D; Mon, 17 Jul 2023 12:56:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1689623760; h=from:from: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=fEo4GP83lIE+lgHyH0OgrfVUmqIaUGHnS8773OANhBk=; b=l0iyJWMpe6xSAJOeof6UhbOiLwEzGtfdQOenOHe7x1WEX87oLs/sqcILqWR/6F6vYNbyxW 0jHoBbsL1LxSF1a8umousHQ+ObYLfz2FWrXHnM3il1OBsIaAXM+DyopoqtpVwrV8RDMkRz nihLU0iVibpyCgWAkHsF50Li29isdlU= Message-ID: <8c66f79025ddd8388eeb9bdb3f0e789fe9f362d9.camel@crapouillou.net> Subject: Re: [PATCH v2 04/10] pinctrl: intel: Switch to use DEFINE_NOIRQ_DEV_PM_OPS() helper From: Paul Cercueil To: Andy Shevchenko Cc: Andy Shevchenko , Mika Westerberg , Linus Walleij , Balsam CHIHI , Claudiu Beznea , Geert Uytterhoeven , Wolfram Sang , Thierry Reding , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-renesas-soc@vger.kernel.org, linux-tegra@vger.kernel.org, linux-pm@vger.kernel.org, Andy Shevchenko , Sean Wang , Matthias Brugger , AngeloGioacchino Del Regno , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Ludovic Desroches , Nicolas Ferre , Alexandre Belloni , Jonathan Hunter , "Rafael J. Wysocki" , Len Brown , Pavel Machek Date: Mon, 17 Jul 2023 21:55:57 +0200 In-Reply-To: References: <20230717172821.62827-1-andriy.shevchenko@linux.intel.com> <20230717172821.62827-5-andriy.shevchenko@linux.intel.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le lundi 17 juillet 2023 =C3=A0 22:33 +0300, Andy Shevchenko a =C3=A9crit= =C2=A0: > On Mon, Jul 17, 2023 at 10:02=E2=80=AFPM Paul Cercueil > wrote: > > Le lundi 17 juillet 2023 =C3=A0 20:28 +0300, Andy Shevchenko a =C3=A9cr= it : >=20 > ... >=20 > > Unrelated change. >=20 > OK. >=20 > ... >=20 > > So the correct way to update this driver would be to have a > > conditionally-exported dev_pm_ops structure: > >=20 > > EXPORT_GPL_DEV_PM_OPS(intel_pinctrl_pm_ops) =3D { > > =C2=A0=C2=A0=C2=A0 NOIRQ_SYSTEM_SLEEP_PM_OPS(intel_pinctrl_suspend_noir= q, > > intel_pinctrl_resume_noirq), > > }; >=20 > This looks ugly. I didn't know that EXPORT*PM_OPS designed that way, > but it seems pm.h in such case needs EXPORT for NOIRQ case as well. It's designed so that when CONFIG_PM is disabled, the dev_pm_ops is garbage-collected along with all its callbacks. I know it looks ugly, but we already have 4 variants (regular, namespace, GPL, namespace + GPL), if we start to add macros for specific use-cases then it will become bloated really quick. And the "bloat" I'm trying to avoid here is the extreme expansion of the API which makes it hard for people not familiar to the code to understand what should be used and how. > > Then your two callbacks can be "static" and without #ifdef guards. > >=20 > > The resulting "intel_pinctrl_pm_ops" can be marked as "extern" in > > the > > pinctrl-intel.h without any guards, as long as it is only > > referenced > > with the pm_ptr() macro. >=20 > I'm not sure I got this. Currently drivers do not have any guards. > Moreover, the correct one for noirq is pm_sleep_ptr(), isn't it? >=20 The EXPORT_*_DEV_PM_OPS() macros do export the "dev_pm_ops" conditionally depending on CONFIG_PM. We could add variants that export it conditionally depending on CONFIG_PM_SLEEP, but we're back at the problem of adding bloat. You could use pm_sleep_ptr() indeed, with the existing macros, with the drawback that in the case where CONFIG_PM && !CONFIG_PM_SLEEP, the dev_pm_ops + callbacks are compiled in but never referenced. Cheers, -Paul