From: Hans Schillstrom Date: Tue, 22 Apr 2008 20:16:48 +0000 (+0200) Subject: i2c-bfin-twi: Fix mismatch in add timer and delete timer X-Git-Tag: v2.6.26-rc1~1104^2~3 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=afc13b765ea71d316ce4974d3dc5a96cc73a0e95;p=linux-2.6 i2c-bfin-twi: Fix mismatch in add timer and delete timer Move init_completion to just before i2c transfer. http://blackfin.uclinux.org/gf/project/uclinux-dist/tracker/?action=TrackerItemEdit&tracker_item_id=3385 Signed-off-by: Hans Schillstrom Signed-off-by: Sonic Zhang Signed-off-by: Bryan Wu Signed-off-by: Jean Delvare --- diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c index 4ea31c018e..0cd4d36240 100644 --- a/drivers/i2c/busses/i2c-bfin-twi.c +++ b/drivers/i2c/busses/i2c-bfin-twi.c @@ -308,6 +308,7 @@ static int bfin_twi_master_xfer(struct i2c_adapter *adap, iface->writeNum = iface->readNum = pmsg->len; iface->result = 0; iface->timeout_count = 10; + init_completion(&(iface->complete)); /* Set Transmit device address */ write_MASTER_ADDR(iface, pmsg->addr); @@ -447,6 +448,7 @@ int bfin_twi_smbus_xfer(struct i2c_adapter *adap, u16 addr, iface->read_write = read_write; iface->command = command; iface->timeout_count = 10; + init_completion(&(iface->complete)); /* FIFO Initiation. Data in FIFO should be discarded before * start a new operation. @@ -608,7 +610,6 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev) } spin_lock_init(&(iface->lock)); - init_completion(&(iface->complete)); /* Find and map our resources */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);