Commit 1abe0c9a authored by Ioana Ciornei's avatar Ioana Ciornei Committed by Greg Kroah-Hartman

staging: iio: accel: add spaces aroung binary operators

This patch adds spaces around binary operators such as '*',
'/', '+' in order to improve readability.
Signed-off-by: default avatarIoana Ciornei <ciorneiioana@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0bc85241
...@@ -565,7 +565,7 @@ static int lis3l02dq_read_event_config(struct iio_dev *indio_dev, ...@@ -565,7 +565,7 @@ static int lis3l02dq_read_event_config(struct iio_dev *indio_dev,
{ {
u8 val; u8 val;
int ret; int ret;
u8 mask = (1 << (chan->channel2*2 + (dir == IIO_EV_DIR_RISING))); u8 mask = (1 << (chan->channel2 * 2 + (dir == IIO_EV_DIR_RISING)));
ret = lis3l02dq_spi_read_reg_8(indio_dev, ret = lis3l02dq_spi_read_reg_8(indio_dev,
LIS3L02DQ_REG_WAKE_UP_CFG_ADDR, LIS3L02DQ_REG_WAKE_UP_CFG_ADDR,
...@@ -620,7 +620,7 @@ static int lis3l02dq_write_event_config(struct iio_dev *indio_dev, ...@@ -620,7 +620,7 @@ static int lis3l02dq_write_event_config(struct iio_dev *indio_dev,
u8 val, control; u8 val, control;
u8 currentlyset; u8 currentlyset;
bool changed = false; bool changed = false;
u8 mask = (1 << (chan->channel2*2 + (dir == IIO_EV_DIR_RISING))); u8 mask = (1 << (chan->channel2 * 2 + (dir == IIO_EV_DIR_RISING)));
mutex_lock(&indio_dev->mlock); mutex_lock(&indio_dev->mlock);
/* read current control */ /* read current control */
......
...@@ -69,25 +69,25 @@ static int lis3l02dq_read_all(struct iio_dev *indio_dev, u8 *rx_array) ...@@ -69,25 +69,25 @@ static int lis3l02dq_read_all(struct iio_dev *indio_dev, u8 *rx_array)
mutex_lock(&st->buf_lock); mutex_lock(&st->buf_lock);
for (i = 0; i < ARRAY_SIZE(read_all_tx_array)/4; i++) for (i = 0; i < ARRAY_SIZE(read_all_tx_array) / 4; i++)
if (test_bit(i, indio_dev->active_scan_mask)) { if (test_bit(i, indio_dev->active_scan_mask)) {
/* lower byte */ /* lower byte */
xfers[j].tx_buf = st->tx + 2*j; xfers[j].tx_buf = st->tx + (2 * j);
st->tx[2*j] = read_all_tx_array[i*4]; st->tx[2 * j] = read_all_tx_array[i * 4];
st->tx[2*j + 1] = 0; st->tx[2 * j + 1] = 0;
if (rx_array) if (rx_array)
xfers[j].rx_buf = rx_array + j*2; xfers[j].rx_buf = rx_array + (j * 2);
xfers[j].bits_per_word = 8; xfers[j].bits_per_word = 8;
xfers[j].len = 2; xfers[j].len = 2;
xfers[j].cs_change = 1; xfers[j].cs_change = 1;
j++; j++;
/* upper byte */ /* upper byte */
xfers[j].tx_buf = st->tx + 2*j; xfers[j].tx_buf = st->tx + (2 * j);
st->tx[2*j] = read_all_tx_array[i*4 + 2]; st->tx[2 * j] = read_all_tx_array[i * 4 + 2];
st->tx[2*j + 1] = 0; st->tx[2 * j + 1] = 0;
if (rx_array) if (rx_array)
xfers[j].rx_buf = rx_array + j*2; xfers[j].rx_buf = rx_array + (j * 2);
xfers[j].bits_per_word = 8; xfers[j].bits_per_word = 8;
xfers[j].len = 2; xfers[j].len = 2;
xfers[j].cs_change = 1; xfers[j].cs_change = 1;
...@@ -127,11 +127,11 @@ static int lis3l02dq_get_buffer_element(struct iio_dev *indio_dev, ...@@ -127,11 +127,11 @@ static int lis3l02dq_get_buffer_element(struct iio_dev *indio_dev,
return ret; return ret;
} }
for (i = 0; i < scan_count; i++) for (i = 0; i < scan_count; i++)
data[i] = combine_8_to_16(rx_array[i*4+1], data[i] = combine_8_to_16(rx_array[i * 4 + 1],
rx_array[i*4+3]); rx_array[i * 4 + 3]);
kfree(rx_array); kfree(rx_array);
return i*sizeof(data[0]); return i * sizeof(data[0]);
} }
static irqreturn_t lis3l02dq_trigger_handler(int irq, void *p) static irqreturn_t lis3l02dq_trigger_handler(int irq, void *p)
......
...@@ -471,8 +471,8 @@ static int sca3000_read_raw(struct iio_dev *indio_dev, ...@@ -471,8 +471,8 @@ static int sca3000_read_raw(struct iio_dev *indio_dev,
return ret; return ret;
} }
*val = (be16_to_cpup((__be16 *)st->rx) >> 3) & 0x1FFF; *val = (be16_to_cpup((__be16 *)st->rx) >> 3) & 0x1FFF;
*val = ((*val) << (sizeof(*val)*8 - 13)) >> *val = ((*val) << (sizeof(*val) * 8 - 13)) >>
(sizeof(*val)*8 - 13); (sizeof(*val) * 8 - 13);
} else { } else {
/* get the temperature when available */ /* get the temperature when available */
ret = sca3000_read_data_short(st, ret = sca3000_read_data_short(st,
...@@ -529,20 +529,20 @@ static ssize_t sca3000_read_av_freq(struct device *dev, ...@@ -529,20 +529,20 @@ static ssize_t sca3000_read_av_freq(struct device *dev,
case SCA3000_MEAS_MODE_NORMAL: case SCA3000_MEAS_MODE_NORMAL:
len += sprintf(buf + len, "%d %d %d\n", len += sprintf(buf + len, "%d %d %d\n",
st->info->measurement_mode_freq, st->info->measurement_mode_freq,
st->info->measurement_mode_freq/2, st->info->measurement_mode_freq / 2,
st->info->measurement_mode_freq/4); st->info->measurement_mode_freq / 4);
break; break;
case SCA3000_MEAS_MODE_OP_1: case SCA3000_MEAS_MODE_OP_1:
len += sprintf(buf + len, "%d %d %d\n", len += sprintf(buf + len, "%d %d %d\n",
st->info->option_mode_1_freq, st->info->option_mode_1_freq,
st->info->option_mode_1_freq/2, st->info->option_mode_1_freq / 2,
st->info->option_mode_1_freq/4); st->info->option_mode_1_freq / 4);
break; break;
case SCA3000_MEAS_MODE_OP_2: case SCA3000_MEAS_MODE_OP_2:
len += sprintf(buf + len, "%d %d %d\n", len += sprintf(buf + len, "%d %d %d\n",
st->info->option_mode_2_freq, st->info->option_mode_2_freq,
st->info->option_mode_2_freq/2, st->info->option_mode_2_freq / 2,
st->info->option_mode_2_freq/4); st->info->option_mode_2_freq / 4);
break; break;
} }
return len; return len;
...@@ -605,10 +605,10 @@ static ssize_t sca3000_read_frequency(struct device *dev, ...@@ -605,10 +605,10 @@ static ssize_t sca3000_read_frequency(struct device *dev,
len = sprintf(buf, "%d\n", base_freq); len = sprintf(buf, "%d\n", base_freq);
break; break;
case 0x01: case 0x01:
len = sprintf(buf, "%d\n", base_freq/2); len = sprintf(buf, "%d\n", base_freq / 2);
break; break;
case 0x02: case 0x02:
len = sprintf(buf, "%d\n", base_freq/4); len = sprintf(buf, "%d\n", base_freq / 4);
break; break;
} }
...@@ -650,9 +650,9 @@ static ssize_t sca3000_set_frequency(struct device *dev, ...@@ -650,9 +650,9 @@ static ssize_t sca3000_set_frequency(struct device *dev,
/* clear the bits */ /* clear the bits */
ctrlval &= ~0x03; ctrlval &= ~0x03;
if (val == base_freq/2) { if (val == base_freq / 2) {
ctrlval |= SCA3000_OUT_CTRL_BUF_DIV_2; ctrlval |= SCA3000_OUT_CTRL_BUF_DIV_2;
} else if (val == base_freq/4) { } else if (val == base_freq / 4) {
ctrlval |= SCA3000_OUT_CTRL_BUF_DIV_4; ctrlval |= SCA3000_OUT_CTRL_BUF_DIV_4;
} else if (val != base_freq) { } else if (val != base_freq) {
ret = -EINVAL; ret = -EINVAL;
...@@ -997,14 +997,14 @@ static int sca3000_write_event_config(struct iio_dev *indio_dev, ...@@ -997,14 +997,14 @@ static int sca3000_write_event_config(struct iio_dev *indio_dev,
/* Free fall detector related event attribute */ /* Free fall detector related event attribute */
static IIO_DEVICE_ATTR_NAMED(accel_xayaz_mag_falling_en, static IIO_DEVICE_ATTR_NAMED(accel_xayaz_mag_falling_en,
in_accel_x&y&z_mag_falling_en, in_accel_x & y & z_mag_falling_en,
S_IRUGO | S_IWUSR, S_IRUGO | S_IWUSR,
sca3000_query_free_fall_mode, sca3000_query_free_fall_mode,
sca3000_set_free_fall_mode, sca3000_set_free_fall_mode,
0); 0);
static IIO_CONST_ATTR_NAMED(accel_xayaz_mag_falling_period, static IIO_CONST_ATTR_NAMED(accel_xayaz_mag_falling_period,
in_accel_x&y&z_mag_falling_period, in_accel_x & y & z_mag_falling_period,
"0.226"); "0.226");
static struct attribute *sca3000_event_attributes[] = { static struct attribute *sca3000_event_attributes[] = {
......
...@@ -106,7 +106,7 @@ static int sca3000_read_first_n_hw_rb(struct iio_buffer *r, ...@@ -106,7 +106,7 @@ static int sca3000_read_first_n_hw_rb(struct iio_buffer *r,
* i.e. number of time points * number of channels. * i.e. number of time points * number of channels.
*/ */
if (count > num_available * bytes_per_sample) if (count > num_available * bytes_per_sample)
num_read = num_available*bytes_per_sample; num_read = num_available * bytes_per_sample;
else else
num_read = count; num_read = count;
...@@ -208,7 +208,7 @@ static ssize_t sca3000_show_buffer_scale(struct device *dev, ...@@ -208,7 +208,7 @@ static ssize_t sca3000_show_buffer_scale(struct device *dev,
struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct sca3000_state *st = iio_priv(indio_dev); struct sca3000_state *st = iio_priv(indio_dev);
return sprintf(buf, "0.%06d\n", 4*st->info->scale); return sprintf(buf, "0.%06d\n", 4 * st->info->scale);
} }
static IIO_DEVICE_ATTR(in_accel_scale, static IIO_DEVICE_ATTR(in_accel_scale,
......
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