x1000: fix nand driver reference counting
Somehow I screwed this up as well. Seems it didn't cause trouble. Change-Id: I5ab99dd9182a4e60d55984fecbf20ca823dbd004
This commit is contained in:
parent
3cb7167e22
commit
d541a3a191
1 changed files with 5 additions and 3 deletions
|
@ -190,8 +190,10 @@ static void setup_chip_registers(nand_drv* drv)
|
||||||
|
|
||||||
int nand_open(nand_drv* drv)
|
int nand_open(nand_drv* drv)
|
||||||
{
|
{
|
||||||
if(drv->refcount > 0)
|
if(drv->refcount > 0) {
|
||||||
|
drv->refcount++;
|
||||||
return NAND_SUCCESS;
|
return NAND_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize the controller */
|
/* Initialize the controller */
|
||||||
sfc_open();
|
sfc_open();
|
||||||
|
@ -222,7 +224,8 @@ int nand_open(nand_drv* drv)
|
||||||
|
|
||||||
void nand_close(nand_drv* drv)
|
void nand_close(nand_drv* drv)
|
||||||
{
|
{
|
||||||
if(drv->refcount == 0)
|
--drv->refcount;
|
||||||
|
if(drv->refcount > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Let's reset the chip... the idea is to restore the registers
|
/* Let's reset the chip... the idea is to restore the registers
|
||||||
|
@ -231,7 +234,6 @@ void nand_close(nand_drv* drv)
|
||||||
mdelay(10);
|
mdelay(10);
|
||||||
|
|
||||||
sfc_close();
|
sfc_close();
|
||||||
drv->refcount--;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t nand_wait_busy(nand_drv* drv)
|
static uint8_t nand_wait_busy(nand_drv* drv)
|
||||||
|
|
Loading…
Reference in a new issue