Skip to contentSkip to conversation

platform: surface: fix non-PM_SLEEP build warnings

PATCH In review Randy Dunlap 3 participants 4 messages Dec 14, 2020 – Jan 4, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 platform: surface: fix non-PM_SLEEP build warnings

Fix build warnings when CONFIG_PM_SLEEP is not enabled and these functions are not used:

../drivers/platform/surface/surface_gpe.c:189:12: warning: ‘surface_gpe_resume’ defined but not used [-Wunused-function]
static int surface_gpe_resume(struct device *dev)

            ^~~~~~~~~~~~~~~~~~
../drivers/platform/surface/surface_gpe.c:184:12: warning: ‘surface_gpe_suspend’ defined but not used [-Wunused-function]
 static int surface_gpe_suspend(struct device *dev)
            ^~~~~~~~~~~~~~~~~~~
Fixes 274335f1c557 ("platform/surface: Add Driver to set up lid GPEs on MS Surface device")
Cc Maximilian Luz <[email protected]>
Cc Hans de Goede <[email protected]>

---
v2: dropped Maximilian's RVB tag since the patch changed
use preferred __maybe_unused instead of ifdeffery:
https://lore.kernel.org/patchwork/patch/732981/

 drivers/platform/surface/surface_gpe.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/surface/surface_gpe.c +2 -2
@@ -181,12 +181,12 @@ static int surface_lid_enable_wakeup(str
 	return 0;
 }
 
-static int surface_gpe_suspend(struct device *dev)
+static int __maybe_unused surface_gpe_suspend(struct device *dev)
 {
 	return surface_lid_enable_wakeup(dev, true);
 }
 
-static int surface_gpe_resume(struct device *dev)
+static int __maybe_unused surface_gpe_resume(struct device *dev)
 {
 	return surface_lid_enable_wakeup(dev, false);
 }
maintainer Reviewed-by on v2 1/1
#1 lore raw
Quoted 31 lines · Randy Dunlap

Fix build warnings when CONFIG_PM_SLEEP is not enabled and these functions are not used:

../drivers/platform/surface/surface_gpe.c:189:12: warning: ‘surface_gpe_resume’ defined but not used [-Wunused-function]
static int surface_gpe_resume(struct device *dev)

             ^~~~~~~~~~~~~~~~~~
../drivers/platform/surface/surface_gpe.c:184:12: warning: ‘surface_gpe_suspend’ defined but not used [-Wunused-function]
  static int surface_gpe_suspend(struct device *dev)
             ^~~~~~~~~~~~~~~~~~~
Fixes 274335f1c557 ("platform/surface: Add Driver to set up lid GPEs on MS Surface device")
Cc Maximilian Luz <[email protected]>
Cc Hans de Goede <[email protected]>

---
v2: dropped Maximilian's RVB tag since the patch changed
use preferred __maybe_unused instead of ifdeffery:
https://lore.kernel.org/patchwork/patch/732981/

  drivers/platform/surface/surface_gpe.c |    4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/surface/surface_gpe.c +0 -1
@@ -181,12 +181,12 @@ static int surface_lid_enable_wakeup(str
  	return 0;
  }
 
-static int surface_gpe_suspend(struct device *dev)

