The problem is that "ret" is an int but we're casting it as
"(unsigned long *)&ret" when we do the for_each_set_bit() loop. This
will not work on big endian 64 bit systems.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
enum iio_event_info info,
int *val, int *val2)
{
enum iio_event_info info,
int *val, int *val2)
{
struct sca3000_state *st = iio_priv(indio_dev);
struct sca3000_state *st = iio_priv(indio_dev);
switch (info) {
case IIO_EV_INFO_VALUE:
switch (info) {
case IIO_EV_INFO_VALUE:
return ret;
*val = 0;
if (chan->channel2 == IIO_MOD_Y)
return ret;
*val = 0;
if (chan->channel2 == IIO_MOD_Y)
- for_each_set_bit(i, (unsigned long *)&ret,
+ for_each_set_bit(i, &ret,
ARRAY_SIZE(st->info->mot_det_mult_y))
*val += st->info->mot_det_mult_y[i];
else
ARRAY_SIZE(st->info->mot_det_mult_y))
*val += st->info->mot_det_mult_y[i];
else
- for_each_set_bit(i, (unsigned long *)&ret,
+ for_each_set_bit(i, &ret,
ARRAY_SIZE(st->info->mot_det_mult_xz))
*val += st->info->mot_det_mult_xz[i];
ARRAY_SIZE(st->info->mot_det_mult_xz))
*val += st->info->mot_det_mult_xz[i];