• ben@fluff.org.uk's avatar
    s3cmci: fix continual accesses to host->pio_ptr · 18280fff
    ben@fluff.org.uk authored
    The s3cmci driver uses the host->pio_ptr field to
    point to the current position into the buffer for data
    transfer. During the transfers it does the following:
    
    	while (fifo_words--)
    		*(host->pio_ptr++) = readl(from_ptr);
    
    This is inefficent, as host->pio_ptr is not used in any
    other part of the transfer but the compiler emits code
    which does the following:
    
    	while (fifo_words--) {
    		u32 *ptr = host->pio_ptr;
    		*ptr = readl(from_ptr);
    		ptr++;
    		host->pio_ptr = ptr;
    	}
    
    This is obviously a waste of a load and store each time
    around the loop, which could be up to 16 times depending
    on how much needs to be transfered.
    
    Move the ptr accesses to outside the while loop so that
    we do not end up reloading/re-writing the pointer.
    
    Note, this seems to make the code 16 bytes larger.
    Signed-off-by: default avatarBen Dooks <ben-linux@fluff.org>
    Signed-off-by: default avatarPierre Ossman <drzeus@drzeus.cx>
    18280fff
s3cmci.c 37.6 KB