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:
                                    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)
                                     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
 
        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
 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)