Re: [PATCH v4 3/4] iio: adc: mcp3911: fix indentation

From: Andy Shevchenko
Date: Tue Aug 08 2023 - 13:05:44 EST


On Tue, Aug 08, 2023 at 01:04:31PM +0200, Marcus Folkesson wrote:
> The file does not make use of indentation properly.
> Fix that.

...

> static int mcp3911_update(struct mcp3911 *adc, u8 reg, u32 mask,
> - u32 val, u8 len)
> + u32 val, u8 len)

Can val be moved to the previous line?

...

> if (ret < 0) {
> dev_err(&adc->spi->dev,
> "failed to get vref voltage: %d\n",
> - ret);
> + ret);
> return ret;

With

struct device *dev = &adc->spi->dev;

this becomes

dev_err(dev, "failed to get vref voltage: %d\n", ret);

and one change less here.

> }

...

> -#define MCP3911_CHAN(idx) { \
> - .type = IIO_VOLTAGE, \
> - .indexed = 1, \
> - .channel = idx, \
> - .scan_index = idx, \
> - .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OVERSAMPLING_RATIO), \
> - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
> - BIT(IIO_CHAN_INFO_OFFSET) | \
> - BIT(IIO_CHAN_INFO_SCALE), \
> - .info_mask_shared_by_type_available = \
> - BIT(IIO_CHAN_INFO_OVERSAMPLING_RATIO), \
> - .info_mask_separate_available = \
> - BIT(IIO_CHAN_INFO_SCALE), \
> - .scan_type = { \
> - .sign = 's', \
> - .realbits = 24, \
> - .storagebits = 32, \
> - .endianness = IIO_BE, \
> - }, \

> }

This looks like unneeded churn to me.

...

> if (ret < 0) {
> dev_warn(&adc->spi->dev,
> - "failed to get conversion data\n");
> + "failed to get conversion data\n");
> goto out;
> }

Same as above with temporary variable for struct device.

--
With Best Regards,
Andy Shevchenko