drivers/platform/surface/surface_gpe.c static int surface_lid_enable_wakeup(str · line 192

Quoted 10 lines
drivers/platform/surface/surface_gpe.c +2 -1
+static int __maybe_unused surface_gpe_suspend(struct device *dev)
  {
  	return surface_lid_enable_wakeup(dev, true);
  }
 
-static int surface_gpe_resume(struct device *dev)
+static int __maybe_unused surface_gpe_resume(struct device *dev)
  {
  	return surface_lid_enable_wakeup(dev, false);
  }

Code looks good to me.

As already mentioned before, I'd prefer the subject line to be "platform/surface: gpe: ...", or at least "platform/surface: ..." for consistency with other commits. May just be a personal preference though, so nothing that should prevent it from being applied.

Thanks,
Max

#2 lore raw
Quoted 43 lines · Maximilian Luz
Quoted 29 lines · Randy Dunlap

Fix build warnings when CONFIG_PM_SLEEP is not enabled and these functions are not used:

../drivers/platform/surface/surface_gpe.c:189:12: warning: ‘surface_gpe_resume’ defined but not used [-Wunused-function] static int surface_gpe_resume(struct device *dev)
             ^~~~~~~~~~~~~~~~~~
../drivers/platform/surface/surface_gpe.c:184:12: warning: ‘surface_gpe_suspend’ defined but not used [-Wunused-function] static int surface_gpe_suspend(struct device *dev)
             ^~~~~~~~~~~~~~~~~~~

Fixes 274335f1c557 ("platform/surface: Add Driver to set up lid GPEs on MS Surface device")
Cc Maximilian Luz <[email protected]>
Cc Hans de Goede <[email protected]>

---
v2: dropped Maximilian's RVB tag since the patch changed use preferred __maybe_unused instead of ifdeffery:
       https://lore.kernel.org/patchwork/patch/732981/

  drivers/platform/surface/surface_gpe.c |    4 ++--

  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/surface/surface_gpe.c +0 -0
@@ -181,12 +181,12 @@ static int surface_lid_enable_wakeup(str
       return 0;
   }

drivers/platform/surface/surface_gpe.c static int surface_lid_enable_wakeup(str · line 192

Quoted 10 lines
drivers/platform/surface/surface_gpe.c +2 -0
   -static int surface_gpe_suspend(struct device *dev)
+static int __maybe_unused surface_gpe_suspend(struct device *dev)
   {
       return surface_lid_enable_wakeup(dev, true);
   }
   -static int surface_gpe_resume(struct device *dev)
+static int __maybe_unused surface_gpe_resume(struct device *dev)
   {
       return surface_lid_enable_wakeup(dev, false);
   }

Code looks good to me.

Quoted 7 lines

As already mentioned before, I'd prefer the subject line to be "platform/surface: gpe: ...", or at least "platform/surface: ..." for consistency with other commits. May just be a personal preference though, so nothing that should prevent it from being applied.

Ugh, sorry about that. I've changed that in the patch so if I ever resend it, it will be fixed.

Signature · 1 line
~Randy
#3 lore raw
In reply to Randy Dunlap

Hi,

Quoted 15 lines · Randy Dunlap

Fix build warnings when CONFIG_PM_SLEEP is not enabled and these functions are not used:

../drivers/platform/surface/surface_gpe.c:189:12: warning: ‘surface_gpe_resume’ defined but not used [-Wunused-function]
static int surface_gpe_resume(struct device *dev)

            ^~~~~~~~~~~~~~~~~~
../drivers/platform/surface/surface_gpe.c:184:12: warning: ‘surface_gpe_suspend’ defined but not used [-Wunused-function]
 static int surface_gpe_suspend(struct device *dev)
            ^~~~~~~~~~~~~~~~~~~
Fixes 274335f1c557 ("platform/surface: Add Driver to set up lid GPEs on MS Surface device")
Cc Maximilian Luz <[email protected]>
Cc Hans de Goede <[email protected]>
Quoted 4 lines

---
v2: dropped Maximilian's RVB tag since the patch changed
use preferred __maybe_unused instead of ifdeffery:
https://lore.kernel.org/patchwork/patch/732981/

Thank you for your patch, I've applied this patch to my review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be added to the platform-drivers-x86/for-next branch and eventually will be included in the pdx86 pull-request to Linus for the next merge-window.

Regards,

Hans

Quoted 22 lines
 drivers/platform/surface/surface_gpe.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/surface/surface_gpe.c +2 -2
@@ -181,12 +181,12 @@ static int surface_lid_enable_wakeup(str
 	return 0;
 }
 
-static int surface_gpe_suspend(struct device *dev)
+static int __maybe_unused surface_gpe_suspend(struct device *dev)
 {
 	return surface_lid_enable_wakeup(dev, true);
 }
 
-static int surface_gpe_resume(struct device *dev)
+static int __maybe_unused surface_gpe_resume(struct device *dev)
 {
 	return surface_lid_enable_wakeup(dev, false);
 }