aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/muxes/i2c-mux-gpio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c/muxes/i2c-mux-gpio.c')
-rw-r--r--drivers/i2c/muxes/i2c-mux-gpio.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/i2c/muxes/i2c-mux-gpio.c b/drivers/i2c/muxes/i2c-mux-gpio.c
index abc2e55aa243..5a0ce0081dce 100644
--- a/drivers/i2c/muxes/i2c-mux-gpio.c
+++ b/drivers/i2c/muxes/i2c-mux-gpio.c
@@ -201,10 +201,21 @@ static int i2c_mux_gpio_probe(struct platform_device *pdev)
201 201
202 for (i = 0; i < mux->data.n_gpios; i++) { 202 for (i = 0; i < mux->data.n_gpios; i++) {
203 ret = gpio_request(gpio_base + mux->data.gpios[i], "i2c-mux-gpio"); 203 ret = gpio_request(gpio_base + mux->data.gpios[i], "i2c-mux-gpio");
204 if (ret) 204 if (ret) {
205 dev_err(&pdev->dev, "Failed to request GPIO %d\n",
206 mux->data.gpios[i]);
205 goto err_request_gpio; 207 goto err_request_gpio;
206 gpio_direction_output(gpio_base + mux->data.gpios[i], 208 }
207 initial_state & (1 << i)); 209
210 ret = gpio_direction_output(gpio_base + mux->data.gpios[i],
211 initial_state & (1 << i));
212 if (ret) {
213 dev_err(&pdev->dev,
214 "Failed to set direction of GPIO %d to output\n",
215 mux->data.gpios[i]);
216 i++; /* gpio_request above succeeded, so must free */
217 goto err_request_gpio;
218 }
208 } 219 }
209 220
210 for (i = 0; i < mux->data.n_values; i++) { 221 for (i = 0; i < mux->data.n_values; i++) {