Browse Source

asoc: lahaina: Fix compilation issues when DEBUG_FS is disabled

Fix the compilation issues in audio drivers when CONFIG_DEBUG_FS
is disabled.

Change-Id: I6eeb2b36b054ba30431f7b045c182888997dc331
Signed-off-by: Prakruthi Deepak Heragu <[email protected]>
Prakruthi Deepak Heragu 5 years ago
parent
commit
6b2d8c3234

+ 4 - 1
dsp/codecs/audio_alac.c

@@ -10,6 +10,7 @@
 static struct miscdevice audio_alac_misc;
 static struct ws_mgr audio_alac_ws_mgr;
 
+#ifdef CONFIG_DEBUG_FS
 static const struct file_operations audio_alac_debug_fops = {
 	.read = audio_aio_debug_read,
 	.open = audio_aio_debug_open,
@@ -20,7 +21,7 @@ static struct dentry *config_debugfs_create_file(const char *name, void *data)
 	return debugfs_create_file(name, S_IFREG | 0444,
 				NULL, (void *)data, &audio_alac_debug_fops);
 }
-
+#endif
 static int alac_channel_map(u8 *channel_mapping, uint32_t channels);
 
 static long audio_ioctl_shared(struct file *file, unsigned int cmd,
@@ -323,6 +324,7 @@ static int audio_open(struct inode *inode, struct file *file)
 	}
 
 	snprintf(name, sizeof(name), "msm_alac_%04x", audio->ac->session);
+#ifdef CONFIG_DEBUG_FS
 	audio->dentry = config_debugfs_create_file(name, (void *)audio);
 
 	if (IS_ERR_OR_NULL(audio->dentry))
@@ -330,6 +332,7 @@ static int audio_open(struct inode *inode, struct file *file)
 	pr_debug("%s:alacdec success mode[%d]session[%d]\n", __func__,
 						audio->feedback,
 						audio->ac->session);
+#endif
 	return rc;
 fail:
 	q6asm_audio_client_free(audio->ac);

+ 4 - 2
dsp/codecs/audio_ape.c

@@ -9,7 +9,7 @@
 
 static struct miscdevice audio_ape_misc;
 static struct ws_mgr audio_ape_ws_mgr;
-
+#ifdef CONFIG_DEBUG_FS
 static const struct file_operations audio_ape_debug_fops = {
 	.read = audio_aio_debug_read,
 	.open = audio_aio_debug_open,
@@ -19,7 +19,7 @@ static struct dentry *config_debugfs_create_file(const char *name, void *data)
 	return debugfs_create_file(name, S_IFREG | 0444,
 			NULL, (void *)data, &audio_ape_debug_fops);
 }
-
+#endif
 static long audio_ioctl_shared(struct file *file, unsigned int cmd,
 						void *arg)
 {
@@ -305,6 +305,7 @@ static int audio_open(struct inode *inode, struct file *file)
 	}
 
 	snprintf(name, sizeof(name), "msm_ape_%04x", audio->ac->session);
+#ifdef CONFIG_DEBUG_FS
 	audio->dentry = config_debugfs_create_file(name, (void *)audio);
 
 	if (IS_ERR_OR_NULL(audio->dentry))
@@ -312,6 +313,7 @@ static int audio_open(struct inode *inode, struct file *file)
 	pr_debug("%s:apedec success mode[%d]session[%d]\n", __func__,
 						audio->feedback,
 						audio->ac->session);
+#endif
 	return rc;
 fail:
 	q6asm_audio_client_free(audio->ac);

+ 4 - 0
dsp/codecs/audio_g711alaw.c

@@ -10,6 +10,7 @@
 static struct miscdevice audio_g711alaw_misc;
 static struct ws_mgr audio_g711_ws_mgr;
 
+#ifdef CONFIG_DEBUG_FS
 static const struct file_operations audio_g711_debug_fops = {
 	.read = audio_aio_debug_read,
 	.open = audio_aio_debug_open,
@@ -20,6 +21,7 @@ static struct dentry *config_debugfs_create_file(const char *name, void *data)
 	return debugfs_create_file(name, S_IFREG | 0444,
 				NULL, (void *)data, &audio_g711_debug_fops);
 }
