mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
iio: dac: mcp4821: move state initialization outside switch
Move the iio_priv() call outside the switch statement in mcp4821_read_raw() to avoid repeating it in multiple cases. No functional change. Signed-off-by: Nikhil Gautam <nikhilgtr@gmail.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
parent
f4d618c618
commit
090839ecff
|
|
@ -115,11 +115,10 @@ static int mcp4821_read_raw(struct iio_dev *indio_dev,
|
|||
struct iio_chan_spec const *chan, int *val,
|
||||
int *val2, long mask)
|
||||
{
|
||||
struct mcp4821_state *state;
|
||||
struct mcp4821_state *state = iio_priv(indio_dev);
|
||||
|
||||
switch (mask) {
|
||||
case IIO_CHAN_INFO_RAW:
|
||||
state = iio_priv(indio_dev);
|
||||
*val = state->dac_value[chan->channel];
|
||||
return IIO_VAL_INT;
|
||||
case IIO_CHAN_INFO_SCALE:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user