From: Ksenija Stanojevic Date: Sat, 31 Oct 2015 13:34:29 +0000 (-0700) Subject: Staging: comedi: ni_mio_common: Fix endian sparse warning X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=212efdb1be77ae97e21afc35310f7f9c428f875c;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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] 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: Ksenija Stanojevic Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 6cc304a4c59b..cbb44fc6940b 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -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; }