Commit 3a2b101c authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman

staging: comedi: ni_mio_common: sample types are unsigned

Sample values in comedi are generally represented as unsigned values.
Change the element type of the `ai_fifo_buffer[]` element of `struct
ni_board_struct` and the types of various local variables from `short`
to `unsigned short` for consistency.
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c0edd2c6
...@@ -1292,7 +1292,7 @@ static void ni_ao_fifo_load(struct comedi_device *dev, ...@@ -1292,7 +1292,7 @@ static void ni_ao_fifo_load(struct comedi_device *dev,
struct comedi_cmd *cmd = &async->cmd; struct comedi_cmd *cmd = &async->cmd;
int chan; int chan;
int i; int i;
short d; unsigned short d;
u32 packed_data; u32 packed_data;
int range; int range;
int err = 1; int err = 1;
...@@ -1403,7 +1403,7 @@ static void ni_ai_fifo_read(struct comedi_device *dev, ...@@ -1403,7 +1403,7 @@ static void ni_ai_fifo_read(struct comedi_device *dev,
int i; int i;
if (board->reg_type == ni_reg_611x) { if (board->reg_type == ni_reg_611x) {
short data[2]; unsigned short data[2];
u32 dl; u32 dl;
for (i = 0; i < n / 2; i++) { for (i = 0; i < n / 2; i++) {
...@@ -1420,7 +1420,7 @@ static void ni_ai_fifo_read(struct comedi_device *dev, ...@@ -1420,7 +1420,7 @@ static void ni_ai_fifo_read(struct comedi_device *dev,
cfc_write_to_buffer(s, data[0]); cfc_write_to_buffer(s, data[0]);
} }
} else if (board->reg_type == ni_reg_6143) { } else if (board->reg_type == ni_reg_6143) {
short data[2]; unsigned short data[2];
u32 dl; u32 dl;
/* This just reads the FIFO assuming the data is present, no checks on the FIFO status are performed */ /* This just reads the FIFO assuming the data is present, no checks on the FIFO status are performed */
...@@ -1511,9 +1511,9 @@ static void ni_handle_fifo_dregs(struct comedi_device *dev) ...@@ -1511,9 +1511,9 @@ static void ni_handle_fifo_dregs(struct comedi_device *dev)
const struct ni_board_struct *board = comedi_board(dev); const struct ni_board_struct *board = comedi_board(dev);
struct ni_private *devpriv = dev->private; struct ni_private *devpriv = dev->private;
struct comedi_subdevice *s = &dev->subdevices[NI_AI_SUBDEV]; struct comedi_subdevice *s = &dev->subdevices[NI_AI_SUBDEV];
short data[2]; unsigned short data[2];
u32 dl; u32 dl;
short fifo_empty; unsigned short fifo_empty;
int i; int i;
if (board->reg_type == ni_reg_611x) { if (board->reg_type == ni_reg_611x) {
...@@ -1577,7 +1577,7 @@ static void get_last_sample_611x(struct comedi_device *dev) ...@@ -1577,7 +1577,7 @@ static void get_last_sample_611x(struct comedi_device *dev)
const struct ni_board_struct *board = comedi_board(dev); const struct ni_board_struct *board = comedi_board(dev);
struct ni_private *devpriv __maybe_unused = dev->private; struct ni_private *devpriv __maybe_unused = dev->private;
struct comedi_subdevice *s = &dev->subdevices[NI_AI_SUBDEV]; struct comedi_subdevice *s = &dev->subdevices[NI_AI_SUBDEV];
short data; unsigned short data;
u32 dl; u32 dl;
if (board->reg_type != ni_reg_611x) if (board->reg_type != ni_reg_611x)
...@@ -1596,7 +1596,7 @@ static void get_last_sample_6143(struct comedi_device *dev) ...@@ -1596,7 +1596,7 @@ static void get_last_sample_6143(struct comedi_device *dev)
const struct ni_board_struct *board = comedi_board(dev); const struct ni_board_struct *board = comedi_board(dev);
struct ni_private *devpriv __maybe_unused = dev->private; struct ni_private *devpriv __maybe_unused = dev->private;
struct comedi_subdevice *s = &dev->subdevices[NI_AI_SUBDEV]; struct comedi_subdevice *s = &dev->subdevices[NI_AI_SUBDEV];
short data; unsigned short data;
u32 dl; u32 dl;
if (board->reg_type != ni_reg_6143) if (board->reg_type != ni_reg_6143)
...@@ -1621,7 +1621,7 @@ static void ni_ai_munge(struct comedi_device *dev, struct comedi_subdevice *s, ...@@ -1621,7 +1621,7 @@ static void ni_ai_munge(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_async *async = s->async; struct comedi_async *async = s->async;
unsigned int i; unsigned int i;
unsigned int length = num_bytes / bytes_per_sample(s); unsigned int length = num_bytes / bytes_per_sample(s);
short *array = data; unsigned short *array = data;
unsigned int *larray = data; unsigned int *larray = data;
for (i = 0; i < length; i++) { for (i = 0; i < length; i++) {
...@@ -2873,7 +2873,7 @@ static void ni_ao_munge(struct comedi_device *dev, struct comedi_subdevice *s, ...@@ -2873,7 +2873,7 @@ static void ni_ao_munge(struct comedi_device *dev, struct comedi_subdevice *s,
unsigned int i; unsigned int i;
unsigned int offset; unsigned int offset;
unsigned int length = num_bytes / sizeof(short); unsigned int length = num_bytes / sizeof(short);
short *array = data; unsigned short *array = data;
offset = 1 << (board->aobits - 1); offset = 1 << (board->aobits - 1);
for (i = 0; i < length; i++) { for (i = 0; i < length; i++) {
......
...@@ -1491,7 +1491,7 @@ struct ni_board_struct { ...@@ -1491,7 +1491,7 @@ struct ni_board_struct {
unsigned short pwm_up_count; \ unsigned short pwm_up_count; \
unsigned short pwm_down_count; \ unsigned short pwm_down_count; \
\ \
short ai_fifo_buffer[0x2000]; \ unsigned short ai_fifo_buffer[0x2000]; \
uint8_t eeprom_buffer[M_SERIES_EEPROM_SIZE]; \ uint8_t eeprom_buffer[M_SERIES_EEPROM_SIZE]; \
uint32_t serial_number; \ uint32_t serial_number; \
\ \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment