Skip to contentSkip to conversation

cr_bllcd: Add suspend/resume support.

PATCH New Michel Dänzer 1 participant 3 messages Aug 16, 2007 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#1 lore raw

PATCH 1/3 cr_bllcd: Add suspend/resume support.

In reply to a message not in the archive

Mostly save and restore all (extended) PCI config space and device registers, with one exception.

Also remove some unused definitions and fix a PTR_ERR() typo.

---
 drivers/video/backlight/cr_bllcd.c |  148 +++++++++++++++++++++++++++++++++---
 1 files changed, 137 insertions(+), 11 deletions(-)
drivers/video/backlight/cr_bllcd.c +137 -11
index b7904da..7048c29 100644
@@ -25,6 +25,7 @@
  * Authors:
  *   Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
  *   Alan Hourihane <alanh-at-tungstengraphics-dot-com>
+ *   Michel D������nzer <michel-at-tungstengraphics-dot-com>
  */
 
 #include <linux/module.h>
@@ -38,6 +39,8 @@
 #include <linux/pci.h>
 #include <asm/uaccess.h>
 
+#define MODULE_NAME "cr_bllcd"
+
 /* The LVDS- and panel power controls sits on the
  * GPIO port of the ISA bridge.
  */
@@ -51,19 +54,25 @@
 #define CRVML_PANEL_ON      0x00000002
 #define CRVML_BACKLIGHT_OFF 0x00000004
 
-/* The PLL Clock register sits on Host bridge */
-#define CRVML_DEVICE_MCH   0x5001
-#define CRVML_REG_MCHBAR   0x44
-#define CRVML_REG_MCHEN    0x54
-#define CRVML_MCHEN_BIT    (1 << 28)
-#define CRVML_MCHMAP_SIZE  4096
-#define CRVML_REG_CLOCK    0xc3c
-#define CRVML_CLOCK_SHIFT  8
-#define CRVML_CLOCK_MASK   0x00000f00
-
 static struct pci_dev *lpc_dev;
 static u32 gpio_bar;
 
