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

staging: comedi: ni_tio: convert NI_660x_Source_Pin_Clock() to a macro

The BUG_ON() in this function can never happen.

For aesthetics, rename this CamelCase inline function and convert it into
a simple macro.
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>
上级 03c78671
...@@ -127,11 +127,7 @@ static inline unsigned NI_660x_RTSI_Clock(unsigned n) ...@@ -127,11 +127,7 @@ static inline unsigned NI_660x_RTSI_Clock(unsigned n)
} }
static const unsigned ni_660x_max_source_pin = 7; static const unsigned ni_660x_max_source_pin = 7;
static inline unsigned NI_660x_Source_Pin_Clock(unsigned n) #define NI_660X_SRC_PIN_CLK(x) (0x2 + (x))
{
BUG_ON(n > ni_660x_max_source_pin);
return 0x2 + n;
}
/* clock sources for ni e and m series boards, get bits with Gi_Source_Select_Bits() */ /* clock sources for ni e and m series boards, get bits with Gi_Source_Select_Bits() */
enum ni_m_series_clock_source { enum ni_m_series_clock_source {
...@@ -540,7 +536,7 @@ static unsigned ni_660x_source_select_bits(unsigned int clock_source) ...@@ -540,7 +536,7 @@ static unsigned ni_660x_source_select_bits(unsigned int clock_source)
for (i = 0; i <= ni_660x_max_source_pin; ++i) { for (i = 0; i <= ni_660x_max_source_pin; ++i) {
if (clock_select_bits == if (clock_select_bits ==
NI_GPCT_SOURCE_PIN_CLOCK_SRC_BITS(i)) { NI_GPCT_SOURCE_PIN_CLOCK_SRC_BITS(i)) {
ni_660x_clock = NI_660x_Source_Pin_Clock(i); ni_660x_clock = NI_660X_SRC_PIN_CLK(i);
break; break;
} }
} }
...@@ -822,7 +818,7 @@ static unsigned ni_660x_clock_src_select(const struct ni_gpct *counter) ...@@ -822,7 +818,7 @@ static unsigned ni_660x_clock_src_select(const struct ni_gpct *counter)
if (i <= ni_660x_max_rtsi_channel) if (i <= ni_660x_max_rtsi_channel)
break; break;
for (i = 0; i <= ni_660x_max_source_pin; ++i) { for (i = 0; i <= ni_660x_max_source_pin; ++i) {
if (input_select == NI_660x_Source_Pin_Clock(i)) { if (input_select == NI_660X_SRC_PIN_CLK(i)) {
clock_source = clock_source =
NI_GPCT_SOURCE_PIN_CLOCK_SRC_BITS(i); NI_GPCT_SOURCE_PIN_CLOCK_SRC_BITS(i);
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册