void diag_mask_update_fn(struct work_struct *work)
{
	struct diag_smd_info *smd_info = container_of(work,
						struct diag_smd_info,
						diag_notify_update_smd_work);
	if (!smd_info) {
		pr_err("diag: In %s, smd info is null, cannot update masks for the peripheral\n",
			__func__);
		return;
	}

	diag_send_feature_mask_update(smd_info);
	diag_send_msg_mask_update(smd_info, ALL_SSID, ALL_SSID);
	diag_send_log_mask_update(smd_info, ALL_EQUIP_ID);
	diag_send_event_mask_update(smd_info);

	if (smd_info->notify_context == SMD_EVENT_OPEN) {
		diag_send_diag_mode_update_by_smd(smd_info,
				driver->real_time_mode[DIAG_LOCAL_PROC]);
		diag_send_peripheral_buffering_mode(
				&driver->buffering_mode[smd_info->peripheral]);
	}

	smd_info->notify_context = 0;
}
void diag_mask_update_fn(struct work_struct *work)
{
	struct diag_smd_info *smd_info = container_of(work,
						struct diag_smd_info,
						diag_notify_update_smd_work);
	if (!smd_info) {
		pr_err("diag: In %s, smd info is null, cannot update masks for the peripheral\n",
			__func__);
		return;
	}

	diag_send_msg_mask_update(smd_info->ch, ALL_SSID, ALL_SSID,
						smd_info->peripheral);
	diag_send_log_mask_update(smd_info->ch, ALL_EQUIP_ID);
	diag_send_event_mask_update(smd_info->ch, diag_event_num_bytes);
	diag_send_feature_mask_update(smd_info->ch, smd_info->peripheral);

	smd_info->notify_context = 0;
}
void diag_mask_update_fn(struct work_struct *work)
{
	static int smd_channel_count = 0;

	struct diag_smd_info *smd_info = container_of(work,
						struct diag_smd_info,
						diag_notify_update_smd_work);
	if (!smd_info) {
		pr_err("diag: In %s, smd info is null, cannot update masks for the peripheral\n",
			__func__);
		return;
	}

	diag_send_feature_mask_update(smd_info);
	diag_send_msg_mask_update(smd_info, ALL_SSID, ALL_SSID,
						smd_info->peripheral);
	diag_send_log_mask_update(smd_info, ALL_EQUIP_ID);
	diag_send_event_mask_update(smd_info, diag_event_num_bytes);

	if (smd_info->notify_context == SMD_EVENT_OPEN) {
		/* we have to set non-optimized before setting optimized,
		 * otherwise optimized won't work as expected.
		 */
		pr_debug("diag: %s, optimized = %d, cmd_cached = %d\n",
			__func__, optimized_logging, optimized_cmd_cached);
		diag_send_diag_mode_update_by_smd(smd_info,
						driver->real_time_mode);

		/* optimized */
		smd_channel_count++;
		if (smd_channel_count == 3)
			smd_opened = 1;
		if (optimized_logging && optimized_cmd_cached && smd_opened)
			diag_send_diag_mode_update(MODE_NONREALTIME);
	}

	smd_info->notify_context = 0;
}