[PATCH] Bluetooth: btintel_pcie: fix CONFIG_PM_SLEEP check

Arnd Bergmann posted 1 patch 2 months, 1 week ago
drivers/bluetooth/btintel_pcie.c | 2 --
1 file changed, 2 deletions(-)
[PATCH] Bluetooth: btintel_pcie: fix CONFIG_PM_SLEEP check
Posted by Arnd Bergmann 2 months, 1 week ago
From: Arnd Bergmann <arnd@arndb.de>

Using both pm_sleep_ptr() and an #ifdef around the definition is not
valid:

In file included from include/linux/kernel.h:36,
                 from drivers/bluetooth/btintel_pcie.c:9:
drivers/bluetooth/btintel_pcie.c:2674:36: error: 'btintel_pcie_pm_ops' undeclared here (not in a function); did you mean 'btintel_pcie_in_op'?
 2674 |         .driver.pm = pm_sleep_ptr(&btintel_pcie_pm_ops),
      |                                    ^~~~~~~~~~~~~~~~~~~

Remove the #ifdef check to let the compiler's dead-code-elimination drop
this as intended by pm_sleep_ptr().

Fixes: d1b3de23042b ("Bluetooth: btintel_pcie: Add support for _suspend() / _resume()")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/bluetooth/btintel_pcie.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c
index 8e65def192a9..aa47bc38d298 100644
--- a/drivers/bluetooth/btintel_pcie.c
+++ b/drivers/bluetooth/btintel_pcie.c
@@ -2574,7 +2574,6 @@ static void btintel_pcie_coredump(struct device *dev)
 }
 #endif
 
-#ifdef CONFIG_PM_SLEEP
 static int btintel_pcie_suspend_late(struct device *dev, pm_message_t mesg)
 {
 	struct pci_dev *pdev = to_pci_dev(dev);
@@ -2664,7 +2663,6 @@ static const struct dev_pm_ops btintel_pcie_pm_ops = {
 	.poweroff = btintel_pcie_hibernate,
 	.restore = btintel_pcie_resume,
 };
-#endif
 
 static struct pci_driver btintel_pcie_driver = {
 	.name = KBUILD_MODNAME,
-- 
2.39.5
Re: [PATCH] Bluetooth: btintel_pcie: fix CONFIG_PM_SLEEP check
Posted by Luiz Augusto von Dentz 2 months, 1 week ago
Hi Arnd,

On Tue, Jul 29, 2025 at 11:27 AM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> Using both pm_sleep_ptr() and an #ifdef around the definition is not
> valid:
>
> In file included from include/linux/kernel.h:36,
>                  from drivers/bluetooth/btintel_pcie.c:9:
> drivers/bluetooth/btintel_pcie.c:2674:36: error: 'btintel_pcie_pm_ops' undeclared here (not in a function); did you mean 'btintel_pcie_in_op'?
>  2674 |         .driver.pm = pm_sleep_ptr(&btintel_pcie_pm_ops),
>       |                                    ^~~~~~~~~~~~~~~~~~~
>
> Remove the #ifdef check to let the compiler's dead-code-elimination drop
> this as intended by pm_sleep_ptr().
>
> Fixes: d1b3de23042b ("Bluetooth: btintel_pcie: Add support for _suspend() / _resume()")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Ive fixed it up in place since this hasn't been merged yet, thanks.

> ---
>  drivers/bluetooth/btintel_pcie.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c
> index 8e65def192a9..aa47bc38d298 100644
> --- a/drivers/bluetooth/btintel_pcie.c
> +++ b/drivers/bluetooth/btintel_pcie.c
> @@ -2574,7 +2574,6 @@ static void btintel_pcie_coredump(struct device *dev)
>  }
>  #endif
>
> -#ifdef CONFIG_PM_SLEEP
>  static int btintel_pcie_suspend_late(struct device *dev, pm_message_t mesg)
>  {
>         struct pci_dev *pdev = to_pci_dev(dev);
> @@ -2664,7 +2663,6 @@ static const struct dev_pm_ops btintel_pcie_pm_ops = {
>         .poweroff = btintel_pcie_hibernate,
>         .restore = btintel_pcie_resume,
>  };
> -#endif
>
>  static struct pci_driver btintel_pcie_driver = {
>         .name = KBUILD_MODNAME,
> --
> 2.39.5
>


-- 
Luiz Augusto von Dentz