[<prev] [next>] [day] [month] [year] [list]
Message-Id: <201306090810.r598A3D1013107@localhost.localdomain>
Date: Sun, 9 Jun 2013 10:10:03 +0200
From: Christophe Leroy <christophe.leroy@....fr>
To: Grant Likely <grant.likely@...retlab.ca>
CC: linux-kernel@...r.kernel.org,
spi-devel-general@...ts.sourceforge.net,
Laxman Dewangan <ldewangan@...dia.com>
Subject: [PATCH] Fix regression on spi-fsl-spi.c following modification on spi.c
spi-fsl-spi.c made the assumption that t->bits_per_word and t->speed_hz were
set only when wanting to change the setting.
Since commit e6811d1d7a6a38ee637fe219c3b67dbfe17e8b3f, t->bits_per_word has
been set in all transfers, therefore the assumption made by the driver leads to
failure. This patch fixes the issue by comparing the t->new bits_per_word and
t->speed_hz with the previous one in order to determine if one of them changed.
Signed-off-by: Christophe Leroy <christophe.leroy@....fr>
--- linux-3.8.13/drivers/spi/spi-fsl-spi.c 2013-05-11 22:57:46.000000000 +0200
+++ linux/drivers/spi/spi-fsl-spi.c 2013-06-09 00:13:30.000000000 +0200
@@ -476,11 +476,14 @@
unsigned int cs_change;
const int nsecs = 50;
int status;
+ u32 prev_speed_hz = 0;
+ u8 prev_bits_per_word = 0;
cs_change = 1;
status = 0;
list_for_each_entry(t, &m->transfers, transfer_list) {
- if (t->bits_per_word || t->speed_hz) {
+ if (prev_bits_per_word != t->bits_per_word
+ || prev_speed_hz != t->speed_hz) {
/* Don't allow changes if CS is active */
status = -EINVAL;
@@ -488,6 +491,8 @@
status = fsl_spi_setup_transfer(spi, t);
if (status < 0)
break;
+ prev_bits_per_word = t->bits_per_word;
+ prev_speed_hz = t->speed_hz;
}
if (cs_change) {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists