diff options
author | Fabio Estevam <fabio.estevam@freescale.com> | 2013-07-17 14:49:54 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-07-17 18:34:27 -0400 |
commit | d60990d597bfa2816dfe28a5c5c6787610b423e6 (patch) | |
tree | fe937851b5700028cf3709c6cc388c168b4a6c00 /drivers/spi/spi-bitbang.c | |
parent | 2025172e32808a327b00f968c72baa79adc594c2 (diff) |
spi: spi-bitbang: Fix conversion of spi_bitbang_transfer_one()
Since commit 2025172e3 (spi/bitbang: Use core message pump), the following
kernel crash is seen:
Unable to handle kernel NULL pointer dereference at virtual address 0000000d
pgd = 80004000
[0000000d] *pgd=00000000
Internal error: Oops: 5 [#1] SMP ARM
Modules linked in:
CPU: 1 PID: 48 Comm: spi32766 Not tainted 3.11.0-rc1+ #4
task: bfa3e580 ti: bfb90000 task.ti: bfb90000
PC is at spi_bitbang_transfer_one+0x50/0x248
LR is at spi_bitbang_transfer_one+0x20/0x248
...
,and also the following build warning:
drivers/spi/spi-bitbang.c: In function 'spi_bitbang_start':
drivers/spi/spi-bitbang.c:436:31: warning: assignment from incompatible pointer type [enabled by default]
In order to fix it, we need to change the first parameter of
spi_bitbang_transfer_one() to 'struct spi_master *master'.
Tested on a mx6qsabrelite by succesfully probing a SPI NOR flash.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/spi/spi-bitbang.c')
-rw-r--r-- | drivers/spi/spi-bitbang.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/spi/spi-bitbang.c b/drivers/spi/spi-bitbang.c index c100875cfd42..a89178dc8498 100644 --- a/drivers/spi/spi-bitbang.c +++ b/drivers/spi/spi-bitbang.c | |||
@@ -270,7 +270,7 @@ static int spi_bitbang_prepare_hardware(struct spi_master *spi) | |||
270 | return 0; | 270 | return 0; |
271 | } | 271 | } |
272 | 272 | ||
273 | static int spi_bitbang_transfer_one(struct spi_device *spi, | 273 | static int spi_bitbang_transfer_one(struct spi_master *master, |
274 | struct spi_message *m) | 274 | struct spi_message *m) |
275 | { | 275 | { |
276 | struct spi_bitbang *bitbang; | 276 | struct spi_bitbang *bitbang; |
@@ -280,8 +280,9 @@ static int spi_bitbang_transfer_one(struct spi_device *spi, | |||
280 | unsigned cs_change; | 280 | unsigned cs_change; |
281 | int status; | 281 | int status; |
282 | int do_setup = -1; | 282 | int do_setup = -1; |
283 | struct spi_device *spi = m->spi; | ||
283 | 284 | ||
284 | bitbang = spi_master_get_devdata(spi->master); | 285 | bitbang = spi_master_get_devdata(master); |
285 | 286 | ||
286 | /* FIXME this is made-up ... the correct value is known to | 287 | /* FIXME this is made-up ... the correct value is known to |
287 | * word-at-a-time bitbang code, and presumably chipselect() | 288 | * word-at-a-time bitbang code, and presumably chipselect() |
@@ -372,7 +373,7 @@ static int spi_bitbang_transfer_one(struct spi_device *spi, | |||
372 | ndelay(nsecs); | 373 | ndelay(nsecs); |
373 | } | 374 | } |
374 | 375 | ||
375 | spi_finalize_current_message(spi->master); | 376 | spi_finalize_current_message(master); |
376 | 377 | ||
377 | return status; | 378 | return status; |
378 | } | 379 | } |