While simplifying the i2c-mux state, the states were stored in an enum (initially there were three). This has now simplified down to 2 states, open and closed - and can be represented easily in a bool. It 'could' also be represented within the mux_channel, but I don't want to pollute that further than the '-1' value which is already stored in there to represent no channel selected. Remove the max9286_i2c_mux_state and replace with a bool mux_open flag, and move the location within the private struct to be more appropriate. Signed-off-by: Kieran Bingham <kieran.bingham@xxxxxxxxxxxxxxxx> --- drivers/media/i2c/max9286.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c index e5b3f78318db..6ea08fd87811 100644 --- a/drivers/media/i2c/max9286.c +++ b/drivers/media/i2c/max9286.c @@ -144,10 +144,10 @@ struct max9286_priv { struct media_pad pads[MAX9286_N_PADS]; struct regulator *regulator; bool poc_enabled; - int mux_state; struct i2c_mux_core *mux; unsigned int mux_channel; + bool mux_open; struct v4l2_ctrl_handler ctrls; @@ -221,11 +221,6 @@ static int max9286_write(struct max9286_priv *priv, u8 reg, u8 val) * I2C Multiplexer */ -enum max9286_i2c_mux_state { - MAX9286_MUX_CLOSED = 0, - MAX9286_MUX_OPEN, -}; - static void max9286_i2c_mux_configure(struct max9286_priv *priv, u8 conf) { max9286_write(priv, 0x0a, conf); @@ -242,7 +237,7 @@ static void max9286_i2c_mux_open(struct max9286_priv *priv) /* Open all channels on the MAX9286 */ max9286_i2c_mux_configure(priv, 0xff); - priv->mux_state = MAX9286_MUX_OPEN; + priv->mux_open = true; } static void max9286_i2c_mux_close(struct max9286_priv *priv) @@ -254,7 +249,7 @@ static void max9286_i2c_mux_close(struct max9286_priv *priv) */ max9286_i2c_mux_configure(priv, 0x00); - priv->mux_state = MAX9286_MUX_CLOSED; + priv->mux_open = false; priv->mux_channel = -1; } @@ -263,7 +258,7 @@ static int max9286_i2c_mux_select(struct i2c_mux_core *muxc, u32 chan) struct max9286_priv *priv = i2c_mux_priv(muxc); /* Channel select is disabled when configured in the opened state. */ - if (priv->mux_state == MAX9286_MUX_OPEN) + if (priv->mux_open) return 0; if (priv->mux_channel == chan) -- 2.20.1