Commit acf2f67d authored by Hartmut Knaack's avatar Hartmut Knaack Committed by Jonathan Cameron

iio:dac:m62332: address some style issues

Fix some indentation issues and separate returns by empty lines (IIO
style). Also rename the channel mask in _read_raw() to mask.
Signed-off-by: default avatarHartmut Knaack <knaack.h@gmx.de>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 11687d4a
...@@ -40,8 +40,7 @@ struct m62332_data { ...@@ -40,8 +40,7 @@ struct m62332_data {
#endif #endif
}; };
static int m62332_set_value(struct iio_dev *indio_dev, static int m62332_set_value(struct iio_dev *indio_dev, u8 val, int channel)
u8 val, int channel)
{ {
struct m62332_data *data = iio_priv(indio_dev); struct m62332_data *data = iio_priv(indio_dev);
struct i2c_client *client = data->client; struct i2c_client *client = data->client;
...@@ -87,30 +86,35 @@ static int m62332_read_raw(struct iio_dev *indio_dev, ...@@ -87,30 +86,35 @@ static int m62332_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, struct iio_chan_spec const *chan,
int *val, int *val,
int *val2, int *val2,
long m) long mask)
{ {
struct m62332_data *data = iio_priv(indio_dev); struct m62332_data *data = iio_priv(indio_dev);
switch (m) { switch (mask) {
case IIO_CHAN_INFO_SCALE: case IIO_CHAN_INFO_SCALE:
/* Corresponds to Vref / 2^(bits) */ /* Corresponds to Vref / 2^(bits) */
*val = data->vref_mv; *val = data->vref_mv;
*val2 = 8; *val2 = 8;
return IIO_VAL_FRACTIONAL_LOG2; return IIO_VAL_FRACTIONAL_LOG2;
case IIO_CHAN_INFO_RAW: case IIO_CHAN_INFO_RAW:
*val = data->raw[chan->channel]; *val = data->raw[chan->channel];
return IIO_VAL_INT; return IIO_VAL_INT;
case IIO_CHAN_INFO_OFFSET: case IIO_CHAN_INFO_OFFSET:
*val = 1; *val = 1;
return IIO_VAL_INT; return IIO_VAL_INT;
default: default:
break; break;
} }
return -EINVAL; return -EINVAL;
} }
static int m62332_write_raw(struct iio_dev *indio_dev, static int m62332_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, int val, int val2, long mask) struct iio_chan_spec const *chan, int val, int val2,
long mask)
{ {
switch (mask) { switch (mask) {
case IIO_CHAN_INFO_RAW: case IIO_CHAN_INFO_RAW:
...@@ -195,6 +199,7 @@ static int m62332_probe(struct i2c_client *client, ...@@ -195,6 +199,7 @@ static int m62332_probe(struct i2c_client *client,
indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
if (!indio_dev) if (!indio_dev)
return -ENOMEM; return -ENOMEM;
data = iio_priv(indio_dev); data = iio_priv(indio_dev);
i2c_set_clientdata(client, indio_dev); i2c_set_clientdata(client, indio_dev);
data->client = client; data->client = client;
...@@ -230,6 +235,7 @@ static int m62332_probe(struct i2c_client *client, ...@@ -230,6 +235,7 @@ static int m62332_probe(struct i2c_client *client,
err: err:
iio_map_array_unregister(indio_dev); iio_map_array_unregister(indio_dev);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment