Browse Source

ASoC: limit error log print rate

Limit error log print rate to avoid crash.

Change-Id: I76ff715cb98a19d2885ca89d281a882a898a8264
Signed-off-by: xsang <xsang@codeaurora.org>
xsang 4 years ago
parent
commit
1513b912b3
3 changed files with 10 additions and 9 deletions
  1. 6 6
      dsp/q6afe.c
  2. 2 2
      dsp/q6asm.c
  3. 2 1
      ipc/apr_tal_rpmsg.c

+ 6 - 6
dsp/q6afe.c

@@ -2379,8 +2379,8 @@ static int afe_spk_prot_prepare(int src_port, int dst_port, int param_id,
 					       q6audio_get_port_index(src_port),
 					       param_info, (u8 *) prot_config);
 	if (ret)
-		pr_err("%s: port = 0x%x param = 0x%x failed %d\n", __func__,
-		       src_port, param_id, ret);
+		pr_err_ratelimited("%s: port = 0x%x param = 0x%x failed %d\n",
+					__func__, src_port, param_id, ret);
 
 fail_cmd:
 	pr_debug("%s: config.pdata.param_id 0x%x status %d 0x%x\n", __func__,
@@ -2994,7 +2994,7 @@ static int afe_send_hw_delay(u16 port_id, u32 rate)
 					       q6audio_get_port_index(port_id),
 					       param_info, (u8 *) &hw_delay);
 	if (ret)
-		pr_err("%s: AFE hw delay for port 0x%x failed %d\n",
+		pr_err_ratelimited("%s: AFE hw delay for port 0x%x failed %d\n",
 		       __func__, port_id, ret);
 
 fail_cmd:
@@ -3079,7 +3079,7 @@ static int afe_get_cal_topology_id(u16 port_id, u32 *topology_id,
 	cal_block = afe_find_cal_topo_id_by_port(
 		this_afe.cal_data[cal_type_index], port_id);
 	if (cal_block == NULL) {
-		pr_err("%s: cal_type %d not initialized for this port %d\n",
+		pr_err_ratelimited("%s: cal_type %d not initialized for this port %d\n",
 			__func__, cal_type_index, port_id);
 		ret = -EINVAL;
 		goto unlock;
@@ -3596,7 +3596,7 @@ static int send_afe_cal_type(int cal_index, int port_id)
 				this_afe.cal_data[cal_index]);
 
 	if (cal_block == NULL || cal_utils_is_cal_stale(cal_block)) {
-		pr_err("%s cal_block not found!!\n", __func__);
+		pr_err_ratelimited("%s cal_block not found!!\n", __func__);
 		ret = -EINVAL;
 		goto unlock;
 	}
@@ -5860,7 +5860,7 @@ static int __afe_port_start(u16 port_id, union afe_port_config *afe_config,
 					       q6audio_get_port_index(port_id),
 					       param_hdr, (u8 *) &port_cfg);
 	if (ret) {
-		pr_err("%s: AFE enable for port 0x%x failed %d\n",
+		pr_err_ratelimited("%s: AFE enable for port 0x%x failed %d\n",
 			__func__, port_id, ret);
 		goto fail_cmd;
 	}

+ 2 - 2
dsp/q6asm.c

@@ -4463,7 +4463,7 @@ int q6asm_open_shared_io(struct audio_client *ac,
 
 	rc = apr_send_pkt(ac->apr, (uint32_t *) open);
 	if (rc < 0) {
-		pr_err("%s: Open failed op[0x%x]rc[%d]\n",
+		pr_err_ratelimited("%s: Open failed op[0x%x]rc[%d]\n",
 		       __func__, open->hdr.opcode, rc);
 		goto done;
 	}
@@ -10398,7 +10398,7 @@ static int __q6asm_cmd(struct audio_client *ac, int cmd, uint32_t stream_id)
 			hdr.opcode);
 	rc = apr_send_pkt(ac->apr, (uint32_t *) &hdr);
 	if (rc < 0) {
-		pr_err("%s: Commmand 0x%x failed %d\n",
+		pr_err_ratelimited("%s: Commmand 0x%x failed %d\n",
 				__func__, hdr.opcode, rc);
 		rc = -EINVAL;
 		goto fail_cmd;

+ 2 - 1
ipc/apr_tal_rpmsg.c

@@ -58,7 +58,8 @@ int apr_tal_write(struct apr_svc_ch_dev *apr_ch, void *data,
 	spin_unlock_irqrestore(&apr_ch->w_lock, flags);
 
 	if (rc)
-		pr_err("%s: Unable to send the packet, rc:%d\n", __func__, rc);
+		pr_err_ratelimited("%s: Unable to send the packet, rc:%d\n",
+					__func__, rc);
 	else
 		rc = len;