[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20110405011640.GB1830@elie>
Date: Mon, 4 Apr 2011 20:16:40 -0500
From: Jonathan Nieder <jrnieder@...il.com>
To: Andreas Huber <hobrom@....at>
Cc: linux-media@...r.kernel.org, Huber Andreas <hobrom@...ax.at>,
Mauro Carvalho Chehab <mchehab@...hat.com>,
Hans Verkuil <hverkuil@...all.nl>,
linux-kernel@...r.kernel.org, andrew.walker27@...world.com,
Ben Hutchings <ben@...adent.org.uk>,
Trent Piepho <xyzzy@...akeasy.org>,
Roland Stoll <dvb.rs@...dex.de>
Subject: Re: [PATCH 3/3] [media] cx88: use a mutex to protect cx8802_devlist
Hi again,
Andreas Huber wrote:
> [...]
> /* Make sure we can acquire the hardware */
> drv = cx8802_get_driver(dev, CX88_MPEG_BLACKBIRD); // HOW TO DEAL WITH NULL ??????
> if (drv) {
Reasonable question. Could you try this patch?
-- 8< --
Subject: [media] cx88: lock device during driver initialization
Reported-by: Andreas Huber <hobrom@....at>
Signed-off-by: Jonathan Nieder <jrnieder@...il.com>
---
drivers/media/video/cx88/cx88-blackbird.c | 2 --
drivers/media/video/cx88/cx88-mpeg.c | 5 ++---
drivers/media/video/cx88/cx88.h | 7 ++-----
3 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index a6f7d53..f637d34 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -1335,11 +1335,9 @@ static int cx8802_blackbird_probe(struct cx8802_driver *drv)
blackbird_register_video(dev);
/* initial device configuration: needed ? */
- mutex_lock(&dev->core->lock);
// init_controls(core);
cx88_set_tvnorm(core,core->tvnorm);
cx88_video_mux(core,0);
- mutex_unlock(&dev->core->lock);
return 0;
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c
index 6b58647..b18f9fe 100644
--- a/drivers/media/video/cx88/cx88-mpeg.c
+++ b/drivers/media/video/cx88/cx88-mpeg.c
@@ -714,18 +714,17 @@ int cx8802_register_driver(struct cx8802_driver *drv)
drv->request_release = cx8802_request_release;
memcpy(driver, drv, sizeof(*driver));
+ mutex_lock(&drv->core->lock);
err = drv->probe(driver);
if (err == 0) {
i++;
- mutex_lock(&drv->core->lock);
list_add_tail(&driver->drvlist, &dev->drvlist);
- mutex_unlock(&drv->core->lock);
} else {
printk(KERN_ERR
"%s/2: cx8802 probe failed, err = %d\n",
dev->core->name, err);
}
-
+ mutex_unlock(&drv->core->lock);
}
err = i ? 0 : -ENODEV;
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index 9731daa..3d32f4a 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -505,13 +505,10 @@ struct cx8802_driver {
int (*suspend)(struct pci_dev *pci_dev, pm_message_t state);
int (*resume)(struct pci_dev *pci_dev);
+ /* Callers to the following functions must hold core->lock */
+
/* MPEG 8802 -> mini driver - Driver probe and configuration */
-
- /* Caller must _not_ hold core->lock */
int (*probe)(struct cx8802_driver *drv);
-
- /* Callers to the following functions must hold core->lock */
-
int (*remove)(struct cx8802_driver *drv);
/* MPEG 8802 -> mini driver - Access for hardware control */
--
1.7.5.rc0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists