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

Commit d60990d5 authored by Fabio Estevam's avatar Fabio Estevam Committed by Mark Brown
Browse files

spi: spi-bitbang: Fix conversion of spi_bitbang_transfer_one()



Since commit 2025172e (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: default avatarFabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 2025172e
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -270,7 +270,7 @@ static int spi_bitbang_prepare_hardware(struct spi_master *spi)
	return 0;
}

static int spi_bitbang_transfer_one(struct spi_device *spi,
static int spi_bitbang_transfer_one(struct spi_master *master,
				    struct spi_message *m)
{
	struct spi_bitbang 	*bitbang;
@@ -280,8 +280,9 @@ static int spi_bitbang_transfer_one(struct spi_device *spi,
	unsigned		cs_change;
	int			status;
	int			do_setup = -1;
	struct spi_device	*spi = m->spi;

	bitbang = spi_master_get_devdata(spi->master);
	bitbang = spi_master_get_devdata(master);

	/* FIXME this is made-up ... the correct value is known to
	 * word-at-a-time bitbang code, and presumably chipselect()
@@ -372,7 +373,7 @@ static int spi_bitbang_transfer_one(struct spi_device *spi,
		ndelay(nsecs);
	}

	spi_finalize_current_message(spi->master);
	spi_finalize_current_message(master);

	return status;
}