From: H Hartley Sweeten Date: Wed, 3 Apr 2013 20:40:13 +0000 (-0700) Subject: staging: comedi: range: introduce some simple mA ranges X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=2c71c4ff57a6564097bedd45bc589f73da798a3a;p=openwrt%2Fstaging%2Fblogic.git staging: comedi: range: introduce some simple mA ranges 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 Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index 6abb7a8f059c..9df79cafc1c5 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 1e0cfe4972a6..10828fc7e16c 100644 --- a/drivers/staging/comedi/drivers/dt2815.c +++ b/drivers/staging/comedi/drivers/dt2815.c @@ -61,12 +61,6 @@ Configuration options: #include #include -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 e9d486238c85..42ab6dbf9d39 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 50e01968f19c..1cc0aa88f372 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 efec9022a7ae..d68491d1c37d 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);