Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1543479pxp; Sun, 6 Mar 2022 18:40:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJyj3q8vnz0IT50KbbUzIpruclCwd/EOWGOhS8nyn4tVgn/g0d5kkl1gxBrljQQ/RK/10H6D X-Received: by 2002:a17:90b:4f83:b0:1bf:219:f364 with SMTP id qe3-20020a17090b4f8300b001bf0219f364mr10583004pjb.184.1646620813299; Sun, 06 Mar 2022 18:40:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646620813; cv=none; d=google.com; s=arc-20160816; b=H4q69vdPt/2X1gSIcfO9BFWrwZaQ5foeSpyGvXOclvnDflqUAyU3MoKx78TtqggeJ6 qBqFyJbwDeHww8RMIqS36NHYU5SaCgr0OWdADglSFT+I77eos7OwBEZVQyDHz/30IucV E228EE1pF3vjeCyOsFfcPP75p0chGe4MNkb2doM4QvoPS+IvwPPuV7+mGfcqUb2bM2JF gNsdN09gaoB5deKxe6QfrnNT9kT5lZ7T3xVsdy8/rO986IYibE1Rjw/j7vsgq0QSvamb 1g92oaNUeCUKWfmRF3iiEqDBdrfER4NQK8UlOkM1nYqVPz0VoIXXBtLlUhNSd7VtYFmX xejg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=og/pYYvXdeDol9WVS+PwXkGFI98XtZIOPKdIEVUoLsw=; b=mc9Mi5CHIoH9Mx1hU9hprU+CKbsLwximh5ugBaFE+ASdYJq6ksfKaEEoww+9dbtPao sZQxXQExYnkpRNxjhZ6vaIIk4/1vg8QpR9QilVVu6uLq+ONC4xu6OUgU28pRnbrJPy90 v4L9ZWCmFTmKxZyRbt7HT7aCguMuwbo3QLVkgVIOkpMUbLKhHd9ziwloSz00KUyZVhCI uDu1dJUBrNKIPI813spjNCEKZ7QY4UICvgyfji3Fm67V5KcFZYcwaShCFpL/efIj9gd0 F7KL8oD5RfgDK8DQFcmyfhNpoCeouJRXBc4xc5RWrEsZm5aYhQJVisfqpi1uARxCcX/P A1ng== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l21-20020a628815000000b004f6ce893677si6275521pfd.238.2022.03.06.18.39.56; Sun, 06 Mar 2022 18:40:13 -0800 (PST) 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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233792AbiCFQZq convert rfc822-to-8bit (ORCPT + 99 others); Sun, 6 Mar 2022 11:25:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231939AbiCFQZp (ORCPT ); Sun, 6 Mar 2022 11:25:45 -0500 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DAB73EBB6 for ; Sun, 6 Mar 2022 08:24:52 -0800 (PST) Received: from fraeml707-chm.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4KBRkQ1S5Qz67Gvv; Mon, 7 Mar 2022 00:24:30 +0800 (CST) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by fraeml707-chm.china.huawei.com (10.206.15.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Sun, 6 Mar 2022 17:24:49 +0100 Received: from localhost (10.47.64.190) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Sun, 6 Mar 2022 16:24:49 +0000 Date: Sun, 6 Mar 2022 16:24:43 +0000 From: Jonathan Cameron To: Paul Cercueil CC: Arnd Bergmann , Randy Dunlap , "Linux Kernel Mailing List" , Wei WANG , Kai-Heng Feng , "Greg Kroah-Hartman" , "Rafael J. Wysocki" Subject: Re: [PATCH -next] misc: rtsx: fix build for CONFIG_PM not set Message-ID: <20220306162443.00006a0d@Huawei.com> In-Reply-To: <20220306151212.00003e6f@Huawei.com> References: <20220226222457.13668-1-rdunlap@infradead.org> <449d6ceb-7308-9543-c23c-831bebffda21@infradead.org> <0D5Z7R.NUOWBMRT4GQ2@crapouillou.net> <7U5Z7R.RNKITPUWCPX32@crapouillou.net> <20220306151212.00003e6f@Huawei.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.29; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8BIT X-Originating-IP: [10.47.64.190] X-ClientProxiedBy: lhreml745-chm.china.huawei.com (10.201.108.195) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,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 On Sun, 6 Mar 2022 15:12:12 +0000 Jonathan Cameron wrote: > On Sun, 27 Feb 2022 17:56:31 +0000 > Paul Cercueil wrote: > > > Le dim., f?vr. 27 2022 at 18:51:38 +0100, Arnd Bergmann > > a ?crit : > > > On Sun, Feb 27, 2022 at 6:46 PM Paul Cercueil > > > wrote: > > >> Le dim., f?vr. 27 2022 at 18:30:16 +0100, Arnd Bergmann > > >> > > >> There could be a DEFINE_DEV_PM_OPS(), but I don't think that's > > >> really > > >> needed - you can very well declare your struct dev_pm_ops without > > >> using > > >> one of these macros. Just make sure to use the SYSTEM_SLEEP_PM_OPS / > > >> RUNTIME_PM_OPS macros for the callbacks and pm_ptr() for the > > >> device.pm > > >> pointer. > > > > > > Ah, of course, so it comes down to > > > s/SET_SYSTEM_SLEEP_PM_OPS/SYSTEM_SLEEP_PM_OPS/ while > > > removing all the #ifdef an __maybe_unused annotations. The pm_ptr() > > > in driver.pm makes this slightly more optimized AFAICT, but has no > > > effect on behavior, right? > > > > The use of SYSTEM_SLEEP_PM_OPS makes sure that the callbacks are > > dropped if the dev_pm_ops is dead code, and the pm_ptr() must be used > > for the compiler to know that the dev_pm_ops is dead code. > > > > -Paul > > > > > > Hi Paul, > > We have one remaining case which is still ugly to do. > Where both SYSTEM_SLEEP_PM_OPS/RUNTIME_PM_OPS are set and > the dev_pm_ops structure is exported. > > For that one we still need to expose #ifdef fun in the > drivers I think. > > Any suggestions on a clean solution for that? > > Currently I have this... > > #ifdef CONFIG_PM > const struct dev_pm_ops bmc150_magn_pm_ops = { > SYSTEM_SLEEP_PM_OPS(...) > RUNTIME_PM_OPS(...) > }; > EXPORT_SYMBOL_NS(bmc150_magn_pm_ops, IIO_BMC150_MAGN); > #else > static const __maybe_unused dev_pm_ops bmc150_magn_pm_ops = { With this renamed to dummy_bmc150_magn_pm_ops to avoid the previous declared warning I'll otherwise get. oops. > SYSTEM_SLEEP_PM_OPS(...) > RUNTIME_PM_OPS(...) > }; > #endif > Not super clean but perhaps we do need > EXPORT_NS_DEV_PM_OPS > EXPORT_NS_GPL_DEV_PM_OPS > and potentially the non namespaced versions. > > Thanks, > > Jonathan