mirror of https://gitee.com/openkylin/linux.git
iio: accel: mma9553: fix alignment issues
Fix code alignment and wrap parameters. Fix issues reported by checkpatch.pl --strict. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Suggested-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
parent
c0d901cce7
commit
b37c19903a
|
@ -343,10 +343,10 @@ static int mma9553_conf_gpio(struct mma9553_data *data)
|
||||||
struct mma9553_event *ev_step_detect;
|
struct mma9553_event *ev_step_detect;
|
||||||
bool activity_enabled;
|
bool activity_enabled;
|
||||||
|
|
||||||
activity_enabled =
|
activity_enabled = mma9553_is_any_event_enabled(data, true,
|
||||||
mma9553_is_any_event_enabled(data, true, IIO_ACTIVITY);
|
IIO_ACTIVITY);
|
||||||
ev_step_detect =
|
ev_step_detect = mma9553_get_event(data, IIO_STEPS, IIO_NO_MOD,
|
||||||
mma9553_get_event(data, IIO_STEPS, IIO_NO_MOD, IIO_EV_DIR_NONE);
|
IIO_EV_DIR_NONE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If both step detector and activity are enabled, use the MRGFL bit.
|
* If both step detector and activity are enabled, use the MRGFL bit.
|
||||||
|
@ -372,9 +372,8 @@ static int mma9553_conf_gpio(struct mma9553_data *data)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = mma9551_gpio_config(data->client,
|
ret = mma9551_gpio_config(data->client, MMA9553_DEFAULT_GPIO_PIN, appid,
|
||||||
MMA9553_DEFAULT_GPIO_PIN,
|
bitnum, MMA9553_DEFAULT_GPIO_POLARITY);
|
||||||
appid, bitnum, MMA9553_DEFAULT_GPIO_POLARITY);
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
data->gpio_bitnum = bitnum;
|
data->gpio_bitnum = bitnum;
|
||||||
|
@ -395,8 +394,7 @@ static int mma9553_init(struct mma9553_data *data)
|
||||||
* a device identification command to differentiate the MMA9553L
|
* a device identification command to differentiate the MMA9553L
|
||||||
* from the MMA9550L.
|
* from the MMA9550L.
|
||||||
*/
|
*/
|
||||||
ret =
|
ret = mma9551_read_config_words(data->client, MMA9551_APPID_PEDOMETER,
|
||||||
mma9551_read_config_words(data->client, MMA9551_APPID_PEDOMETER,
|
|
||||||
MMA9553_REG_CONF_SLEEPMIN,
|
MMA9553_REG_CONF_SLEEPMIN,
|
||||||
sizeof(data->conf) / sizeof(u16),
|
sizeof(data->conf) / sizeof(u16),
|
||||||
(u16 *)&data->conf);
|
(u16 *)&data->conf);
|
||||||
|
@ -406,7 +404,6 @@ static int mma9553_init(struct mma9553_data *data)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Reset GPIO */
|
/* Reset GPIO */
|
||||||
data->gpio_bitnum = MMA9553_MAX_BITNUM;
|
data->gpio_bitnum = MMA9553_MAX_BITNUM;
|
||||||
ret = mma9553_conf_gpio(data);
|
ret = mma9553_conf_gpio(data);
|
||||||
|
@ -421,16 +418,15 @@ static int mma9553_init(struct mma9553_data *data)
|
||||||
data->conf.sleepmin = MMA9553_DEFAULT_SLEEPMIN;
|
data->conf.sleepmin = MMA9553_DEFAULT_SLEEPMIN;
|
||||||
data->conf.sleepmax = MMA9553_DEFAULT_SLEEPMAX;
|
data->conf.sleepmax = MMA9553_DEFAULT_SLEEPMAX;
|
||||||
data->conf.sleepthd = MMA9553_DEFAULT_SLEEPTHD;
|
data->conf.sleepthd = MMA9553_DEFAULT_SLEEPTHD;
|
||||||
data->conf.config =
|
data->conf.config = mma9553_set_bits(data->conf.config, 1,
|
||||||
mma9553_set_bits(data->conf.config, 1, MMA9553_MASK_CONF_CONFIG);
|
MMA9553_MASK_CONF_CONFIG);
|
||||||
/*
|
/*
|
||||||
* Clear the activity debounce counter when the activity level changes,
|
* Clear the activity debounce counter when the activity level changes,
|
||||||
* so that the confidence level applies for any activity level.
|
* so that the confidence level applies for any activity level.
|
||||||
*/
|
*/
|
||||||
data->conf.config = mma9553_set_bits(data->conf.config, 1,
|
data->conf.config = mma9553_set_bits(data->conf.config, 1,
|
||||||
MMA9553_MASK_CONF_ACT_DBCNTM);
|
MMA9553_MASK_CONF_ACT_DBCNTM);
|
||||||
ret =
|
ret = mma9551_write_config_words(data->client, MMA9551_APPID_PEDOMETER,
|
||||||
mma9551_write_config_words(data->client, MMA9551_APPID_PEDOMETER,
|
|
||||||
MMA9553_REG_CONF_SLEEPMIN,
|
MMA9553_REG_CONF_SLEEPMIN,
|
||||||
sizeof(data->conf) / sizeof(u16),
|
sizeof(data->conf) / sizeof(u16),
|
||||||
(u16 *)&data->conf);
|
(u16 *)&data->conf);
|
||||||
|
@ -722,7 +718,6 @@ static int mma9553_read_event_config(struct iio_dev *indio_dev,
|
||||||
enum iio_event_type type,
|
enum iio_event_type type,
|
||||||
enum iio_event_direction dir)
|
enum iio_event_direction dir)
|
||||||
{
|
{
|
||||||
|
|
||||||
struct mma9553_data *data = iio_priv(indio_dev);
|
struct mma9553_data *data = iio_priv(indio_dev);
|
||||||
struct mma9553_event *event;
|
struct mma9553_event *event;
|
||||||
|
|
||||||
|
@ -1029,22 +1024,22 @@ static irqreturn_t mma9553_event_handler(int irq, void *private)
|
||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ev_prev_activity =
|
ev_prev_activity = mma9553_get_event(data, IIO_ACTIVITY,
|
||||||
mma9553_get_event(data, IIO_ACTIVITY,
|
mma9553_activity_to_mod(
|
||||||
mma9553_activity_to_mod(data->activity),
|
data->activity),
|
||||||
IIO_EV_DIR_FALLING);
|
IIO_EV_DIR_FALLING);
|
||||||
ev_activity =
|
ev_activity = mma9553_get_event(data, IIO_ACTIVITY,
|
||||||
mma9553_get_event(data, IIO_ACTIVITY,
|
|
||||||
mma9553_activity_to_mod(activity),
|
mma9553_activity_to_mod(activity),
|
||||||
IIO_EV_DIR_RISING);
|
IIO_EV_DIR_RISING);
|
||||||
ev_step_detect =
|
ev_step_detect = mma9553_get_event(data, IIO_STEPS, IIO_NO_MOD,
|
||||||
mma9553_get_event(data, IIO_STEPS, IIO_NO_MOD, IIO_EV_DIR_NONE);
|
IIO_EV_DIR_NONE);
|
||||||
|
|
||||||
if (ev_step_detect->enabled && (stepcnt != data->stepcnt)) {
|
if (ev_step_detect->enabled && (stepcnt != data->stepcnt)) {
|
||||||
data->stepcnt = stepcnt;
|
data->stepcnt = stepcnt;
|
||||||
iio_push_event(indio_dev,
|
iio_push_event(indio_dev,
|
||||||
IIO_EVENT_CODE(IIO_STEPS, 0, IIO_NO_MOD,
|
IIO_EVENT_CODE(IIO_STEPS, 0, IIO_NO_MOD,
|
||||||
IIO_EV_DIR_NONE, IIO_EV_TYPE_CHANGE, 0, 0, 0),
|
IIO_EV_DIR_NONE,
|
||||||
|
IIO_EV_TYPE_CHANGE, 0, 0, 0),
|
||||||
data->timestamp);
|
data->timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1056,7 +1051,8 @@ static irqreturn_t mma9553_event_handler(int irq, void *private)
|
||||||
IIO_EVENT_CODE(IIO_ACTIVITY, 0,
|
IIO_EVENT_CODE(IIO_ACTIVITY, 0,
|
||||||
ev_prev_activity->info->mod,
|
ev_prev_activity->info->mod,
|
||||||
IIO_EV_DIR_FALLING,
|
IIO_EV_DIR_FALLING,
|
||||||
IIO_EV_TYPE_THRESH, 0, 0, 0),
|
IIO_EV_TYPE_THRESH, 0, 0,
|
||||||
|
0),
|
||||||
data->timestamp);
|
data->timestamp);
|
||||||
|
|
||||||
if (ev_activity && ev_activity->enabled)
|
if (ev_activity && ev_activity->enabled)
|
||||||
|
@ -1064,7 +1060,8 @@ static irqreturn_t mma9553_event_handler(int irq, void *private)
|
||||||
IIO_EVENT_CODE(IIO_ACTIVITY, 0,
|
IIO_EVENT_CODE(IIO_ACTIVITY, 0,
|
||||||
ev_activity->info->mod,
|
ev_activity->info->mod,
|
||||||
IIO_EV_DIR_RISING,
|
IIO_EV_DIR_RISING,
|
||||||
IIO_EV_TYPE_THRESH, 0, 0, 0),
|
IIO_EV_TYPE_THRESH, 0, 0,
|
||||||
|
0),
|
||||||
data->timestamp);
|
data->timestamp);
|
||||||
}
|
}
|
||||||
mutex_unlock(&data->mutex);
|
mutex_unlock(&data->mutex);
|
||||||
|
@ -1159,7 +1156,6 @@ static int mma9553_probe(struct i2c_client *client,
|
||||||
client->irq);
|
client->irq);
|
||||||
goto out_poweroff;
|
goto out_poweroff;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = iio_device_register(indio_dev);
|
ret = iio_device_register(indio_dev);
|
||||||
|
|
Loading…
Reference in New Issue