Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2278224pxm; Sun, 27 Feb 2022 16:53:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJweXwNK0wVGjZMn5XLvTne0VxHr58HflD9ooO7jAcKBUfaVAELiOFw0uZA1fS//0az2p+tj X-Received: by 2002:a05:6402:35c7:b0:412:f150:420e with SMTP id z7-20020a05640235c700b00412f150420emr17190828edc.63.1646009604522; Sun, 27 Feb 2022 16:53:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646009604; cv=none; d=google.com; s=arc-20160816; b=cg+PQRoDvfaybHVAa6ky+7vytj78JWZBiQ5A8jYfo7UlZ0ZVDxlVObeVewhEoG3Pxz qzubp4VkYDmwRpYVdJkhy8ffiauDEO0ffe3Pb0ZkVrWTHIM9XGO5e6/MAGNh5m8QzTLk 0qzRlgbfE1iQsp1p/81z4bMiFVMKBBB/yHHwZ8eIsbRMNtQnXajXTkm6yiTZ5KyKP5ON EVvrmWTjw9MW+yYqz6H9j93OlE5q9tP50iJcezTs677R6dw924CYQ/N58Sn/szLMGMWV d4doETLhdRY23hH8hptXaKqGk5ILxOBQSr3aw1pIF740Zm1zT7MCtgGkIXnbOfSWGjiE 1EMQ== 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 :references:in-reply-to:message-id:cc:to:subject:from:date; bh=+jLjrPTWEZZTD+jf0WY9gkdodoDJfMgiUAGS405YnEg=; b=gJHQHuGTUEy91pwNs+Qz+rgbJZibEoc8BARhqskdoVPzo0OoQLk9WcPyEzQFgXg134 rm1EVKbVw8I0SAvFey+0nFfc6soDZM/6QOnu5bqpwJOi88EpHKWofzC3RC+mYKLvWM/I c/OaPeZdKIJY/z9NPvrKwAhaBNpREmK+zmHI264rOkCtSHHquvIEMOdpX5cHWB3wzsFn 5mQGxXlK134hAE0UUCYfBE5fhrromorbF1+TXPE1ZBLa5wdlXTL7hltnG9Jxp7lQtGPG F9tgOjmBcz2LjRGBIKlGw5dM/BE+ZmQZO9YGq9l81mJBw4HubiZiuvwFiiW8d8OkUVZn dmdw== 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=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 dm7-20020a05640222c700b004128f979c19si5287041edb.61.2022.02.27.16.53.03; Sun, 27 Feb 2022 16:53:24 -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=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229903AbiB0RrF convert rfc822-to-8bit (ORCPT + 99 others); Sun, 27 Feb 2022 12:47:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229664AbiB0RrE (ORCPT ); Sun, 27 Feb 2022 12:47:04 -0500 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 662F9192B8 for ; Sun, 27 Feb 2022 09:46:26 -0800 (PST) Date: Sun, 27 Feb 2022 17:46:12 +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: <0D5Z7R.NUOWBMRT4GQ2@crapouillou.net> In-Reply-To: References: <20220226222457.13668-1-rdunlap@infradead.org> <449d6ceb-7308-9543-c23c-831bebffda21@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 Hi, Le dim., f?vr. 27 2022 at 18:30:16 +0100, Arnd Bergmann a ?crit : > On Sun, Feb 27, 2022 at 5:57 PM Randy Dunlap > wrote: >> On 2/27/22 04:04, Arnd Bergmann wrote: >> > On Sat, Feb 26, 2022 at 11:24 PM Randy Dunlap >> wrote: >> > >> >> --- >> >> drivers/misc/cardreader/rtsx_pcr.c | 2 ++ >> >> 1 file changed, 2 insertions(+) >> >> >> >> --- linux-next-20220225.orig/drivers/misc/cardreader/rtsx_pcr.c >> >> +++ linux-next-20220225/drivers/misc/cardreader/rtsx_pcr.c >> >> @@ -1054,6 +1054,7 @@ static int rtsx_pci_acquire_irq(struct r >> >> return 0; >> >> } >> >> >> >> +#ifdef CONFIG_PM >> >> static void rtsx_enable_aspm(struct rtsx_pcr *pcr) >> >> { >> >> if (pcr->ops->set_aspm) >> >> @@ -1085,6 +1086,7 @@ static void rtsx_pm_power_saving(struct >> >> { >> >> rtsx_comm_pm_power_saving(pcr); >> >> } >> >> +#endif >> > >> > Now that we have DEFINE_SIMPLE_DEV_PM_OPS() etc, I think we should >> > no longer add more __maybe_unused annotations or #ifdef CONFIG_PM >> checks >> > but just use the new macros for any new files or whenever a >> warning like >> > this shows up. >> >> In this case it looks like DEFINE_RUNTIME_DEV_PM_OPS() is better. >> Using DEFINE_SIMPLE_DEV_PM_OPS() still produces build >> warnings/errors >> for unused functions. And I do see 4 drivers that are already using >> DEFINE_RUNTIME_DEV_PM_OPS(). >> >> Patch coming right up. > > DEFINE_RUNTIME_DEV_PM_OPS() only references the three runtime > functions > (rtsx_pci_runtime_suspend, rtsx_pci_runtime_resume and > rtsx_pci_runtime_idle) > but not the pm-sleep functions (rtsx_pci_suspend and > rtsx_pci_resume), so your > second patch doesn't look correct either. > > I see there is a _DEFINE_DEV_PM_OPS() helper that appears to do > what we want here, but I'm not sure this is considered an official > API. Adding > Rafael, Paul and Jonathan to Cc for extra input. As the macros are > still > fairly new, I suspect the idea was to add more as needed, so maybe > should > add a DEFINE_DEV_PM_OPS() to wrap _DEFINE_DEV_PM_OPS()? 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. Cheers, -Paul