Commit 212efdb1 authored by Ksenija Stanojevic's avatar Ksenija Stanojevic Committed by Greg Kroah-Hartman

Staging: comedi: ni_mio_common: Fix endian sparse warning

Fix following sparse warnings:
warning: cast to restricted __le32
warning: cast to restricted __le16
warning: incorrect type in assignment (different base types)
expected unsigned short [unsigned] [assigned] val
got restricted __le16 [usertype] <noident>

Data is pointer of type void and can be used to store any type of data.
In function ni_ai_munge:
barray and array have the same 16 bit offset.
blarray and larray have the same 32 bit offset.
Signed-off-by: default avatarKsenija Stanojevic <ksenija.stanojevic@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 90e6228a
......@@ -1516,13 +1516,17 @@ static void ni_ai_munge(struct comedi_device *dev, struct comedi_subdevice *s,
unsigned short *array = data;
unsigned int *larray = data;
unsigned int i;
#ifdef PCIDMA
__le16 *barray = data;
__le32 *blarray = data;
#endif
for (i = 0; i < nsamples; i++) {
#ifdef PCIDMA
if (s->subdev_flags & SDF_LSAMPL)
larray[i] = le32_to_cpu(larray[i]);
larray[i] = le32_to_cpu(blarray[i]);
else
array[i] = le16_to_cpu(array[i]);
array[i] = le16_to_cpu(barray[i]);
#endif
if (s->subdev_flags & SDF_LSAMPL)
larray[i] += devpriv->ai_offset[chan_index];
......@@ -2574,6 +2578,9 @@ static void ni_ao_munge(struct comedi_device *dev, struct comedi_subdevice *s,
unsigned int nsamples = comedi_bytes_to_samples(s, num_bytes);
unsigned short *array = data;
unsigned int i;
#ifdef PCIDMA
__le16 buf, *barray = data;
#endif
for (i = 0; i < nsamples; i++) {
unsigned int range = CR_RANGE(cmd->chanlist[chan_index]);
......@@ -2586,10 +2593,11 @@ static void ni_ao_munge(struct comedi_device *dev, struct comedi_subdevice *s,
if (comedi_range_is_bipolar(s, range))
val = comedi_offset_munge(s, val);
#ifdef PCIDMA
val = cpu_to_le16(val);
#endif
buf = cpu_to_le16(val);
barray[i] = buf;
#else
array[i] = val;
#endif
chan_index++;
chan_index %= cmd->chanlist_len;
}
......
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