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 <[email protected]>

--- 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) {

------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
spi-devel-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spi-devel-general

Reply via email to