lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220227170102.6926-1-rdunlap@infradead.org>
Date:   Sun, 27 Feb 2022 09:01:02 -0800
From:   Randy Dunlap <rdunlap@...radead.org>
To:     linux-kernel@...r.kernel.org
Cc:     Randy Dunlap <rdunlap@...radead.org>,
        Wei WANG <wei_wang@...lsil.com.cn>,
        Kai-Heng Feng <kai.heng.feng@...onical.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Arnd Bergmann <arnd@...db.de>
Subject: [PATCH -next v2] misc: rtsx: fix build for CONFIG_PM not set

When CONFG_WERROR=y and CONFIG_PM is not set, there are fatal build
errors, so surround these functions in an #ifdef CONFIG_PM block.

../drivers/misc/cardreader/rtsx_pcr.c:1057:13: error: ‘rtsx_enable_aspm’ defined but not used [-Werror=unused-function]
 static void rtsx_enable_aspm(struct rtsx_pcr *pcr)
miscread001.out:../drivers/misc/cardreader/rtsx_pcr.c:1065:13: error: ‘rtsx_comm_pm_power_saving’ defined but not used [-Werror=unused-function]
miscread001.out: static void rtsx_comm_pm_power_saving(struct rtsx_pcr *pcr)
../drivers/misc/cardreader/rtsx_pcr.c:1084:13: error: ‘rtsx_pm_power_saving’ defined but not used [-Werror=unused-function]
 static void rtsx_pm_power_saving(struct rtsx_pcr *pcr)

Use DEFINE_RUNTIME_DEV_PM_OPS() to avoid the build errors.
This eliminates the need for #ifdef CONFIG_PM/#endif blocks of code.

Fixes: 597568e8df04 ("misc: rtsx: Rework runtime power management flow")
Signed-off-by: Randy Dunlap <rdunlap@...radead.org>
Cc: Wei WANG <wei_wang@...lsil.com.cn>
Cc: Kai-Heng Feng <kai.heng.feng@...onical.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Suggested-by: Arnd Bergmann <arnd@...db.de>
---
v2: use DEFINE_RUNTIME_DEV_PM_OPS instead of #ifdef CONFIG_PM blocks or
    __maybe_unused

 drivers/misc/cardreader/rtsx_pcr.c |   16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

--- linux-next-20220225.orig/drivers/misc/cardreader/rtsx_pcr.c
+++ linux-next-20220225/drivers/misc/cardreader/rtsx_pcr.c
@@ -1699,8 +1699,6 @@ out:
 	return ret;
 }
 
-#ifdef CONFIG_PM
-
 static void rtsx_pci_shutdown(struct pci_dev *pcidev)
 {
 	struct pcr_handle *handle = pci_get_drvdata(pcidev);
@@ -1784,18 +1782,8 @@ static int rtsx_pci_runtime_resume(struc
 	return 0;
 }
 
-#else /* CONFIG_PM */
-
-#define rtsx_pci_shutdown NULL
-#define rtsx_pci_runtime_suspend NULL
-#define rtsx_pic_runtime_resume NULL
-
-#endif /* CONFIG_PM */
-
-static const struct dev_pm_ops rtsx_pci_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(rtsx_pci_suspend, rtsx_pci_resume)
-	SET_RUNTIME_PM_OPS(rtsx_pci_runtime_suspend, rtsx_pci_runtime_resume, rtsx_pci_runtime_idle)
-};
+static DEFINE_RUNTIME_DEV_PM_OPS(rtsx_pci_pm_ops, rtsx_pci_runtime_suspend,
+				rtsx_pci_runtime_resume, rtsx_pci_runtime_idle);
 
 static struct pci_driver rtsx_pci_driver = {
 	.name = DRV_NAME_RTSX_PCI,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