/* To be used by smem clients as a quick way to determine if any new allocations has been made.  */
static int qcom_smem_get_free_space(unsigned int host)
/* To be used by smem clients as a quick way to determine if any new allocations has been made.  */
static int qcom_smem_get_free_space(unsigned int host)
{
	struct smem_partition_header *phdr;
	struct smem_header *header;
	unsigned int ret;
	if (!__smem)
		return -EPROBE_DEFER;
	if (host < SMEM_HOST_COUNT && __smem->partitions[host]) {
		phdr = __smem->partitions[host];
		ret = le32_to_cpu(phdr->offset_free_cached) -
		      le32_to_cpu(phdr->offset_free_uncached);
	} else if (__smem->global_partition) {
		phdr = __smem->global_partition;
		ret = le32_to_cpu(phdr->offset_free_cached) -
		      le32_to_cpu(phdr->offset_free_uncached);
	} else {
		header = __smem->regions[0].virt_base;
		ret = le32_to_cpu(header->available);
	}
	return ret;
}