Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp6892697rwp; Tue, 18 Jul 2023 07:17:15 -0700 (PDT) X-Google-Smtp-Source: APBJJlF5zcm37nTJ+qOOO9g5T0Vf1rq9Uuk6spJf34UNyglNrOYs2Izpv+DG1iPEGCivOI4MaTBq X-Received: by 2002:a05:6a20:7491:b0:132:d2c4:9cb9 with SMTP id p17-20020a056a20749100b00132d2c49cb9mr17264882pzd.29.1689689835547; Tue, 18 Jul 2023 07:17:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689689835; cv=none; d=google.com; s=arc-20160816; b=v3JJOWyRpj0t8KOtLMirw0lWFQAYJDylHBolu/sqkS8tmYS+3qmnYP8vUUCf6U9a5X w2/hHx4eiyS0l3f28aBWgaq6dYmyRUPPrFiI1S55rOizaCZKndA8GKF6c6k00LrabA3i z/EIabTjVUCrfKyiI6CgV66w8rwM430zLDCvx3BjGCy+75vTR1jur8BQiZUtOUU/TBTo skpz+liBhuXRoX90XyOjwOi7aHTbU8z/bevnrgBZqMXJhKXF8KQ1UC6oq/pDPiqshjaf JIC3yv7Cgpw0MTWGb6NPrex/R7MoWcHfaOl9J7XHEz7PAmoZvCY+aINV+OS1Awzzq8ye frXA== 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=dIIcx1SGAw9uYYN1avMxPsLqak5l24gEpGFmCR8wXQs=; fh=7/kV83Ara2+7txn8ysFhXjAxbo5VMetMPtvKbZcaYQs=; b=D97Hi11JXwvdv938nPtexulRGGrJm0LGO/5fnqUNd1wsEZkAu3GiTWlqfx7Zh05srJ wJXBIcjPpuwmxeKOqAYxuXu/daidxQbHAzK+7vTmJ2MuSTtwQqEILfXyuAdE063T6xZp rVjWaZ7b1Gu207PVM5h+EssnksGlzCrp6DRziDVGzvyMHpsnMWTPzyqWAPf8xuQYD7Et EBY/MrmvdiT0IWFngSAG7JpmF70t47xiyxvxTkaF757OrYDGqkM8lkBmFi+CkRJvF4B3 D0xVD3QqoepP1XQ4/jshCp0PORA/NrGLdhLOtdRHnKZu2CWG0+XtQ4f52oRwfyjeL7ic wQWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=MeGV0omm; 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 k17-20020a63ff11000000b0053b928deb7asi1439849pgi.344.2023.07.18.07.17.02; Tue, 18 Jul 2023 07:17:15 -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=MeGV0omm; 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 S232955AbjGRNzt (ORCPT + 99 others); Tue, 18 Jul 2023 09:55:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232974AbjGRNzo (ORCPT ); Tue, 18 Jul 2023 09:55:44 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1106BEA; Tue, 18 Jul 2023 06:55:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1689688538; 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=dIIcx1SGAw9uYYN1avMxPsLqak5l24gEpGFmCR8wXQs=; b=MeGV0ommnDXY0bZLzz2aUDd3eORngKqqpm/czs4W5fC56SGEpuHkxL+e3H80XeL4olpT4w 1ApOAoo+UVumdCRRcw4QCgk1bWX8vFzXQhxjA1hdPhx0ybjBisPaXhX4AezSFzKDJcy2CL 4umq/NBxiWzrvybq7Sv34wmBua/EBa4= Message-ID: 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: Tue, 18 Jul 2023 15:55:35 +0200 In-Reply-To: References: <20230717172821.62827-1-andriy.shevchenko@linux.intel.com> <20230717172821.62827-5-andriy.shevchenko@linux.intel.com> <8c66f79025ddd8388eeb9bdb3f0e789fe9f362d9.camel@crapouillou.net> 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,URIBL_BLOCKED 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 Hi Andy, Le mardi 18 juillet 2023 =C3=A0 15:57 +0300, Andy Shevchenko a =C3=A9crit= =C2=A0: > On Mon, Jul 17, 2023 at 10:56=E2=80=AFPM Paul Cercueil > wrote: > > Le lundi 17 juillet 2023 =C3=A0 22:33 +0300, Andy Shevchenko a =C3=A9cr= it : > > > 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= =A9crit > > > > : >=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_= noirq, > > > > 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. > >=20 > > It's designed so that when CONFIG_PM is disabled, the dev_pm_ops is > > garbage-collected along with all its callbacks. > >=20 > > 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. >=20 > Maybe macros can be replaced / changed to make it scale? If you have any ideas, then yes absolutely. >=20 > > 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. >=20 > So far, based on the rest of the messages in the thread the > EXPORT*PM_OPS() have the following issues: > 1) do not scale (for variants with different scope we need new set of > macros); > 2) do not cover cases with pm_sleep_ptr(); > 3) export symbols in case when it's not needed. >=20 > Am I right? I think that's right yes. >=20 > > > > 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. >=20 > Exactly. >=20 > > 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. >=20 > And exactly. >=20 > I don't think they are ready to use (in the current form). But let's > see what we may do better here... They were OK when Jonathan and myself were updating the IIO drivers - but now they definitely show their limitations. Cheers, -Paul