diff mbox

[-next] drm/vc4: Do not call pm functions if CONFIG_PM_SLEEP is not configured

Message ID 1452363214-969-1-git-send-email-linux@roeck-us.net (mailing list archive)
State New, archived
Headers show

Commit Message

Guenter Roeck Jan. 9, 2016, 6:13 p.m. UTC
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 <eric@anholt.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/gpu/drm/vc4/vc4_drv.h | 8 ++++++++
 drivers/gpu/drm/vc4/vc4_v3d.c | 4 ++++
 2 files changed, 12 insertions(+)
diff mbox

Patch

diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
index 080865ec2bae..5948e2b1b7d9 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -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
diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c
index 424d515ffcda..4789de303f2f 100644
--- a/drivers/gpu/drm/vc4/vc4_v3d.c
+++ b/drivers/gpu/drm/vc4/vc4_v3d.c
@@ -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);