[PATCH] v4l: some error treatment implemented at resume functions.

- Some error treatment implemented at resume functions.

Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Mauro Carvalho Chehab 2005-09-09 13:03:55 -07:00 committed by Linus Torvalds
parent 4c93b07a48
commit 08adb9e20b
3 changed files with 51 additions and 7 deletions

View file

@ -4111,15 +4111,29 @@ static int bttv_resume(struct pci_dev *pci_dev)
{
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 */

View file

@ -455,14 +455,28 @@ int cx8802_suspend_common(struct pci_dev *pci_dev, pm_message_t state)
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 */

View file

@ -2005,12 +2005,28 @@ static int cx8800_resume(struct pci_dev *pci_dev)
{
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 */