Skip to content

Commit 4d41a49

Browse files
ian-abbottgregkh
authored andcommitted
comedi: ni_*: do not declare unused variable range_ni_E_ao_ext
Mirsad Todorovac reported a compiler warning in "ni_stc.h" due to the variable `range_ni_E_ao_ext` being defined but unused when building the "ni_routes_test" module. The `range_ni_E_ao_ext` variable is tentatively defined in "ni_stc.h" (with internal linkage) and fully defined in "ni_mio_common.c". "ni_stc.h" and/or "ni_mio_common.c" are included by the "ni_atmio", "ni_pcimio", "ni_mio_cs", and "ni_routes_test" modules, which will each get their own local `range_ni_E_ao_ext` variable defined. However, it is not used by the "ni_mio_cs" or "ni_routes_test" modules. They should get optimized out, but there are compiler warnings about the unused variable when built with the `W=1` option. Move the full definition of the variable from "ni_mio_common.c" into the places where it is used, namely "ni_atmio.c" and "ni_pcimio.c", and remove the tentative definition of the variable from "ni_stc.h". This fixes the compiler warnings. Reported-by: Mirsad Todorovac <[email protected]> Link: https://lore.kernel.org/lkml/[email protected]/ Cc: Mirsad Todorovac <[email protected]> Signed-off-by: Ian Abbott <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 8400291 commit 4d41a49

File tree

4 files changed

+18
-11
lines changed

4 files changed

+18
-11
lines changed

drivers/comedi/drivers/ni_atmio.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,15 @@
7979

8080
#include "ni_stc.h"
8181

82+
static const struct comedi_lrange range_ni_E_ao_ext = {
83+
4, {
84+
BIP_RANGE(10),
85+
UNI_RANGE(10),
86+
RANGE_ext(-1, 1),
87+
RANGE_ext(0, 1)
88+
}
89+
};
90+
8291
/* AT specific setup */
8392
static const struct ni_board_struct ni_boards[] = {
8493
{

drivers/comedi/drivers/ni_mio_common.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,6 @@ static const struct comedi_lrange range_ni_M_ai_628x = {
166166
}
167167
};
168168

169-
static const struct comedi_lrange range_ni_E_ao_ext = {
170-
4, {
171-
BIP_RANGE(10),
172-
UNI_RANGE(10),
173-
RANGE_ext(-1, 1),
174-
RANGE_ext(0, 1)
175-
}
176-
};
177-
178169
static const struct comedi_lrange *const ni_range_lkup[] = {
179170
[ai_gain_16] = &range_ni_E_ai,
180171
[ai_gain_8] = &range_ni_E_ai_limited,

drivers/comedi/drivers/ni_pcimio.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,15 @@
102102

103103
#define PCIDMA
104104

105+
static const struct comedi_lrange range_ni_E_ao_ext = {
106+
4, {
107+
BIP_RANGE(10),
108+
UNI_RANGE(10),
109+
RANGE_ext(-1, 1),
110+
RANGE_ext(0, 1)
111+
}
112+
};
113+
105114
/*
106115
* These are not all the possible ao ranges for 628x boards.
107116
* They can do OFFSET +- REFERENCE where OFFSET can be

drivers/comedi/drivers/ni_stc.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,6 +1137,4 @@ struct ni_private {
11371137
u8 rgout0_usage;
11381138
};
11391139

1140-
static const struct comedi_lrange range_ni_E_ao_ext;
1141-
11421140
#endif /* _COMEDI_NI_STC_H */

0 commit comments

Comments
 (0)