From: Jonathan Nieder <jrnieder@gmail.com>
To: linux-media@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
Mauro Carvalho Chehab <mchehab@redhat.com>,
Dan Carpenter <error27@gmail.com>,
Hans Verkuil <hverkuil@xs4all.nl>, Andi Huber <hobrom@gmx.at>,
Marlon de Boer <marlon@hyves.nl>,
Damien Churchill <damoxc@gmail.com>
Subject: [PATCH 7/7] [media] cx88: don't use atomic_t for core->users
Date: Sun, 1 May 2011 04:31:40 -0500 [thread overview]
Message-ID: <20110501093140.GG18380@elie> (raw)
In-Reply-To: <20110501091710.GA18263@elie>
users is always read or written with core->lock held. A plain int is
simpler and faster.
Tested-by: Andi Huber <hobrom@gmx.at>
Tested-by: Marlon de Boer <marlon@hyves.nl>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
That's the end of the series. Thanks for reading.
drivers/media/video/cx88/cx88-video.c | 5 +++--
drivers/media/video/cx88/cx88.h | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index 508dabb..51d1b09 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -823,7 +823,7 @@ static int video_open(struct file *file)
call_all(core, tuner, s_radio);
}
- atomic_inc(&core->users);
+ core->users++;
mutex_unlock(&core->lock);
return 0;
@@ -921,7 +921,8 @@ static int video_release(struct file *file)
file->private_data = NULL;
kfree(fh);
- if(atomic_dec_and_test(&dev->core->users))
+ dev->core->users--;
+ if (!dev->core->users)
call_all(dev->core, core, s_power, 0);
mutex_unlock(&dev->core->lock);
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index 09e329f..887a978 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -383,7 +383,7 @@ struct cx88_core {
struct mutex lock;
/* various v4l controls */
u32 freq;
- atomic_t users;
+ int users;
int mpeg_users;
/* cx88-video needs to access cx8802 for hybrid tuner pll access. */
--
1.7.5
next prev parent reply other threads:[~2011-05-01 9:31 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-01 9:17 [PATCH v2.6.38 resend 0/7] cx88 deadlock and data races Jonathan Nieder
2011-05-01 9:29 ` [PATCH 1/7] [media] cx88: protect per-device driver list with device lock Jonathan Nieder
2011-05-01 9:29 ` [PATCH 2/7] [media] cx88: fix locking of sub-driver operations Jonathan Nieder
2011-05-01 9:29 ` [PATCH 3/7] [media] cx88: hold device lock during sub-driver initialization Jonathan Nieder
2011-05-01 9:30 ` [PATCH 4/7] [media] cx88: protect cx8802_devlist with a mutex Jonathan Nieder
2011-05-01 9:30 ` [PATCH 5/7] [media] cx88: gracefully reject attempts to use unregistered cx88-blackbird driver Jonathan Nieder
2011-05-01 9:31 ` [PATCH 6/7] [media] cx88: don't use atomic_t for core->mpeg_users Jonathan Nieder
2011-05-01 9:31 ` Jonathan Nieder [this message]
2011-05-01 11:27 ` [PATCH v2.6.38 resend 0/7] cx88 deadlock and data races linuxtv
2011-05-02 8:19 ` cx88 sound does not always work (Re: [PATCH v2.6.38 resend 0/7] cx88 deadlock and data races) Jonathan Nieder
2011-05-02 18:40 ` linuxtv
2011-05-04 9:09 ` hubstar
2011-05-04 9:23 ` cx88 sound does not always work Jonathan Nieder
2011-05-04 9:55 ` hubstar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110501093140.GG18380@elie \
--to=jrnieder@gmail.com \
--cc=damoxc@gmail.com \
--cc=error27@gmail.com \
--cc=hobrom@gmx.at \
--cc=hverkuil@xs4all.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=marlon@hyves.nl \
--cc=mchehab@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.