提交 85603161 编写于 作者: H H Hartley Sweeten 提交者: Greg Kroah-Hartman

staging: comedi: ni_tio: remove unnecessary ni_gpct_variant BUG() cases

The enum ni_gpct_variant is used to handle hardware variations in the
gpct timers handled by this driver. This enum is defined as:

enum ni_gpct_variant {
	ni_gpct_variant_e_series,
	ni_gpct_variant_m_series,
	ni_gpct_variant_660x
};

For all the switch statements where all three enum values are handled,
remove the unreachable BUG(). Move the default case so it is handled
the same as ni_gpct_variant_e_series.
Signed-off-by: NH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: NIan Abbott <abbotti@mev.co.uk>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 347208ef
......@@ -58,16 +58,13 @@ Gi_Alternate_Sync_Bit(enum ni_gpct_variant variant)
{
switch (variant) {
case ni_gpct_variant_e_series:
default:
return 0;
case ni_gpct_variant_m_series:
return Gi_M_Series_Alternate_Sync_Bit;
case ni_gpct_variant_660x:
return Gi_660x_Alternate_Sync_Bit;
default:
BUG();
break;
}
return 0;
}
static inline enum Gi_Counting_Mode_Reg_Bits
......@@ -75,16 +72,13 @@ Gi_Prescale_X2_Bit(enum ni_gpct_variant variant)
{
switch (variant) {
case ni_gpct_variant_e_series:
default:
return 0;
case ni_gpct_variant_m_series:
return Gi_M_Series_Prescale_X2_Bit;
case ni_gpct_variant_660x:
return Gi_660x_Prescale_X2_Bit;
default:
BUG();
break;
}
return 0;
}
static inline enum Gi_Counting_Mode_Reg_Bits
......@@ -92,16 +86,13 @@ Gi_Prescale_X8_Bit(enum ni_gpct_variant variant)
{
switch (variant) {
case ni_gpct_variant_e_series:
default:
return 0;
case ni_gpct_variant_m_series:
return Gi_M_Series_Prescale_X8_Bit;
case ni_gpct_variant_660x:
return Gi_660x_Prescale_X8_Bit;
default:
BUG();
break;
}
return 0;
}
static inline enum Gi_Counting_Mode_Reg_Bits
......@@ -109,16 +100,13 @@ Gi_HW_Arm_Select_Mask(enum ni_gpct_variant variant)
{
switch (variant) {
case ni_gpct_variant_e_series:
default:
return 0;
case ni_gpct_variant_m_series:
return Gi_M_Series_HW_Arm_Select_Mask;
case ni_gpct_variant_660x:
return Gi_660x_HW_Arm_Select_Mask;
default:
BUG();
break;
}
return 0;
}
/* clock sources for ni_660x boards, get bits with Gi_Source_Select_Bits() */
......@@ -304,15 +292,12 @@ ni_tio_second_gate_registers_present(const struct ni_gpct_device *counter_dev)
{
switch (counter_dev->variant) {
case ni_gpct_variant_e_series:
default:
return 0;
case ni_gpct_variant_m_series:
case ni_gpct_variant_660x:
return 1;
default:
BUG();
break;
}
return 0;
}
static void ni_tio_reset_count_and_disarm(struct ni_gpct *counter)
......@@ -704,12 +689,10 @@ static int ni_tio_set_clock_src(struct ni_gpct *counter,
break;
case ni_gpct_variant_e_series:
case ni_gpct_variant_m_series:
default:
input_select_bits |=
ni_m_series_source_select_bits(clock_source);
break;
default:
BUG();
break;
}
if (clock_source & NI_GPCT_INVERT_CLOCK_SRC_BIT)
input_select_bits |= Gi_Source_Polarity_Bit;
......@@ -891,14 +874,11 @@ static unsigned ni_tio_generic_clock_src_select(const struct ni_gpct *counter)
switch (counter->counter_dev->variant) {
case ni_gpct_variant_e_series:
case ni_gpct_variant_m_series:
default:
return ni_m_series_clock_src_select(counter);
case ni_gpct_variant_660x:
return ni_660x_clock_src_select(counter);
default:
BUG();
break;
}
return 0;
}
static uint64_t ni_tio_clock_period_ps(const struct ni_gpct *counter,
......@@ -1174,12 +1154,10 @@ int ni_tio_set_gate_src(struct ni_gpct *counter, unsigned gate_index,
switch (counter_dev->variant) {
case ni_gpct_variant_e_series:
case ni_gpct_variant_m_series:
default:
return ni_m_series_set_first_gate(counter, gate_source);
case ni_gpct_variant_660x:
return ni_660x_set_first_gate(counter, gate_source);
default:
BUG();
break;
}
break;
case 1:
......@@ -1415,6 +1393,7 @@ static int ni_tio_get_gate_src(struct ni_gpct *counter, unsigned gate_index,
switch (counter_dev->variant) {
case ni_gpct_variant_e_series:
case ni_gpct_variant_m_series:
default:
*gate_source =
ni_m_series_first_gate_to_generic_gate_source
(gate_select_bits);
......@@ -1424,9 +1403,6 @@ static int ni_tio_get_gate_src(struct ni_gpct *counter, unsigned gate_index,
ni_660x_first_gate_to_generic_gate_source
(gate_select_bits);
break;
default:
BUG();
break;
}
if (mode_bits & Gi_Gate_Polarity_Bit)
*gate_source |= CR_INVERT;
......@@ -1448,6 +1424,7 @@ static int ni_tio_get_gate_src(struct ni_gpct *counter, unsigned gate_index,
switch (counter_dev->variant) {
case ni_gpct_variant_e_series:
case ni_gpct_variant_m_series:
default:
*gate_source =
ni_m_series_second_gate_to_generic_gate_source
(gate_select_bits);
......@@ -1457,9 +1434,6 @@ static int ni_tio_get_gate_src(struct ni_gpct *counter, unsigned gate_index,
ni_660x_second_gate_to_generic_gate_source
(gate_select_bits);
break;
default:
BUG();
break;
}
if (counter_dev->regs[second_gate_reg] &
Gi_Second_Gate_Polarity_Bit) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册