drivers: devfreq: Fix devfreq stub functions
Arto Merilainen [Fri, 14 Sep 2012 06:36:13 +0000 (09:36 +0300)]
This patch allows the kernel to build even if devfreq.h is included
when devfreq support is not available.

Change-Id: I01f1bdd9dda755f86255e5609c2a5411cfb64480
Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-on: http://git-master/r/132557
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: Mayuresh Kulkarni <mkulkarni@nvidia.com>

drivers/devfreq/governor.h
include/linux/devfreq.h

index ea7f13c..03ad212 100644 (file)
 
 #define to_devfreq(DEV)        container_of((DEV), struct devfreq, dev)
 
+#if defined(CONFIG_PM_DEVFREQ)
+
 /* Caution: devfreq->lock must be locked before calling update_devfreq */
 extern int update_devfreq(struct devfreq *devfreq);
 
+#else /* !CONFIG_PM_DEVFREQ */
+
+static inline int update_devfreq(struct devfreq *devfreq)
+{
+       return -EINVAL;
+}
+
+#endif /* !CONFIG_PM_DEVFREQ */
+
 #endif /* _GOVERNOR_H */
index 281c72a..8a1f3bc 100644 (file)
@@ -212,32 +212,32 @@ struct devfreq_simple_ondemand_data {
 #endif
 
 #else /* !CONFIG_PM_DEVFREQ */
-static struct devfreq *devfreq_add_device(struct device *dev,
-                                         struct devfreq_dev_profile *profile,
-                                         struct devfreq_governor *governor,
-                                         void *data)
+static inline struct devfreq *devfreq_add_device(struct device *dev,
+                                 struct devfreq_dev_profile *profile,
+                                 const struct devfreq_governor *governor,
+                                 void *data)
 {
        return NULL;
 }
 
-static int devfreq_remove_device(struct devfreq *devfreq)
+static inline int devfreq_remove_device(struct devfreq *devfreq)
 {
        return 0;
 }
 
-static struct opp *devfreq_recommended_opp(struct device *dev,
+static inline struct opp *devfreq_recommended_opp(struct device *dev,
                                           unsigned long *freq, u32 flags)
 {
-       return -EINVAL;
+       return NULL;
 }
 
-static int devfreq_register_opp_notifier(struct device *dev,
+static inline int devfreq_register_opp_notifier(struct device *dev,
                                         struct devfreq *devfreq)
 {
        return -EINVAL;
 }
 
-static int devfreq_unregister_opp_notifier(struct device *dev,
+static inline int devfreq_unregister_opp_notifier(struct device *dev,
                                           struct devfreq *devfreq)
 {
        return -EINVAL;