diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2008-11-16 14:54:54 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2008-11-16 14:54:54 +0000 |
commit | 2266b3b619aeb10b186539341c10d617f326e213 (patch) | |
tree | 8f3ba28da635984c8793ad001f12e6b12b30de79 /nuttx/drivers | |
parent | ffd04cf090d2da3f6ea160721bcc2c69e3695a47 (diff) | |
download | px4-nuttx-2266b3b619aeb10b186539341c10d617f326e213.tar.gz px4-nuttx-2266b3b619aeb10b186539341c10d617f326e213.tar.bz2 px4-nuttx-2266b3b619aeb10b186539341c10d617f326e213.zip |
cosmetic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1253 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/drivers')
-rw-r--r-- | nuttx/drivers/loop.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/nuttx/drivers/loop.c b/nuttx/drivers/loop.c index c1a160be0..21e68e9cb 100644 --- a/nuttx/drivers/loop.c +++ b/nuttx/drivers/loop.c @@ -150,6 +150,8 @@ static int loop_open(FAR struct inode *inode) DEBUGASSERT(inode && inode->i_private); dev = (FAR struct loop_struct_s *)inode->i_private; + /* Make sure we have exclusive access to the state structure */ + loop_semtake(dev); if (dev->opencnt == MAX_OPENCNT) { @@ -157,6 +159,8 @@ static int loop_open(FAR struct inode *inode) } else { + /* Increment the open count */ + dev->opencnt++; } loop_semgive(dev); @@ -178,6 +182,8 @@ static int loop_close(FAR struct inode *inode) DEBUGASSERT(inode && inode->i_private); dev = (FAR struct loop_struct_s *)inode->i_private; + /* Make sure we have exclusive access to the state structure */ + loop_semtake(dev); if (dev->opencnt == 0) { @@ -185,6 +191,8 @@ static int loop_close(FAR struct inode *inode) } else { + /* Decrement the open count */ + dev->opencnt--; } loop_semgive(dev); |