summaryrefslogtreecommitdiff
path: root/drivers/staging/iio
diff options
context:
space:
mode:
authorJonathan Cameron <Jonathan.Cameron@huawei.com>2021-03-14 18:15:02 +0000
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2021-04-07 08:36:36 +0100
commit88f0e098a0b74a24a9183abd96d15dafd3bcba8a (patch)
treeb8d632a26ab43576cb0184ca89e31776b86ee2a8 /drivers/staging/iio
parent69567d38613cead66315bbc73a53ee674c0be05d (diff)
staging:iio:cdc:ad7150: Tidy up local variable positioning.
Where there is no other basis on which to order declarations let us prefer reverse xmas tree. Also reduce scope where sensible. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Barry Song <song.bao.hua@hisilicon.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Link: https://lore.kernel.org/r/20210314181511.531414-16-jic23@kernel.org
Diffstat (limited to 'drivers/staging/iio')
-rw-r--r--drivers/staging/iio/cdc/ad7150.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c
index eb5424507ad5..cb3e7698d2b1 100644
--- a/drivers/staging/iio/cdc/ad7150.c
+++ b/drivers/staging/iio/cdc/ad7150.c
@@ -108,9 +108,9 @@ static int ad7150_read_raw(struct iio_dev *indio_dev,
int *val2,
long mask)
{
- int ret;
struct ad7150_chip_info *chip = iio_priv(indio_dev);
int channel = chan->channel;
+ int ret;
switch (mask) {
case IIO_CHAN_INFO_RAW:
@@ -143,10 +143,10 @@ static int ad7150_read_event_config(struct iio_dev *indio_dev,
enum iio_event_type type,
enum iio_event_direction dir)
{
- int ret;
+ struct ad7150_chip_info *chip = iio_priv(indio_dev);
u8 threshtype;
bool thrfixed;
- struct ad7150_chip_info *chip = iio_priv(indio_dev);
+ int ret;
ret = i2c_smbus_read_byte_data(chip->client, AD7150_CFG_REG);
if (ret < 0)
@@ -227,10 +227,8 @@ static int ad7150_write_event_config(struct iio_dev *indio_dev,
enum iio_event_type type,
enum iio_event_direction dir, int state)
{
- u8 thresh_type, cfg, fixed;
- int ret;
struct ad7150_chip_info *chip = iio_priv(indio_dev);
- int rising = (dir == IIO_EV_DIR_RISING);
+ int ret;
/*
* There is only a single shared control and no on chip
@@ -251,6 +249,8 @@ static int ad7150_write_event_config(struct iio_dev *indio_dev,
mutex_lock(&chip->state_lock);
if ((type != chip->type) || (dir != chip->dir)) {
+ int rising = (dir == IIO_EV_DIR_RISING);
+ u8 thresh_type, cfg, fixed;
/*
* Need to temporarily disable both interrupts if
@@ -528,9 +528,9 @@ static const struct iio_info ad7150_info_no_irq = {
static int ad7150_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
- int ret;
struct ad7150_chip_info *chip;
struct iio_dev *indio_dev;
+ int ret;
indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip));
if (!indio_dev)