summary refs log tree commit diff
path: root/drivers/spi/spi_bitbang.c
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hans-peter.nilsson@axis.com>2007-02-12 00:52:44 -0800
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-12 09:48:31 -0800
commit7f8c7619ea1ff5ab8e0b08c8120d629834ef4253 (patch)
tree722c72263bb4259bc787b8236673e727182dac98 /drivers/spi/spi_bitbang.c
parentddc1e9753106cedcca7944d2b068baa2e14640b1 (diff)
downloadlinux-7f8c7619ea1ff5ab8e0b08c8120d629834ef4253.tar.gz
[PATCH] spi_bitbang(): use overridable setup_transfer() method
A small bug-fix for spi_bitbang: it must always call the setup_transfer
function via the overridable pointer, not assume that its
spi_bitbang_setup_transfer is sufficient.  Otherwise, if all options in the
transfers are default (0), the overrided function will never be called.

Granted, the function replacing it must call spi_bitbang_setup_transfer,
but it might also have other important things to do, even if the second
argument (the spi_transfer) is NULL.  Tested together with the other
patches on the spi_crisv32_sser and spi_crisv32_gpio drivers (not yet in
the kernel, will IIUC be submitted as part of the usual
arch-maintainer-pushes).

Signed-off-by: Hans-Peter Nilsson <hp@axis.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/spi/spi_bitbang.c')
-rw-r--r--drivers/spi/spi_bitbang.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c
index 57289b61d0be..a5dadc74cee6 100644
--- a/drivers/spi/spi_bitbang.c
+++ b/drivers/spi/spi_bitbang.c
@@ -210,7 +210,7 @@ int spi_bitbang_setup(struct spi_device *spi)
 	if (!cs->txrx_word)
 		return -EINVAL;
 
-	retval = spi_bitbang_setup_transfer(spi, NULL);
+	retval = bitbang->setup_transfer(spi, NULL);
 	if (retval < 0)
 		return retval;
 
@@ -442,9 +442,10 @@ EXPORT_SYMBOL_GPL(spi_bitbang_transfer);
  * hardware that basically exposes a shift register) or per-spi_transfer
  * (which takes better advantage of hardware like fifos or DMA engines).
  *
- * Drivers using per-word I/O loops should use (or call) spi_bitbang_setup and
- * spi_bitbang_cleanup to handle those spi master methods.  Those methods are
- * the defaults if the bitbang->txrx_bufs routine isn't initialized.
+ * Drivers using per-word I/O loops should use (or call) spi_bitbang_setup,
+ * spi_bitbang_cleanup and spi_bitbang_setup_transfer to handle those spi
+ * master methods.  Those methods are the defaults if the bitbang->txrx_bufs
+ * routine isn't initialized.
  *
  * This routine registers the spi_master, which will process requests in a
  * dedicated task, keeping IRQs unblocked most of the time.  To stop