video: sh_mobile_lcdcfb: Don't attempt to map zero-length scatterlists.
authorPaul Mundt <lethal@linux-sh.org>
Wed, 4 Nov 2009 06:59:04 +0000 (15:59 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Wed, 4 Nov 2009 06:59:04 +0000 (15:59 +0900)
commit5c1a56b5f616f7063f91eb85f0ea209658f387dc
tree227964f2cbde7986538836e153da33879ed4822d
parent9016332014404ae1dca7198f93804ac67ba9e918
video: sh_mobile_lcdcfb: Don't attempt to map zero-length scatterlists.

More aggressive DMA mapping debugging has uncovered a long-standing
buglet in the way that the sh_mobile_lcdcfb driver implements its
deferred I/O callback. When used as a console driver the acceleration
routines are called by the kernel which subsequently cause the deferred
I/O work to be scheduled, resulting in the deferred I/O callback being
entered without any dirty pages on the pagelist (the normal case for
userspace accesses). It's also possible to get in to this situation via
explicit calling of fsync() when nothing has dirtied the region.

Unfortunately it's not sufficient to skip over the callback when the
pagelist is empty given the console driver use case, so instead the
callback has to conditionalize the work for panel updates and DMA
mapping depending on whether anything is resident on the pagelist or
not.

Reported-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
drivers/video/sh_mobile_lcdcfb.c