From: Ben Dooks Subject: [PATCH] SPI: spi_s3c24xx driver should initialise completion before using it. Date: Fri, 11 Apr 2008 15:55:03 +0100 Message-ID: <20080411145552.235395020@fluff.org.uk> References: <20080411145500.130608954@fluff.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: patch-out-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org, Ben Dooks To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Return-path: Content-Disposition: inline; filename=simtec/simtec-drivers-spi-s3c24xx-initcompletion.patch List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: spi-devel-general-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: spi-devel-general-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: linux-spi.vger.kernel.org The s3c24xx_spi_txrx() function should initialise the completion each time before using it, otherwise we end up with the possibility of returning success before the interrupt handler has processed all the data. Signed-off-by: Ben Dooks Index: linux-2.6.24-quilt16/drivers/spi/spi_s3c24xx.c =================================================================== --- linux-2.6.24-quilt16.orig/drivers/spi/spi_s3c24xx.c +++ linux-2.6.24-quilt16/drivers/spi/spi_s3c24xx.c @@ -192,8 +192,11 @@ static int s3c24xx_spi_txrx(struct spi_d hw->len = t->len; hw->count = 0; + init_completion(&hw->done); + /* send the first byte */ writeb(hw_txbyte(hw, 0), hw->regs + S3C2410_SPTDAT); + wait_for_completion(&hw->done); return hw->count; -- Ben (ben-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org, http://www.fluff.org/) 'a smiley only costs 4 bytes' ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone