forked from len0rd/rockbox
Removed a potential I2C deadlock
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2879 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
c833a816d8
commit
63f0b5ec3a
1 changed files with 18 additions and 16 deletions
|
@ -380,9 +380,10 @@ int mas_codec_readreg(int reg)
|
||||||
/* send read command */
|
/* send read command */
|
||||||
if (i2c_write(MAS_DEV_WRITE,buf,3))
|
if (i2c_write(MAS_DEV_WRITE,buf,3))
|
||||||
{
|
{
|
||||||
return -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
i2c_start();
|
i2c_start();
|
||||||
i2c_outb(MAS_DEV_WRITE);
|
i2c_outb(MAS_DEV_WRITE);
|
||||||
if (i2c_getack()) {
|
if (i2c_getack()) {
|
||||||
|
@ -395,16 +396,17 @@ int mas_codec_readreg(int reg)
|
||||||
tmp[1] = i2c_inb(1); /* NAK the last byte */
|
tmp[1] = i2c_inb(1); /* NAK the last byte */
|
||||||
ret = (tmp[0] << 8) | tmp[1];
|
ret = (tmp[0] << 8) | tmp[1];
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
ret = -4;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
ret = -3;
|
ret = -3;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ret = -2;
|
ret = -2;
|
||||||
}
|
|
||||||
else
|
|
||||||
ret = -1;
|
|
||||||
|
|
||||||
i2c_stop();
|
i2c_stop();
|
||||||
|
}
|
||||||
|
|
||||||
i2c_end();
|
i2c_end();
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue