Commit 3ee317fe authored by Eliot Blennerhassett's avatar Eliot Blennerhassett Committed by Takashi Iwai

ALSA: asihpi - Minor code cleanup

Signed-off-by: default avatarEliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent cadae428
...@@ -347,20 +347,15 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache, ...@@ -347,20 +347,15 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache,
found = 0; found = 0;
break; break;
case HPI_CONTROL_TUNER: case HPI_CONTROL_TUNER:
{ if (phm->u.c.attribute == HPI_TUNER_FREQ)
struct hpi_control_cache_single *pCT = phr->u.c.param1 = pC->u.t.freq_ink_hz;
(struct hpi_control_cache_single *)pI; else if (phm->u.c.attribute == HPI_TUNER_BAND)
if (phm->u.c.attribute == HPI_TUNER_FREQ) phr->u.c.param1 = pC->u.t.band;
phr->u.c.param1 = pCT->u.t.freq_ink_hz; else if ((phm->u.c.attribute == HPI_TUNER_LEVEL)
else if (phm->u.c.attribute == HPI_TUNER_BAND) && (phm->u.c.param1 == HPI_TUNER_LEVEL_AVERAGE))
phr->u.c.param1 = pCT->u.t.band; phr->u.c.param1 = pC->u.t.level;
else if ((phm->u.c.attribute == HPI_TUNER_LEVEL) else
&& (phm->u.c.param1 == found = 0;
HPI_TUNER_LEVEL_AVERAGE))
phr->u.c.param1 = pCT->u.t.level;
else
found = 0;
}
break; break;
case HPI_CONTROL_AESEBU_RECEIVER: case HPI_CONTROL_AESEBU_RECEIVER:
if (phm->u.c.attribute == HPI_AESEBURX_ERRORSTATUS) if (phm->u.c.attribute == HPI_AESEBURX_ERRORSTATUS)
...@@ -503,6 +498,9 @@ void hpi_sync_control_cache(struct hpi_control_cache *p_cache, ...@@ -503,6 +498,9 @@ void hpi_sync_control_cache(struct hpi_control_cache *p_cache,
struct hpi_control_cache_single *pC; struct hpi_control_cache_single *pC;
struct hpi_control_cache_info *pI; struct hpi_control_cache_info *pI;
if (phr->error)
return;
if (!find_control(phm, p_cache, &pI, &control_index)) if (!find_control(phm, p_cache, &pI, &control_index))
return; return;
...@@ -520,8 +518,6 @@ void hpi_sync_control_cache(struct hpi_control_cache *p_cache, ...@@ -520,8 +518,6 @@ void hpi_sync_control_cache(struct hpi_control_cache *p_cache,
break; break;
case HPI_CONTROL_MULTIPLEXER: case HPI_CONTROL_MULTIPLEXER:
/* mux does not return its setting on Set command. */ /* mux does not return its setting on Set command. */
if (phr->error)
return;
if (phm->u.c.attribute == HPI_MULTIPLEXER_SOURCE) { if (phm->u.c.attribute == HPI_MULTIPLEXER_SOURCE) {
pC->u.x.source_node_type = (u16)phm->u.c.param1; pC->u.x.source_node_type = (u16)phm->u.c.param1;
pC->u.x.source_node_index = (u16)phm->u.c.param2; pC->u.x.source_node_index = (u16)phm->u.c.param2;
...@@ -529,8 +525,6 @@ void hpi_sync_control_cache(struct hpi_control_cache *p_cache, ...@@ -529,8 +525,6 @@ void hpi_sync_control_cache(struct hpi_control_cache *p_cache,
break; break;
case HPI_CONTROL_CHANNEL_MODE: case HPI_CONTROL_CHANNEL_MODE:
/* mode does not return its setting on Set command. */ /* mode does not return its setting on Set command. */
if (phr->error)
return;
if (phm->u.c.attribute == HPI_CHANNEL_MODE_MODE) if (phm->u.c.attribute == HPI_CHANNEL_MODE_MODE)
pC->u.m.mode = (u16)phm->u.c.param1; pC->u.m.mode = (u16)phm->u.c.param1;
break; break;
...@@ -545,20 +539,14 @@ void hpi_sync_control_cache(struct hpi_control_cache *p_cache, ...@@ -545,20 +539,14 @@ void hpi_sync_control_cache(struct hpi_control_cache *p_cache,
pC->u.phantom_power.state = (u16)phm->u.c.param1; pC->u.phantom_power.state = (u16)phm->u.c.param1;
break; break;
case HPI_CONTROL_AESEBU_TRANSMITTER: case HPI_CONTROL_AESEBU_TRANSMITTER:
if (phr->error)
return;
if (phm->u.c.attribute == HPI_AESEBUTX_FORMAT) if (phm->u.c.attribute == HPI_AESEBUTX_FORMAT)
pC->u.aes3tx.format = phm->u.c.param1; pC->u.aes3tx.format = phm->u.c.param1;
break; break;
case HPI_CONTROL_AESEBU_RECEIVER: case HPI_CONTROL_AESEBU_RECEIVER:
if (phr->error)
return;
if (phm->u.c.attribute == HPI_AESEBURX_FORMAT) if (phm->u.c.attribute == HPI_AESEBURX_FORMAT)
pC->u.aes3rx.source = phm->u.c.param1; pC->u.aes3rx.source = phm->u.c.param1;
break; break;
case HPI_CONTROL_SAMPLECLOCK: case HPI_CONTROL_SAMPLECLOCK:
if (phr->error)
return;
if (phm->u.c.attribute == HPI_SAMPLECLOCK_SOURCE) if (phm->u.c.attribute == HPI_SAMPLECLOCK_SOURCE)
pC->u.clk.source = (u16)phm->u.c.param1; pC->u.clk.source = (u16)phm->u.c.param1;
else if (phm->u.c.attribute == HPI_SAMPLECLOCK_SOURCE_INDEX) else if (phm->u.c.attribute == HPI_SAMPLECLOCK_SOURCE_INDEX)
...@@ -590,7 +578,7 @@ struct hpi_control_cache *hpi_alloc_control_cache(const u32 ...@@ -590,7 +578,7 @@ struct hpi_control_cache *hpi_alloc_control_cache(const u32
void hpi_free_control_cache(struct hpi_control_cache *p_cache) void hpi_free_control_cache(struct hpi_control_cache *p_cache)
{ {
if ((p_cache->init) && (p_cache->p_info)) { if (p_cache->init) {
kfree(p_cache->p_info); kfree(p_cache->p_info);
p_cache->p_info = NULL; p_cache->p_info = NULL;
p_cache->init = 0; p_cache->init = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment