Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

HSI: nokia-modem: use flags argument of devm_gpiod_get to set direction

Since 39b2bbe3d715 (gpio: add flags argument to gpiod_get*() functions)
which appeared in v3.17-rc1, the gpiod_get* functions take an additional
parameter that allows to specify direction and initial value for output.

Use this to simplify the driver. Furthermore this is one caller less
that stops us making the flags argument to gpiod_get*() mandatory.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>

authored by

Uwe Kleine-König and committed by
Sebastian Reichel
f451e76f 505875e1

+2 -5
+2 -5
drivers/hsi/clients/nokia-modem.c
··· 112 112 modem->gpio_amount = gpio_count; 113 113 114 114 for (i = 0; i < gpio_count; i++) { 115 - modem->gpios[i].gpio = devm_gpiod_get_index(dev, NULL, i); 115 + modem->gpios[i].gpio = devm_gpiod_get_index(dev, NULL, i, 116 + GPIOD_OUT_LOW); 116 117 if (IS_ERR(modem->gpios[i].gpio)) { 117 118 dev_err(dev, "Could not get gpio %d\n", i); 118 119 return PTR_ERR(modem->gpios[i].gpio); ··· 125 124 dev_err(dev, "Could not get gpio name %d\n", i); 126 125 return err; 127 126 } 128 - 129 - err = gpiod_direction_output(modem->gpios[i].gpio, 0); 130 - if (err) 131 - return err; 132 127 133 128 err = gpiod_export(modem->gpios[i].gpio, 0); 134 129 if (err)