The patch below fixes a potential starvation issue that can arise when
there is contention on a chip during a period when a process is
currently writing to it.  The starvation is avoided by conditionally
rescheduling when the chip is left in a state usable by other processes.
Signed-off-by: Josh Boyer <jdub@us.ibm.com>
Signed-off-by: Tom Gall <tom_gall@vnet.ibm.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
                        if (chipnum == cfi->numchips)
                                return 0;
                }
+
+               /* Be nice and reschedule with the chip in a usable state for other
+                  processes. */
+               cond_resched();
+
        } while (len);
 
        return 0;