arm: msm: smd: use either package v3 or v4 not both

This modifies SMD to use either the package v3 or package v4,
but not both. The current code tries to allocate as v4 on all
system which can produce a scary looking error message on boot up,

smem_find(16, 40): wrong size 16424
smd_alloc_channel() cid=02 size=08192 'SMD_RPCCALL'

With this error the code then falls back on the package v3 allocation
method. This method is inefficient because it causes a slow down
on some systems even when the allocation method can be determined
at compile time. It also causes a kernel size increase that effects
all system and is not needed.

This change corrects the allocation to use one method or the other
and not both.

Signed-off-by: Daniel Walker <c_dwalke@quicinc.com>
This commit is contained in:
Daniel Walker
2010-03-16 16:29:44 -07:00
committed by Daniel Walker
parent 79848a2a73
commit bf83de4037
3 changed files with 78 additions and 48 deletions

View File

@@ -605,48 +605,6 @@ static int smd_packet_read(smd_channel_t *ch, void *data, int len)
return r;
}
static int smd_alloc_v2(struct smd_channel *ch)
{
struct smd_shared_v2 *shared2;
void *buffer;
unsigned buffer_sz;
shared2 = smem_alloc(SMEM_SMD_BASE_ID + ch->n, sizeof(*shared2));
buffer = smem_item(SMEM_SMD_FIFO_BASE_ID + ch->n, &buffer_sz);
if (!buffer)
return -1;
/* buffer must be a power-of-two size */
if (buffer_sz & (buffer_sz - 1))
return -1;
buffer_sz /= 2;
ch->send = &shared2->ch0;
ch->recv = &shared2->ch1;
ch->send_data = buffer;
ch->recv_data = buffer + buffer_sz;
ch->fifo_size = buffer_sz;
return 0;
}
static int smd_alloc_v1(struct smd_channel *ch)
{
struct smd_shared_v1 *shared1;
shared1 = smem_alloc(ID_SMD_CHANNELS + ch->n, sizeof(*shared1));
if (!shared1) {
pr_err("smd_alloc_channel() cid %d does not exist\n", ch->n);
return -1;
}
ch->send = &shared1->ch0;
ch->recv = &shared1->ch1;
ch->send_data = shared1->data0;
ch->recv_data = shared1->data1;
ch->fifo_size = SMD_BUF_SIZE;
return 0;
}
static int smd_alloc_channel(const char *name, uint32_t cid, uint32_t type)
{
struct smd_channel *ch;
@@ -658,7 +616,7 @@ static int smd_alloc_channel(const char *name, uint32_t cid, uint32_t type)
}
ch->n = cid;
if (smd_alloc_v2(ch) && smd_alloc_v1(ch)) {
if (_smd_alloc_channel(ch)) {
kfree(ch);
return -1;
}