Skip to contentSkip to conversation

drm/vc4: Do not call pm functions if CONFIG_PM_SLEEP is not configured

PATCH New Guenter Roeck 1 participant 1 message Jan 9, 2016

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

PATCH 1/1 drm/vc4: Do not call pm functions if CONFIG_PM_SLEEP is not configured

If CONFIG_PM_SLEEP is not configured, the build fails with

include/linux/pm.h:776:30: note: in expansion of macro 'NULL'
#define pm_generic_poweroff NULL

drivers/gpu/drm/vc4/vc4_v3d.c:157:10: note:
in expansion of macro 'pm_generic_poweroff'
return pm_generic_poweroff(&vc4->v3d->pdev->dev);

pm_generic_poweroff and pm_generic_resume are defined as NULL if CONFIG_PM_SLEEP is not configured and can therefore not be called in that case. Create a wrapper for the calling function to solve the problem.

Fixes d5b1a78a772f1 ("drm/vc4: Add support for drawing 3D frames.")
Cc Eric Anholt <[email protected]>
---
 drivers/gpu/drm/vc4/vc4_drv.h | 8 ++++++++
 drivers/gpu/drm/vc4/vc4_v3d.c | 4 ++++
 2 files changed, 12 insertions(+)
drivers/gpu/drm/vc4/vc4_drv.h +8 -0
index 080865ec2bae..5948e2b1b7d9 100644
@@ -434,7 +434,15 @@ void vc4_plane_async_set_fb(struct drm_plane *plane,
 extern struct platform_driver vc4_v3d_driver;
 int vc4_v3d_debugfs_ident(struct seq_file *m, void *unused);
 int vc4_v3d_debugfs_regs(struct seq_file *m, void *unused);
+
+#ifdef CONFIG_PM_SLEEP
 int vc4_v3d_set_power(struct vc4_dev *vc4, bool on);
+#else
+static inline int vc4_v3d_set_power(struct vc4_dev *vc4, bool on)
+{
+	return 0;
+}
+#endif
 
 /* vc4_validate.c */
 int
drivers/gpu/drm/vc4/vc4_v3d.c +4 -0
index 424d515ffcda..4789de303f2f 100644
@@ -150,6 +150,8 @@ int vc4_v3d_debugfs_ident(struct seq_file *m, void *unused)
  * This may be doable with just the clocks interface, though this
  * packet does some other register setup from the firmware, too.
  */
+#ifdef CONFIG_PM_SLEEP
+
 int
 vc4_v3d_set_power(struct vc4_dev *vc4, bool on)
 {
@@ -159,6 +161,8 @@ vc4_v3d_set_power(struct vc4_dev *vc4, bool on)
 		return pm_generic_resume(&vc4->v3d->pdev->dev);
 }
 
+#endif /* CONFIG_PM_SLEEP */
+
 static void vc4_v3d_init_hw(struct drm_device *dev)
 {
 	struct vc4_dev *vc4 = to_vc4_dev(dev);
Signature · 1 line
2.1.4