Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ebe15efd authored by Jeff Hugo's avatar Jeff Hugo
Browse files

msm: smem: Remove smem_alloc2()



smem_alloc2() is deprecated and no longer used.  Remove it.

Change-Id: I0c58c69748da4d8d124cb6016e2ae4e8d6cb90d5
Signed-off-by: default avatarJeffrey Hugo <jhugo@codeaurora.org>
parent cb01df53
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -156,7 +156,6 @@ enum {
};

#ifdef CONFIG_MSM_SMD
void *smem_alloc2(unsigned id, unsigned size_in);
void *smem_get_entry(unsigned id, unsigned *size);
void *smem_find(unsigned id, unsigned size);

@@ -183,7 +182,7 @@ void *smem_get_entry_no_rlock(unsigned id, unsigned *size_out);
/**
 * smem_virt_to_phys() - Convert SMEM address to physical address.
 *
 * @smem_address: Virtual address returned by smem_alloc()/smem_alloc2()
 * @smem_address: Virtual address returned by smem_alloc()
 * @returns: Physical address (or NULL if there is a failure)
 *
 * This function should only be used if an SMEM item needs to be handed
@@ -199,10 +198,6 @@ phys_addr_t smem_virt_to_phys(void *smem_address);
int __init msm_smem_init(void);

#else
static inline void *smem_alloc2(unsigned id, unsigned size_in)
{
	return NULL;
}
static inline void *smem_get_entry(unsigned id, unsigned *size)
{
	return NULL;
+0 −46
Original line number Diff line number Diff line
@@ -650,52 +650,6 @@ static void *alloc_item_secure(unsigned id, unsigned size_in, unsigned to_proc,
	return ret;
}

/* smem_alloc2 returns the pointer to smem item.  If it is not allocated,
 * it allocates it and then returns the pointer to it.
 */
void *smem_alloc2(unsigned id, unsigned size_in)
{
	struct smem_shared *shared = (void *) MSM_SHARED_RAM_BASE;
	struct smem_heap_entry *toc = shared->heap_toc;
	unsigned long flags;
	void *ret = NULL;
	int rc;

	if (!smem_initialized_check())
		return NULL;

	if (id >= SMEM_NUM_ITEMS) {
		SMEM_INFO("%s: invalid id %u\n", __func__, id);
		return NULL;
	}

	if (unlikely(!spinlocks_initialized)) {
		rc = init_smem_remote_spinlock();
		if (unlikely(rc)) {
			SMEM_INFO("%s: remote spinlock init failed %d\n",
								__func__, rc);
			return NULL;
		}
	}

	size_in = ALIGN(size_in, 8);
	remote_spin_lock_irqsave(&remote_spinlock, flags);
	if (toc[id].allocated) {
		SMEM_INFO("%s: %u already allocated\n", __func__, id);
		if (size_in != toc[id].size)
			SMEM_INFO("%s: wrong size %u (expected %u)\n",
				__func__, toc[id].size, size_in);
		else
			ret = (void *)(MSM_SHARED_RAM_BASE + toc[id].offset);
	} else if (id > SMEM_FIXED_ITEM_LAST) {
		SMEM_INFO("%s: allocating %u\n", __func__, id);
		ret = alloc_item_nonsecure(id, size_in);
	}
	remote_spin_unlock_irqrestore(&remote_spinlock, flags);
	return ret;
}
EXPORT_SYMBOL(smem_alloc2);

/**
 * smem_alloc - Find an existing item, otherwise allocate it with security
 *		support