summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-11-16 14:54:54 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-11-16 14:54:54 +0000
commit2266b3b619aeb10b186539341c10d617f326e213 (patch)
tree8f3ba28da635984c8793ad001f12e6b12b30de79
parentffd04cf090d2da3f6ea160721bcc2c69e3695a47 (diff)
downloadnuttx-2266b3b619aeb10b186539341c10d617f326e213.tar.gz
nuttx-2266b3b619aeb10b186539341c10d617f326e213.tar.bz2
nuttx-2266b3b619aeb10b186539341c10d617f326e213.zip
cosmetic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1253 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--nuttx/drivers/loop.c8
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);