summaryrefslogtreecommitdiff
path: root/linux/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers')
-rw-r--r--linux/drivers/media/video/tuner-xc2028.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/linux/drivers/media/video/tuner-xc2028.c b/linux/drivers/media/video/tuner-xc2028.c
index 3f0203b7a..a4bd6312f 100644
--- a/linux/drivers/media/video/tuner-xc2028.c
+++ b/linux/drivers/media/video/tuner-xc2028.c
@@ -55,6 +55,8 @@ MODULE_PARM_DESC(audio_std,
"NICAM/B\n");
static LIST_HEAD(xc2028_list);
+static DEFINE_MUTEX(xc2028_list_mutex);
+
/* struct for storing firmware table */
struct firmware_description {
unsigned int type;
@@ -871,6 +873,8 @@ static int xc2028_dvb_release(struct dvb_frontend *fe)
tuner_dbg("%s called\n", __FUNCTION__);
+ mutex_lock(&xc2028_list_mutex);
+
priv->count--;
if (!priv->count) {
@@ -882,6 +886,8 @@ static int xc2028_dvb_release(struct dvb_frontend *fe)
kfree(priv);
}
+ mutex_unlock(&xc2028_list_mutex);
+
return 0;
}
@@ -962,6 +968,8 @@ void *xc2028_attach(struct dvb_frontend *fe, struct xc2028_config *cfg)
video_dev = cfg->video_dev;
+ mutex_lock(&xc2028_list_mutex);
+
list_for_each_entry(priv, &xc2028_list, xc2028_list) {
if (priv->video_dev == cfg->video_dev) {
video_dev = NULL;
@@ -971,8 +979,10 @@ void *xc2028_attach(struct dvb_frontend *fe, struct xc2028_config *cfg)
if (video_dev) {
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
- if (priv == NULL)
+ if (priv == NULL) {
+ mutex_unlock(&xc2028_list_mutex);
return NULL;
+ }
priv->bandwidth = BANDWIDTH_6_MHZ;
priv->need_load_generic = 1;
@@ -996,6 +1006,8 @@ void *xc2028_attach(struct dvb_frontend *fe, struct xc2028_config *cfg)
tuner_info("type set to %s\n", "XCeive xc2028/xc3028 tuner");
+ mutex_unlock(&xc2028_list_mutex);
+
return fe;
}