+#endif
 
 static int g711_channel_map(u8 *channel_mapping, uint32_t channels);
 
@@ -278,6 +280,7 @@ static int audio_open(struct inode *inode, struct file *file)
 	}
 
 	snprintf(name, sizeof(name), "msm_g711_%04x", audio->ac->session);
+#ifdef CONFIG_DEBUG_FS
 	audio->dentry = config_debugfs_create_file(name, (void *)audio);
 
 	if (IS_ERR_OR_NULL(audio->dentry))
@@ -285,6 +288,7 @@ static int audio_open(struct inode *inode, struct file *file)
 	pr_debug("%s: g711dec success mode[%d]session[%d]\n", __func__,
 						audio->feedback,
 						audio->ac->session);
+#endif
 	return rc;
 fail:
 	q6asm_audio_client_free(audio->ac);

+ 4 - 1
dsp/codecs/audio_g711mlaw.c

@@ -10,6 +10,7 @@
 static struct miscdevice audio_g711mlaw_misc;
 static struct ws_mgr audio_g711_ws_mgr;
 
+#ifdef CONFIG_DEBUG_FS
 static const struct file_operations audio_g711_debug_fops = {
 	.read = audio_aio_debug_read,
 	.open = audio_aio_debug_open,
@@ -20,7 +21,7 @@ static struct dentry *config_debugfs_create_file(const char *name, void *data)
 	return debugfs_create_file(name, S_IFREG | 0444,
 				NULL, (void *)data, &audio_g711_debug_fops);
 }
-
+#endif
 static int g711_channel_map(u8 *channel_mapping, uint32_t channels);
 
 static long audio_ioctl_shared(struct file *file, unsigned int cmd,
@@ -277,6 +278,7 @@ static int audio_open(struct inode *inode, struct file *file)
 	}
 
 	snprintf(name, sizeof(name), "msm_g711_%04x", audio->ac->session);
+#ifdef CONFIG_DEBUG_FS
 	audio->dentry = config_debugfs_create_file(name, (void *)audio);
 
 	if (IS_ERR_OR_NULL(audio->dentry))
@@ -284,6 +286,7 @@ static int audio_open(struct inode *inode, struct file *file)
 	pr_debug("%s: g711dec success mode[%d]session[%d]\n", __func__,
 						audio->feedback,
 						audio->ac->session);
+#endif
 	return rc;
 fail:
 	q6asm_audio_client_free(audio->ac);

+ 10 - 0
dsp/codecs/audio_utils_aio.h

@@ -218,4 +218,14 @@ int enable_volume_ramp(struct q6audio_aio *audio);
 int audio_aio_debug_open(struct inode *inode, struct file *file);
 ssize_t audio_aio_debug_read(struct file *file, char __user *buf,
 			size_t count, loff_t *ppos);
+#else
+static inline int audio_aio_debug_open(struct inode *inode, struct file *file)
+{
+       return 0;
+}
+static inline ssize_t audio_aio_debug_read(struct file *file, char __user *buf,
+                       size_t count, loff_t *ppos)
+{
+       return 0;
+}
 #endif

+ 27 - 29
dsp/q6asm.c

@@ -145,24 +145,6 @@ struct generic_get_data_ {
 };
 static struct generic_get_data_ *generic_get_data;
 
-#ifdef CONFIG_DEBUG_FS
-#define OUT_BUFFER_SIZE 56
-#define IN_BUFFER_SIZE 24
-
-static struct timeval out_cold_tv;
-static struct timeval out_warm_tv;
-static struct timeval out_cont_tv;
-static struct timeval in_cont_tv;
-static long out_enable_flag;
-static long in_enable_flag;
-static struct dentry *out_dentry;
-static struct dentry *in_dentry;
-static int in_cont_index;
-/*This var is used to keep track of first write done for cold output latency */
-static int out_cold_index;
-static char *out_buffer;
-static char *in_buffer;
-
 static uint32_t adsp_reg_event_opcode[] = {
 	ASM_STREAM_CMD_REGISTER_PP_EVENTS,
 	ASM_STREAM_CMD_REGISTER_ENCDEC_EVENTS,
@@ -194,7 +176,6 @@ static int is_adsp_raise_event(uint32_t cmd)
 	}
 	return -EINVAL;
 }
