[PATCH 16/24] V4L: Some error treatment implemented at resume functions.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



.
- Some error treatment implemented at resume functions.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>

 linux/drivers/media/video/bttv-driver.c     |   18 ++++++++++++++++--
 linux/drivers/media/video/cx88/cx88-mpeg.c  |   20 +++++++++++++++++---
 linux/drivers/media/video/cx88/cx88-video.c |   20 ++++++++++++++++++--
 3 files changed, 51 insertions(+), 7 deletions(-)

diff -u /tmp/dst.587 linux/drivers/media/video/bttv-driver.c
--- /tmp/dst.587	2005-09-05 11:43:02.000000000 -0300
+++ linux/drivers/media/video/bttv-driver.c	2005-09-05 11:43:02.000000000 -0300
@@ -4112,15 +4112,29 @@
 {
         struct bttv *btv = pci_get_drvdata(pci_dev);
 	unsigned long flags;
+	int err;
 
 	dprintk("bttv%d: resume\n", btv->c.nr);
 
 	/* restore pci state */
 	if (btv->state.disabled) {
-		pci_enable_device(pci_dev);
+		err=pci_enable_device(pci_dev);
+		if (err) {
+			printk(KERN_WARNING "bttv%d: Can't enable device.\n",
+								btv->c.nr);
+			return err;
+		}
 		btv->state.disabled = 0;
 	}
-	pci_set_power_state(pci_dev, PCI_D0);
+	err=pci_set_power_state(pci_dev, PCI_D0);
+	if (err) {
+		pci_disable_device(pci_dev);
+		printk(KERN_WARNING "bttv%d: Can't enable device.\n",
+							btv->c.nr);
+		btv->state.disabled = 1;
+		return err;
+	}
+
 	pci_restore_state(pci_dev);
 
 	/* restore bt878 state */
diff -u /tmp/dst.587 linux/drivers/media/video/cx88/cx88-video.c
--- /tmp/dst.587	2005-09-05 11:43:02.000000000 -0300
+++ linux/drivers/media/video/cx88/cx88-video.c	2005-09-05 11:43:02.000000000 -0300
@@ -2005,12 +2005,28 @@
 {
 	struct cx8800_dev *dev = pci_get_drvdata(pci_dev);
 	struct cx88_core *core = dev->core;
+	int err;
 
 	if (dev->state.disabled) {
-		pci_enable_device(pci_dev);
+		err=pci_enable_device(pci_dev);
+		if (err) {
+			printk(KERN_ERR "%s: can't enable device\n",
+						       core->name);
+			return err;
+		}
+
 		dev->state.disabled = 0;
 	}
-	pci_set_power_state(pci_dev, PCI_D0);
+	err= pci_set_power_state(pci_dev, PCI_D0);
+	if (err) {
+		printk(KERN_ERR "%s: can't enable device\n",
+				       core->name);
+
+		pci_disable_device(pci_dev);
+		dev->state.disabled = 1;
+	
+		return err;
+	}
 	pci_restore_state(pci_dev);
 
 	/* FIXME: re-initialize hardware */
diff -u /tmp/dst.587 linux/drivers/media/video/cx88/cx88-mpeg.c
--- /tmp/dst.587	2005-09-05 11:43:02.000000000 -0300
+++ linux/drivers/media/video/cx88/cx88-mpeg.c	2005-09-05 11:43:02.000000000 -0300
@@ -455,14 +455,28 @@
 
 int cx8802_resume_common(struct pci_dev *pci_dev)
 {
-        struct cx8802_dev *dev = pci_get_drvdata(pci_dev);
+	struct cx8802_dev *dev = pci_get_drvdata(pci_dev);
 	struct cx88_core *core = dev->core;
+	int err;
 
 	if (dev->state.disabled) {
-		pci_enable_device(pci_dev);
+		err=pci_enable_device(pci_dev);
+		if (err) {
+			printk(KERN_ERR "%s: can't enable device\n",
+					       dev->core->name);
+			return err;
+		}
 		dev->state.disabled = 0;
 	}
-	pci_set_power_state(pci_dev, PCI_D0);
+	err=pci_set_power_state(pci_dev, PCI_D0);
+	if (err) {
+		printk(KERN_ERR "%s: can't enable device\n",
+					       dev->core->name);
+		pci_disable_device(pci_dev);
+		dev->state.disabled = 1;
+
+		return err;
+	}
 	pci_restore_state(pci_dev);
 
 	/* FIXME: re-initialize hardware */

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux