diff options
author | Tomasz Figa <tomasz.figa@gmail.com> | 2013-08-10 20:33:29 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-08-11 09:06:30 -0400 |
commit | 0149871c428cc8cb44337703ca46a98a6b541b42 (patch) | |
tree | 4241d6555f8be9cfe0ad815d61bea1830eedfe48 /drivers/spi/spi-s3c64xx.c | |
parent | b1a8e78d173081c303bea88e92a1e1423befca63 (diff) |
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: Tomasz Figa <tomasz.figa@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/spi/spi-s3c64xx.c')
-rw-r--r-- | drivers/spi/spi-s3c64xx.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index d67384b3c318..2330dceb27cc 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c | |||
@@ -1071,20 +1071,21 @@ static int s3c64xx_spi_setup(struct spi_device *spi) | |||
1071 | return -ENODEV; | 1071 | return -ENODEV; |
1072 | } | 1072 | } |
1073 | 1073 | ||
1074 | /* Request gpio only if cs line is asserted by gpio pins */ | 1074 | if (!spi_get_ctldata(spi)) { |
1075 | if (sdd->cs_gpio) { | 1075 | /* Request gpio only if cs line is asserted by gpio pins */ |
1076 | err = gpio_request_one(cs->line, GPIOF_OUT_INIT_HIGH, | 1076 | if (sdd->cs_gpio) { |
1077 | dev_name(&spi->dev)); | 1077 | err = gpio_request_one(cs->line, GPIOF_OUT_INIT_HIGH, |
1078 | if (err) { | 1078 | dev_name(&spi->dev)); |
1079 | dev_err(&spi->dev, | 1079 | if (err) { |
1080 | "Failed to get /CS gpio [%d]: %d\n", | 1080 | dev_err(&spi->dev, |
1081 | cs->line, err); | 1081 | "Failed to get /CS gpio [%d]: %d\n", |
1082 | goto err_gpio_req; | 1082 | cs->line, err); |
1083 | goto err_gpio_req; | ||
1084 | } | ||
1083 | } | 1085 | } |
1084 | } | ||
1085 | 1086 | ||
1086 | if (!spi_get_ctldata(spi)) | ||
1087 | spi_set_ctldata(spi, cs); | 1087 | spi_set_ctldata(spi, cs); |
1088 | } | ||
1088 | 1089 | ||
1089 | sci = sdd->cntrlr_info; | 1090 | sci = sdd->cntrlr_info; |
1090 | 1091 | ||