From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B424CC433EF for ; Sun, 27 Feb 2022 17:56:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230103AbiB0R5U convert rfc822-to-8bit (ORCPT ); Sun, 27 Feb 2022 12:57:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229650AbiB0R5T (ORCPT ); Sun, 27 Feb 2022 12:57:19 -0500 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC7B44BFF3 for ; Sun, 27 Feb 2022 09:56:42 -0800 (PST) Date: Sun, 27 Feb 2022 17:56:31 +0000 From: Paul Cercueil Subject: Re: [PATCH -next] misc: rtsx: fix build for CONFIG_PM not set To: Arnd Bergmann Cc: Randy Dunlap , Linux Kernel Mailing List , Wei WANG , Kai-Heng Feng , Greg Kroah-Hartman , "Rafael J. Wysocki" , Jonathan Cameron Message-Id: <7U5Z7R.RNKITPUWCPX32@crapouillou.net> In-Reply-To: References: <20220226222457.13668-1-rdunlap@infradead.org> <449d6ceb-7308-9543-c23c-831bebffda21@infradead.org> <0D5Z7R.NUOWBMRT4GQ2@crapouillou.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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