adc: 当CONFIG_ADC未配置,依赖于adc的代码依然可以编译
author黄涛 <huangtao@rock-chips.com>
Tue, 7 Dec 2010 10:44:26 +0000 (18:44 +0800)
committer黄涛 <huangtao@rock-chips.com>
Tue, 7 Dec 2010 10:50:26 +0000 (18:50 +0800)
include/linux/adc.h

index 47df46e5862fece4a1e4be01dad7c8f4e0cef0f5..fcef9923f78bb0579079d31656edf19b915f3750 100755 (executable)
@@ -61,6 +61,7 @@ extern void adc_free_host(struct adc_host *adc);
 extern void adc_core_irq_handle(struct adc_host *adc);\r
 \r
 \r
+#ifdef CONFIG_ADC\r
 extern struct adc_client *adc_register(int chn,\r
                                void (*callback)(struct adc_client *, void *, int), \r
                                void *callback_param);\r
@@ -68,6 +69,17 @@ extern void adc_unregister(struct adc_client *client);
 \r
 extern int adc_sync_read(struct adc_client *client);\r
 extern int adc_async_read(struct adc_client *client);\r
+#else\r
+static inline struct adc_client *adc_register(int chn,\r
+                               void (*callback)(struct adc_client *, void *, int),\r
+                               void *callback_param)\r
+{\r
+       return NULL;\r
+}\r
+static inline void adc_unregister(struct adc_client *client) {}\r
+static inline int adc_sync_read(struct adc_client *client) { return -EINVAL; }\r
+static inline int adc_async_read(struct adc_client *client) { return -EINVAL; }\r
+#endif\r
 \r
 #endif\r
 \r