-
 static inline void q6asm_set_flag_in_token(union asm_token_struct *asm_token,
 					   int flag, int flag_offset)
 {
@@ -202,12 +183,6 @@ static inline void q6asm_set_flag_in_token(union asm_token_struct *asm_token,
 		ASM_SET_BIT(asm_token->_token.flags, flag_offset);
 }
 
-static inline int q6asm_get_flag_from_token(union asm_token_struct *asm_token,
-					    int flag_offset)
-{
-	return ASM_TEST_BIT(asm_token->_token.flags, flag_offset);
-}
-
 static inline void q6asm_update_token(u32 *token, u8 session_id, u8 stream_id,
 				      u8 buf_index, u8 dir, u8 nowait_flag)
 {
@@ -222,7 +197,6 @@ static inline void q6asm_update_token(u32 *token, u8 session_id, u8 stream_id,
 				  ASM_CMD_NO_WAIT_OFFSET);
 	*token = asm_token.token;
 }
-
 static inline uint32_t q6asm_get_pcm_format_id(uint32_t media_format_block_ver)
 {
 	uint32_t pcm_format_id;
@@ -244,7 +218,6 @@ static inline uint32_t q6asm_get_pcm_format_id(uint32_t media_format_block_ver)
 	}
 	return pcm_format_id;
 }
-
 /*
  * q6asm_get_buf_index_from_token:
  *       Retrieve buffer index from token.
@@ -260,7 +233,6 @@ uint8_t q6asm_get_buf_index_from_token(uint32_t token)
 	return asm_token._token.buf_index;
 }
 EXPORT_SYMBOL(q6asm_get_buf_index_from_token);
-
 /*
  * q6asm_get_stream_id_from_token:
  *       Retrieve stream id from token.
@@ -277,6 +249,31 @@ uint8_t q6asm_get_stream_id_from_token(uint32_t token)
 }
 EXPORT_SYMBOL(q6asm_get_stream_id_from_token);
 
+static inline int q6asm_get_flag_from_token(union asm_token_struct *asm_token,
+					    int flag_offset)
+{
+	return ASM_TEST_BIT(asm_token->_token.flags, flag_offset);
+}
+
+
+#ifdef CONFIG_DEBUG_FS
+#define OUT_BUFFER_SIZE 56
+#define IN_BUFFER_SIZE 24
+
+static struct timeval out_cold_tv;
+static struct timeval out_warm_tv;
+static struct timeval out_cont_tv;
+static struct timeval in_cont_tv;
+static long out_enable_flag;
+static long in_enable_flag;
+static struct dentry *out_dentry;
+static struct dentry *in_dentry;
+static int in_cont_index;
+/*This var is used to keep track of first write done for cold output latency */
+static int out_cold_index;
+static char *out_buffer;
+static char *in_buffer;
+
 static int audio_output_latency_dbgfs_open(struct inode *inode,
 							struct file *file)
 {
@@ -553,7 +550,8 @@ static void config_debug_fs_write_cb(void)
 static void config_debug_fs_init(void)
 {
 }
-#endif
+
+#endif /*CONFIG_DEBUG_FS*/
 
 int q6asm_mmap_apr_dereg(void)
 {

+ 4 - 2
ipc/apr.c

@@ -1117,9 +1117,9 @@ static int __init apr_debug_init(void)
 }
 #else
 static int __init apr_debug_init(void)
-(
+{
 	return 0;
-)
+}
 #endif
 
 static void apr_cleanup(void)
@@ -1140,7 +1140,9 @@ static void apr_cleanup(void)
 				mutex_destroy(&client[i][j].svc[k].m_lock);
 		}
 	}
+#ifdef CONFIG_DEBUG_FS
 	debugfs_remove(debugfs_apr_debug);
+#endif
 }
 
 static int apr_probe(struct platform_device *pdev)