]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iio: addac: stx104: Improve indentation in stx104_write_raw()
authorWilliam Breathitt Gray <william.gray@linaro.org>
Thu, 6 Apr 2023 14:40:13 +0000 (10:40 -0400)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 10 Apr 2023 11:26:33 +0000 (12:26 +0100)
By bailing out early if chan->output is false for the IIO_CHAN_INFO_RAW,
indentation can be decreased by a tab and code readability improved.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
Link: https://lore.kernel.org/r/487d17da9e2612f3e6b2bd1c3def2fa1b955db9b.1680790580.git.william.gray@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/addac/stx104.c

index 0ed5f71b18cbac4c6acf92d69cbffa077ddb641d..81020b7101951b8a74c376673f4290d850b3c396 100644 (file)
@@ -181,19 +181,19 @@ static int stx104_write_raw(struct iio_dev *indio_dev,
 
                return 0;
        case IIO_CHAN_INFO_RAW:
-               if (chan->output) {
-                       if (val < 0 || val > U16_MAX)
-                               return -EINVAL;
+               if (!chan->output)
+                       return -EINVAL;
 
-                       mutex_lock(&priv->lock);
+               if (val < 0 || val > U16_MAX)
+                       return -EINVAL;
 
-                       priv->chan_out_states[chan->channel] = val;
-                       iowrite16(val, &priv->reg->dac[chan->channel]);
+               mutex_lock(&priv->lock);
 
-                       mutex_unlock(&priv->lock);
-                       return 0;
-               }
-               return -EINVAL;
+               priv->chan_out_states[chan->channel] = val;
+               iowrite16(val, &priv->reg->dac[chan->channel]);
+
+               mutex_unlock(&priv->lock);
+               return 0;
        }
 
        return -EINVAL;