+#ifdef CONFIG_PM
+
+#define NUM_LPC_EXTRA_CONFIG_SPACE 45
+static int lpc_saved_config_space[NUM_LPC_EXTRA_CONFIG_SPACE];
+
+#define CRVML_REG_RCBABAR   0xF0
+#define CRVML_RCBAEN_BIT    (1 << 0)
+#define CRVML_RCBAMAP_SIZE  16384
+static u32 rcba_bar;
+static void __iomem *rcba_regs_base;
+
+#define REGSAVE_SIZE (CRVML_RCBAMAP_SIZE + 4)
+static u32 *regsave;
+
+#endif /* CONFIG_PM */
+
 struct cr_panel {
 	struct backlight_device *cr_backlight_device;
 	struct lcd_device *cr_lcd_device;
@@ -169,6 +178,94 @@ static struct lcd_ops cr_lcd_ops = {
 	.set_power = cr_lcd_set_power,
 };
 
+#ifdef CONFIG_PM
+
+static int cr_backlight_suspend(struct platform_device *pdev,
+				pm_message_t state)
+{
+	int i;
+	int reg;
+	int saveidx = 0;
+
+	printk(KERN_DEBUG MODULE_NAME ": suspending to state: %d\n",
+	       state.event);
+
+	regsave = kmalloc(REGSAVE_SIZE, GFP_ATOMIC);
+
+	if (!regsave) {
+		printk(KERN_ERR MODULE_NAME
+		       ": Could not allocate %d bytes for saving registers\n",
+		       REGSAVE_SIZE);
+		return -ENOMEM;
+	}
+
+	/* Save registers and config space */
+
+	regsave[saveidx++] = inl(gpio_bar + CRVML_PANEL_PORT);
+
+	for (reg = 0; reg < CRVML_RCBAMAP_SIZE; reg += 4)
+		regsave[saveidx++] = ioread32(rcba_regs_base + reg);
+
+	pci_save_state(lpc_dev);
+	for (i = 0; i < NUM_LPC_EXTRA_CONFIG_SPACE; i++)
+		pci_read_config_dword(lpc_dev, (i + 16) * 4,
+				      &lpc_saved_config_space[i]);
+	pci_disable_device(lpc_dev);
+	pci_set_power_state(lpc_dev, pci_choose_state(lpc_dev, state));
+
+	pdev->dev.power.power_state = state;
+
+	return 0;
+}
+
+static int cr_backlight_resume(struct platform_device *pdev)
+{
+	int i;
+	int reg;
+	int val;
+	int restoreidx = 0;
+
+	if (pdev->dev.power.power_state.event == PM_EVENT_ON)
+		return 0;
+
+	pci_set_power_state(lpc_dev, PCI_D0);
+	pci_restore_state(lpc_dev);
+	for (i = 0; i < NUM_LPC_EXTRA_CONFIG_SPACE; i++) {
+		if (i == 0x70 / 4)
+			continue;
+
+		pci_read_config_dword(lpc_dev, (i + 16) * 4, &val);
+		if (val != lpc_saved_config_space[i]) {
+			printk(KERN_DEBUG MODULE_NAME ": Writing back config "
+			       "space on device %s at offset %x (was %x, "
+			       "writing %x)\n", pci_name(lpc_dev), (i + 16),
+			       val, lpc_saved_config_space[i]);
+			pci_write_config_dword(lpc_dev, (i + 16) * 4,
+					       lpc_saved_config_space[i]);
+		}
+	}
+	if (pci_enable_device(lpc_dev))
+		return -1;
+
+	outl(regsave[restoreidx++], gpio_bar + CRVML_PANEL_PORT);
+
+	for (reg = 0; reg < CRVML_RCBAMAP_SIZE; reg += 4)
+		iowrite32(regsave[restoreidx++], rcba_regs_base + reg);
+
+	/* Flush posted writes */
+	ioread32(rcba_regs_base);
+
+	kfree(regsave);
+
+	pdev->dev.power.power_state = PMSG_ON;
+
+	printk(KERN_DEBUG MODULE_NAME ": resumed\n");
+
+	return 0;
+}
+
+#endif /* CONFIG_PM */
+
 static int cr_backlight_probe(struct platform_device *pdev)
 {
 	struct cr_panel *crp;
@@ -207,7 +304,7 @@ static int cr_backlight_probe(struct platform_device *pdev)
 
 	if (IS_ERR(crp->cr_lcd_device)) {
 		pci_dev_put(lpc_dev);
-		return PTR_ERR(crp->cr_backlight_device);
+		return PTR_ERR(crp->cr_lcd_device);
 	}
 
 	pci_read_config_dword(lpc_dev, CRVML_REG_GPIOBAR,
@@ -223,6 +320,26 @@ static int cr_backlight_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, crp);
 
+#ifdef CONFIG_PM
+	pci_read_config_dword(lpc_dev, CRVML_REG_RCBABAR, &rcba_bar);
+
+	if (!(rcba_bar & CRVML_RCBAEN_BIT)) {
+		printk(KERN_ERR MODULE_NAME
+		       ": Carillo Ranch LPC device RCBA BAR was not enabled\n");
+		pci_dev_put(lpc_dev);
+		return -ENODEV;
+	}
+
+	rcba_regs_base =
+	    ioremap_nocache(rcba_bar, CRVML_RCBAMAP_SIZE);
+	if (!rcba_regs_base) {
+		printk(KERN_ERR MODULE_NAME
+		       ": Could not map Carillo Ranch RCBA BAR\n");
+		pci_dev_put(lpc_dev);
+		return -ENODEV;
+	}
+#endif /* CONFIG_PM */
+
 	return 0;
 }
 
@@ -236,6 +353,11 @@ static int cr_backlight_remove(struct platform_device *pdev)
 	cr_lcd_set_power(crp->cr_lcd_device, FB_BLANK_POWERDOWN);
 	backlight_device_unregister(crp->cr_backlight_device);
 	lcd_device_unregister(crp->cr_lcd_device);
+	platform_set_drvdata(pdev, NULL);
+#ifdef CONFIG_PM
+	iounmap(rcba_regs_base);
+#endif
+	kfree(crp);
 	pci_dev_put(lpc_dev);
 
 	return 0;
@@ -247,6 +369,10 @@ static struct platform_driver cr_backlight_driver = {
 	.driver = {
 		   .name = "cr_backlight",
 		   },
+#ifdef CONFIG_PM
+	.suspend = cr_backlight_suspend,
+	.resume = cr_backlight_resume,
+#endif
 };
 
 static struct platform_device *crp;
Signature · 1 line
1.5.2.4

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/

_______________________________________________
Linux-fbdev-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel

#3 lore raw

PATCH 2/3 vmlfb: Add suspend/resume support.

In reply to a message not in the archive

From: Michel D������nzer <[email protected]>

Mostly restore fbdev state on resume.

---
 drivers/video/vermilion/vermilion.c |  108 ++++++++++++++++++++++++++++++++++-
 drivers/video/vermilion/vermilion.h |    5 ++
 2 files changed, 112 insertions(+), 1 deletions(-)
drivers/video/vermilion/vermilion.c +107 -1
index de531c9..af72f67 100644
@@ -41,6 +41,10 @@
 #include <linux/mmzone.h>
 #include <asm/uaccess.h>
 
+#ifdef CONFIG_PM
+#include <linux/console.h>
+#endif
+
 /* #define VERMILION_DEBUG */
 
 #include "vermilion.h"
@@ -1067,11 +1071,113 @@ static struct pci_device_id vml_ids[] = {
 	{0}
 };
 
+#ifdef CONFIG_PM
+static int vmlfb_suspend(struct pci_dev *pdev, pm_message_t state)
+{
+	struct fb_info *info = pci_get_drvdata(pdev);
+	struct vml_info *vinfo = container_of(info, struct vml_info, info);
+
+	printk(KERN_DEBUG "vmlfb: suspending to state: %d\n", state.event);
+
+	acquire_console_sem();
+
+	fb_set_suspend(info, 1);
+
+	/* Blank display and LCD */
+	vmlfb_blank(FB_BLANK_POWERDOWN, info);
+
+	/* Suspend the chip */
+	if (subsys && subsys->suspend) {
+		int ret = subsys->suspend(subsys, state);
+
+		if (ret) {
+			vmlfb_blank(0, info);
+			fb_set_suspend(info, 0);
+			release_console_sem();
+			return ret;
+		}
+	}
+
+	pci_save_state(vinfo->par->gpu);
+	pci_disable_device(vinfo->par->gpu);
+	pci_set_power_state(vinfo->par->gpu,
+			    pci_choose_state(vinfo->par->gpu, state));
+
+	pci_save_state(pdev);
+	pci_disable_device(pdev);
+	pci_set_power_state(pdev, pci_choose_state(pdev, state));
+
+	release_console_sem();
+
+	pdev->dev.power.power_state = state;
+
+	return 0;
+}
+
+static int vmlfb_resume(struct pci_dev *pdev)
+{
+	struct fb_info *info = pci_get_drvdata(pdev);
+	struct vml_info *vinfo = container_of(info, struct vml_info, info);
+
+	if (pdev->dev.power.power_state.event == PM_EVENT_ON)
+		return 0;
+
+	acquire_console_sem();
+
+	/* Wake up devices */
+	if (subsys && subsys->resume) {
+		int ret = subsys->resume(subsys);
+
+		if (ret) {
+			release_console_sem();
+			return ret;
+		}
+	}
+
+	pci_set_power_state(vinfo->par->gpu, PCI_D0);
+	pci_restore_state(vinfo->par->gpu);
+	if (pci_enable_device(vinfo->par->gpu)) {
+		release_console_sem();
+		return -1;
+	}
+
+	pci_set_power_state(pdev, PCI_D0);
+	pci_restore_state(pdev);
+	if (pci_enable_device(pdev)) {
+		release_console_sem();
+		return -1;
+	}
+
+	/* Restore display */
+	vmlfb_set_par(info);
+	fb_pan_display(info, &info->var);
+	fb_set_cmap(&info->cmap, info);
+
+	/* Refresh */
+	fb_set_suspend(info, 0);
+
+	/* Unblank */
+	vmlfb_blank(0, info);
+
+	release_console_sem();
+
+	pdev->dev.power.power_state = PMSG_ON;
+
+	printk(KERN_DEBUG "vmlfb: resumed\n");
+
+	return 0;
+}
+#endif /* CONFIG_PM */
+
 static struct pci_driver vmlfb_pci_driver = {
 	.name = "vmlfb",
 	.id_table = vml_ids,
 	.probe = vml_pci_probe,
-	.remove = __devexit_p(vml_pci_remove)
+	.remove = __devexit_p(vml_pci_remove),
+#ifdef CONFIG_PM
+	.suspend = vmlfb_suspend,
+	.resume	= vmlfb_resume,
+#endif /* CONFIG_PM */
 };
 
 static void __exit vmlfb_cleanup(void)
drivers/video/vermilion/vermilion.h +5 -0
index 1fc6695..97b6e54 100644
@@ -247,6 +247,11 @@ struct vml_sys {
 
 	int (*set_clock) (struct vml_sys * sys, int clock);
 	int (*nearest_clock) (const struct vml_sys * sys, int clock);
+
+#ifdef CONFIG_PM
+	int (*suspend) (const struct vml_sys *sys, pm_message_t state);
+	int (*resume) (const struct vml_sys *sys);
+#endif
 };
 
 extern int vmlfb_register_subsys(struct vml_sys *sys);
Signature · 1 line
1.5.2.4

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/

_______________________________________________
Linux-fbdev-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel

#5 lore raw

PATCH 3/3 cr_pll: Add suspend/resume support.

In reply to a message not in the archive

From: Michel D������nzer <[email protected]>

Mostly save and restore all (extended) PCI config space and device registers, with one exception.

---
 drivers/video/vermilion/cr_pll.c |  228 +++++++++++++++++++++++++++++++++++--
 1 files changed, 215 insertions(+), 13 deletions(-)
drivers/video/vermilion/cr_pll.c +215 -13
index ebc6e6e..ab652ec 100644
@@ -25,6 +25,7 @@
  * Authors:
  *   Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
  *   Alan Hourihane <alanh-at-tungstengraphics-dot-com>
+ *   Michel D������nzer <michel-at-tungstengraphics-dot-com>
  */
 
 #include <linux/module.h>
@@ -34,12 +35,20 @@
 #include <linux/fb.h>
 #include "vermilion.h"
 
+#define MODULE_NAME "crvml"
+
 /* The PLL Clock register sits on Host bridge */
 #define CRVML_DEVICE_MCH   0x5001
+#define CRVML_REG_EPBAR    0x40
 #define CRVML_REG_MCHBAR   0x44
-#define CRVML_REG_MCHEN    0x54
+#define CRVML_REG_DMIBAR   0x4C
+#define CRVML_REG_DEVEN    0x54
+#define CRVML_EPEN_BIT     (1 << 27)
 #define CRVML_MCHEN_BIT    (1 << 28)
-#define CRVML_MCHMAP_SIZE  4096
+#define CRVML_DMIEN_BIT    (1 << 29)
+#define CRVML_EPMAP_SIZE   4096
+#define CRVML_MCHMAP_SIZE  16384
+#define CRVML_DMIMAP_SIZE  4096
 #define CRVML_REG_CLOCK    0xc3c
 #define CRVML_CLOCK_SHIFT  8
 #define CRVML_CLOCK_MASK   0x00000f00
@@ -49,6 +58,25 @@ static u32 mch_bar;
 static void __iomem *mch_regs_base;
 static u32 saved_clock;
 
+#ifdef CONFIG_PM
+
+#define NUM_MCH_EXTRA_CONFIG_SPACE 48
+static int mch_saved_config_space[NUM_MCH_EXTRA_CONFIG_SPACE];
+
+static u32 dmi_bar;
+static void __iomem *dmi_regs_base;
+static u32 ep_bar;
+static void __iomem *ep_regs_base;
+
+#define REGSAVE_SIZE (CRVML_EPMAP_SIZE + CRVML_DMIMAP_SIZE + CRVML_MCHMAP_SIZE)
+static u32 *regsave;
+
+static struct pci_dev *pci2pci_dev;
+#define NUM_PCI2PCI_EXTRA_CONFIG_SPACE 6
+static int pci2pci_saved_config_space[NUM_PCI2PCI_EXTRA_CONFIG_SPACE];
+
+#endif /* CONFIG_PM */
+
 static const unsigned crvml_clocks[] = {
 	6750,
 	13500,
@@ -78,6 +106,123 @@ static const u32 crvml_clock_bits[] = {
 
 static const unsigned crvml_num_clocks = ARRAY_SIZE(crvml_clocks);
 
+#ifdef CONFIG_PM
+
+static void crvml_save_device(struct pci_dev *pdev, int num_extra_cfg,
+			      int *saved_extra_cfg, pm_message_t state)
+{
+	int i;
+
+	for (i = 0; i < num_extra_cfg; i++)
+		pci_read_config_dword(pdev, (i + 16) * 4, &saved_extra_cfg[i]);
+
+	pci_save_state(pdev);
+	pci_set_power_state(pdev, pci_choose_state(pdev, state));
+}
+
+static int crvml_suspend(const struct vml_sys *sys, pm_message_t state)
+{
+	int reg;
+	int saveidx = 0;
+
+	printk(KERN_DEBUG MODULE_NAME ": suspending to state: %d\n",
+	       state.event);
+
+	/* Save registers and config space */
+
+	regsave = kmalloc(REGSAVE_SIZE, GFP_ATOMIC);
+
+	if (!regsave) {
+		printk(KERN_ERR MODULE_NAME
+		       ": Could not allocate %d bytes for saving registers\n",
+		       REGSAVE_SIZE);
+		return -ENOMEM;
+	}
+
+	for (reg = 0; reg < CRVML_EPMAP_SIZE; reg += 4)
+		regsave[saveidx++] = ioread32(ep_regs_base + reg);
+
+	for (reg = 0; reg < CRVML_DMIMAP_SIZE; reg += 4)
+		regsave[saveidx++] = ioread32(dmi_regs_base + reg);
+
+	for (reg = 0; reg < CRVML_MCHMAP_SIZE; reg += 4)
+		if (reg != 0xc48)
+			regsave[saveidx++] = ioread32(mch_regs_base + reg);
+
+	crvml_save_device(mch_dev, NUM_MCH_EXTRA_CONFIG_SPACE,
+			  mch_saved_config_space, state);
+
+	crvml_save_device(pci2pci_dev, NUM_PCI2PCI_EXTRA_CONFIG_SPACE,
+			  pci2pci_saved_config_space, state);
+
+	return 0;
+}
+
+static int crvml_restore_device(struct pci_dev *pdev, int num_extra_cfg,
+				int *saved_extra_cfg)
+{
+	int i;
+	int val;
+
+	pci_restore_state(pdev);
+	pci_set_power_state(pdev, PCI_D0);
+	for (i = 0; i < num_extra_cfg; i++) {
+		pci_read_config_dword(pdev, (i + 16) * 4, &val);
+		if (val != saved_extra_cfg[i]) {
+			printk(KERN_DEBUG MODULE_NAME ": Writing back config "
+			       "space on device %s at offset %x (was %x, "
+			       "writing %x)\n", pci_name(pdev), (i + 16), val,
+			       saved_extra_cfg[i]);
+			pci_write_config_dword(pdev, (i + 16) * 4,
+					       saved_extra_cfg[i]);
+		}
+	}
+
+	return pci_enable_device(pdev);
+}
+
+static int crvml_resume(const struct vml_sys *sys)
+{
+	int reg;
+	int ret;
+	int restoreidx = 0;
+
+	/* Restore config space and registers */
+
+	ret = crvml_restore_device(pci2pci_dev, NUM_PCI2PCI_EXTRA_CONFIG_SPACE,
+				   pci2pci_saved_config_space);
+
+	if (ret)
+		return ret;
+
+	ret = crvml_restore_device(mch_dev, NUM_MCH_EXTRA_CONFIG_SPACE,
+				   mch_saved_config_space);
+
+	if (ret)
+		return ret;
+
+	for (reg = 0; reg < CRVML_EPMAP_SIZE; reg += 4)
+		iowrite32(regsave[restoreidx++], ep_regs_base + reg);
+
+	for (reg = 0; reg < CRVML_DMIMAP_SIZE; reg += 4)
+		iowrite32(regsave[restoreidx++], dmi_regs_base + reg);
+
+	for (reg = 0; reg < CRVML_MCHMAP_SIZE; reg += 4)
+		if (reg != 0xc48)
+			iowrite32(regsave[restoreidx++], mch_regs_base + reg);
+
+	/* Flush posted writes */
+	ioread32(mch_regs_base);
+
+	kfree(regsave);
+
+	printk(KERN_DEBUG MODULE_NAME ": resumed\n");
+
+	return 0;
+}
+
+#endif /* CONFIG_PM */
+
 static int crvml_sys_restore(struct vml_sys *sys)
 {
 	void __iomem *clock_reg = mch_regs_base + CRVML_REG_CLOCK;
@@ -147,6 +292,10 @@ static struct vml_sys cr_pll_ops = {
 	.restore = crvml_sys_restore,
 	.set_clock = crvml_set_clock,
 	.nearest_clock = crvml_nearest_clock,
+#ifdef CONFIG_PM
+	.suspend = crvml_suspend,
+	.resume = crvml_resume,
+#endif
 };
 
 static int __init cr_pll_init(void)
@@ -162,12 +311,12 @@ static int __init cr_pll_init(void)
 		return -ENODEV;
 	}
 
-	pci_read_config_dword(mch_dev, CRVML_REG_MCHEN, &dev_en);
+	pci_read_config_dword(mch_dev, CRVML_REG_DEVEN, &dev_en);
 	if (!(dev_en & CRVML_MCHEN_BIT)) {
 		printk(KERN_ERR
-		       "Carillo Ranch MCH device was not enabled.\n");
-		pci_dev_put(mch_dev);
-		return -ENODEV;
+		       "Carillo Ranch MCH BAR was not enabled.\n");
+		err = -ENODEV;
+		goto err_0;
 	}
 
 	pci_read_config_dword(mch_dev, CRVML_REG_MCHBAR,
@@ -176,26 +325,79 @@ static int __init cr_pll_init(void)
 	    ioremap_nocache(mch_bar, CRVML_MCHMAP_SIZE);
 	if (!mch_regs_base) {
 		printk(KERN_ERR
-		       "Carillo Ranch MCH device was not enabled.\n");
-		pci_dev_put(mch_dev);
-		return -ENODEV;
+		       "Failed to map Carillo Ranch MCH BAR.\n");
+		err = -ENODEV;
+		goto err_0;
 	}
 
+#ifdef CONFIG_PM
+	if (!(dev_en & CRVML_DMIEN_BIT ) || !(dev_en & CRVML_EPEN_BIT)) {
+		printk(KERN_ERR
+		       "Carillo Ranch DMI or EP BAR was not enabled.\n");
+		err = -ENODEV;
+		goto err_1;
+	}
+
+	pci_read_config_dword(mch_dev, CRVML_REG_DMIBAR, &dmi_bar);
+	dmi_regs_base = ioremap_nocache(dmi_bar, CRVML_DMIMAP_SIZE);
+	if (!dmi_regs_base) {
+		printk(KERN_ERR
+		       "Failed to map Carillo Ranch DMI BAR.\n");
+		err = -ENODEV;
+		goto err_1;
+	}
+
+	pci_read_config_dword(mch_dev, CRVML_REG_EPBAR, &ep_bar);
+	ep_regs_base = ioremap_nocache(ep_bar, CRVML_EPMAP_SIZE);
+	if (!ep_regs_base) {
+		printk(KERN_ERR
+		       "Failed to map Carillo Ranch EP BAR.\n");
+		err = -ENODEV;
+		goto err_2;
+	}
+
+	pci2pci_dev = pci_get_device(PCI_VENDOR_ID_INTEL,
+				     PCI_DEVICE_ID_INTEL_82801BA_11, NULL);
+	if (!pci2pci_dev) {
+		printk(KERN_ERR
+		       "Could not find Carillo Ranch PCI bridge.\n");
+		err = -ENODEV;
+		goto err_3;
+	}
+#endif /* CONFIG_PM */
+
 	err = vmlfb_register_subsys(&cr_pll_ops);
 	if (err) {
 		printk(KERN_ERR
 		       "Carillo Ranch failed to initialize vml_sys.\n");
-		pci_dev_put(mch_dev);
-		return err;
-	}
+	} else
+		return 0;
 
-	return 0;
+#ifdef CONFIG_PM
+	pci_dev_put(pci2pci_dev);
+err_3:
+	iounmap(ep_regs_base);
+err_2:
+	iounmap(dmi_regs_base);
+err_1:
+#endif
+	iounmap(mch_regs_base);
+err_0:
+	pci_dev_put(mch_dev);
+
+	return err;
 }
 
 static void __exit cr_pll_exit(void)
 {
 	vmlfb_unregister_subsys(&cr_pll_ops);
 
+#ifdef CONFIG_PM
+	pci_dev_put(pci2pci_dev);
+
+	iounmap(ep_regs_base);
+	iounmap(dmi_regs_base);
+#endif
 	iounmap(mch_regs_base);
 	pci_dev_put(mch_dev);
 }
Signature · 1 line
1.5.2.4

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/

_______________________________________________
Linux-fbdev-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel