The simple mA ranges 0 to 20, 4 to 20, and 0 to 32 are fairly common. Introduce them in the comedi core and use them in the drivers. Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx> Cc: Ian Abbott <abbotti@xxxxxxxxx> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/staging/comedi/comedidev.h | 3 +++ drivers/staging/comedi/drivers/dt2815.c | 8 +------- drivers/staging/comedi/drivers/ni_670x.c | 2 -- drivers/staging/comedi/drivers/pcl726.c | 3 --- drivers/staging/comedi/range.c | 6 ++++++ 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index 6abb7a8..9df79ca 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -295,6 +295,9 @@ extern const struct comedi_lrange range_bipolar2_5; extern const struct comedi_lrange range_unipolar10; extern const struct comedi_lrange range_unipolar5; extern const struct comedi_lrange range_unipolar2_5; +extern const struct comedi_lrange range_0_20mA; +extern const struct comedi_lrange range_4_20mA; +extern const struct comedi_lrange range_0_32mA; extern const struct comedi_lrange range_unknown; #define range_digital range_unipolar5 diff --git a/drivers/staging/comedi/drivers/dt2815.c b/drivers/staging/comedi/drivers/dt2815.c index 1e0cfe4..10828fc 100644 --- a/drivers/staging/comedi/drivers/dt2815.c +++ b/drivers/staging/comedi/drivers/dt2815.c @@ -61,12 +61,6 @@ Configuration options: #include <linux/ioport.h> #include <linux/delay.h> -static const struct comedi_lrange - range_dt2815_ao_32_current = {1, {RANGE_mA(0, 32)} }; - -static const struct comedi_lrange - range_dt2815_ao_20_current = {1, {RANGE_mA(4, 20)} }; - #define DT2815_SIZE 2 #define DT2815_DATA 0 @@ -199,7 +193,7 @@ static int dt2815_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->range_table_list = devpriv->range_type_list; current_range_type = (it->options[3]) - ? &range_dt2815_ao_20_current : &range_dt2815_ao_32_current; + ? &range_4_20mA : &range_0_32mA; voltage_range_type = (it->options[2]) ? &range_bipolar5 : &range_unipolar5; for (i = 0; i < 8; i++) { diff --git a/drivers/staging/comedi/drivers/ni_670x.c b/drivers/staging/comedi/drivers/ni_670x.c index e9d4862..42ab6db 100644 --- a/drivers/staging/comedi/drivers/ni_670x.c +++ b/drivers/staging/comedi/drivers/ni_670x.c @@ -94,8 +94,6 @@ struct ni_670x_private { unsigned int ao_readback[32]; }; -static struct comedi_lrange range_0_20mA = { 1, {RANGE_mA(0, 20)} }; - static int ni_670x_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) diff --git a/drivers/staging/comedi/drivers/pcl726.c b/drivers/staging/comedi/drivers/pcl726.c index 50e0196..1cc0aa8 100644 --- a/drivers/staging/comedi/drivers/pcl726.c +++ b/drivers/staging/comedi/drivers/pcl726.c @@ -90,9 +90,6 @@ Interrupts are not supported. #define PCL727_DI_HI 0 #define PCL727_DI_LO 1 -static const struct comedi_lrange range_4_20mA = { 1, {RANGE_mA(4, 20)} }; -static const struct comedi_lrange range_0_20mA = { 1, {RANGE_mA(0, 20)} }; - static const struct comedi_lrange *const rangelist_726[] = { &range_unipolar5, &range_unipolar10, &range_bipolar5, &range_bipolar10, diff --git a/drivers/staging/comedi/range.c b/drivers/staging/comedi/range.c index efec902..d68491d 100644 --- a/drivers/staging/comedi/range.c +++ b/drivers/staging/comedi/range.c @@ -37,6 +37,12 @@ const struct comedi_lrange range_unipolar5 = { 1, {UNI_RANGE(5)} }; EXPORT_SYMBOL(range_unipolar5); const struct comedi_lrange range_unipolar2_5 = { 1, {UNI_RANGE(2.5)} }; EXPORT_SYMBOL(range_unipolar2_5); +const struct comedi_lrange range_0_20mA = { 1, {RANGE_mA(0, 20)} }; +EXPORT_SYMBOL(range_0_20mA); +const struct comedi_lrange range_4_20mA = { 1, {RANGE_mA(4, 20)} }; +EXPORT_SYMBOL(range_4_20mA); +const struct comedi_lrange range_0_32mA = { 1, {RANGE_mA(0, 32)} }; +EXPORT_SYMBOL(range_0_32mA); const struct comedi_lrange range_unknown = { 1, {{0, 1000000, UNIT_none} } }; EXPORT_SYMBOL(range_unknown); -- 1.8.1.4 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel