[PATCH 09/40] staging: comedi: ni_tio: convert NI_M_Series_PFI_Clock() to a macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/ni_tio.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_tio.c b/drivers/staging/comedi/drivers/ni_tio.c
index e1d7d4e..e6b8134 100644
--- a/drivers/staging/comedi/drivers/ni_tio.c
+++ b/drivers/staging/comedi/drivers/ni_tio.c
@@ -146,12 +146,7 @@ enum ni_m_series_clock_source {
 	NI_M_Series_Logic_Low_Clock = 0x1f,
 };
 static const unsigned ni_m_series_max_pfi_channel = 15;
-static inline unsigned NI_M_Series_PFI_Clock(unsigned n)
-{
-	BUG_ON(n > ni_m_series_max_pfi_channel);
-
-	return (n < 10) ? (1 + n) : (0xb + n);
-}
+#define NI_M_PFI_CLK(x)			(((x) < 10) ? (1 + (x)) : (0xb + (x)))
 
 static const unsigned ni_m_series_max_rtsi_channel = 7;
 #define NI_M_RTSI_CLK(x)		(((x) == 7) ? 0x1b : (0xb + (x)))
@@ -625,7 +620,7 @@ static unsigned ni_m_series_source_select_bits(unsigned int clock_source)
 			break;
 		for (i = 0; i <= ni_m_series_max_pfi_channel; ++i) {
 			if (clock_select_bits == NI_GPCT_PFI_CLOCK_SRC_BITS(i)) {
-				ni_m_series_clock = NI_M_Series_PFI_Clock(i);
+				ni_m_series_clock = NI_M_PFI_CLK(i);
 				break;
 			}
 		}
@@ -794,7 +789,7 @@ static unsigned ni_m_series_clock_src_select(const struct ni_gpct *counter)
 		if (i <= ni_m_series_max_rtsi_channel)
 			break;
 		for (i = 0; i <= ni_m_series_max_pfi_channel; ++i) {
-			if (input_select == NI_M_Series_PFI_Clock(i)) {
+			if (input_select == NI_M_PFI_CLK(i)) {
 				clock_source = NI_GPCT_PFI_CLOCK_SRC_BITS(i);
 				break;
 			}
-- 
1.9.3

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux