linux-imx/sound/soc/intel/avs/trace.c
Amadeusz Sławiński 4a1b1b65e4
ASoC: Intel: avs: Use min_t instead of min with cast
Checkpatch script recommends using min_t instead of min with the cast.

Fixes: 69b23b3937 ("ASoC: Intel: avs: Event tracing")
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20230113190310.1451693-4-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-01-13 12:30:29 +00:00

34 lines
789 B
C

// SPDX-License-Identifier: GPL-2.0-only
//
// Copyright(c) 2021-2022 Intel Corporation. All rights reserved.
//
// Author: Cezary Rojewski <cezary.rojewski@intel.com>
// Amadeusz Slawinski <amadeuszx.slawinski@linux.intel.com>
//
#include <linux/types.h>
#define CREATE_TRACE_POINTS
#include "trace.h"
#define BYTES_PER_LINE 16
#define MAX_CHUNK_SIZE ((PAGE_SIZE - 150) /* Place for trace header */ \
/ (2 * BYTES_PER_LINE + 4) /* chars per line */ \
* BYTES_PER_LINE)
void trace_avs_msg_payload(const void *data, size_t size)
{
size_t remaining = size;
size_t offset = 0;
while (remaining > 0) {
u32 chunk;
chunk = min_t(size_t, remaining, MAX_CHUNK_SIZE);
trace_avs_ipc_msg_payload(data, chunk, offset, size);
remaining -= chunk;
offset += chunk;
}
}