refactor arg checking in channel properties

although frequency and sync status are channelno-independent for LO/REF,
the enable/disable status is not. Thus, the channel number validation
must be refactored to filter out bad LO/REF channel numbers *only* in
ertm_get_output_state
parent 16b89f80
......@@ -645,10 +645,6 @@ static int ertm_get_freq_sync_out_state(struct ertm_status *handle,
uint8_t *ssreg;
int enable;
/* channel param is irrelevant for lo/ref */
if (connector == ERTM_LO || connector == ERTM_REF) {
channel = ERTM_LOREF_MIN_CH;
}
if ((err = bad_inputs(handle, connector, channel)) != 0)
return err;
......@@ -692,6 +688,11 @@ int ertm_get_freq(struct ertm_status *handle,
{
uint32_t u;
void *unused1 = &u, *unused2 = &u;
/* channel param is irrelevant for lo/ref freq */
if (connector == ERTM_LO || connector == ERTM_REF) {
channel = ERTM_LOREF_MIN_CH;
}
return ertm_get_freq_sync_out_state(handle, connector, channel,
freq, unused1, unused2);
}
......@@ -701,6 +702,11 @@ int ertm_get_sync_state(struct ertm_status *handle,
{
uint32_t u;
void *unused1 = &u, *unused2 = &u;
/* channel param is irrelevant for lo/ref sync state */
if (connector == ERTM_LO || connector == ERTM_REF) {
channel = ERTM_LOREF_MIN_CH;
}
return ertm_get_freq_sync_out_state(handle, connector, channel,
unused1, sync_state, unused2);
return 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