Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0149871c authored by Tomasz Figa's avatar Tomasz Figa Committed by Mark Brown
Browse files

spi: s3c64xx: Do not request CS GPIO on subsequent calls to .setup()



Comments in linux/spi/spi.h and observed behavior show that .setup()
callback can be called multiple times without corresponding calls to
.cleanup(), what was incorrectly assumed by spi-s3c64xx driver, leading
to failures trying to request CS GPIO multiple times.

This patch modifies the behavior of spi-s3c64xx driver to request CS
GPIO only on first call to .setup() after last .cleanup().

Signed-off-by: default avatarTomasz Figa <tomasz.figa@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent b1a8e78d
Loading
Loading
Loading
Loading
+12 −11
Original line number Diff line number Diff line
@@ -1071,6 +1071,7 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
		return -ENODEV;
	}

	if (!spi_get_ctldata(spi)) {
		/* Request gpio only if cs line is asserted by gpio pins */
		if (sdd->cs_gpio) {
			err = gpio_request_one(cs->line, GPIOF_OUT_INIT_HIGH,
@@ -1083,8 +1084,8 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
			}
		}

	if (!spi_get_ctldata(spi))
		spi_set_ctldata(spi, cs);
	}

	sci = sdd->cntrlr_info;