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

ASoC: jack - add_gpiods accepts filled descriptors

Allow for the desc field to be pre-filled when adding gpios to a jack.
This allows drivers to get the gpios and decide if they should be added
to the list or not. Specifically this will allow the gpio jack driver
to add gpios based on device property specifications.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Dylan Reid and committed by
Mark Brown
e616d2eb 1fb1e0ec

+6 -3
+6 -3
sound/soc/soc-jack.c
··· 315 315 goto undo; 316 316 } 317 317 318 - if (gpios[i].gpiod_dev) { 319 - /* GPIO descriptor */ 318 + if (gpios[i].desc) { 319 + /* Already have a GPIO descriptor. */ 320 + goto got_gpio; 321 + } else if (gpios[i].gpiod_dev) { 322 + /* Get a GPIO descriptor */ 320 323 gpios[i].desc = gpiod_get_index(gpios[i].gpiod_dev, 321 324 gpios[i].name, 322 325 gpios[i].idx, GPIOD_IN); ··· 347 344 348 345 gpios[i].desc = gpio_to_desc(gpios[i].gpio); 349 346 } 350 - 347 + got_gpio: 351 348 INIT_DELAYED_WORK(&gpios[i].work, gpio_work); 352 349 gpios[i].jack = jack; 353 350