Merge branch 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied...
[pandora-kernel.git] / drivers / char / agp / ati-agp.c
index 0b6e726..5b74c36 100644 (file)
@@ -118,14 +118,12 @@ static int ati_create_gatt_pages(int nr_tables)
        int retval = 0;
        int i;
 
-       tables = kmalloc((nr_tables + 1) * sizeof(ati_page_map *),
-                        GFP_KERNEL);
+       tables = kzalloc((nr_tables + 1) * sizeof(ati_page_map *),GFP_KERNEL);
        if (tables == NULL)
                return -ENOMEM;
 
-       memset(tables, 0, sizeof(ati_page_map *) * (nr_tables + 1));
        for (i = 0; i < nr_tables; i++) {
-               entry = kmalloc(sizeof(ati_page_map), GFP_KERNEL);
+               entry = kzalloc(sizeof(ati_page_map), GFP_KERNEL);
                if (entry == NULL) {
                        while (i>0) {
                                kfree (tables[i-1]);
@@ -136,7 +134,6 @@ static int ati_create_gatt_pages(int nr_tables)
                        retval = -ENOMEM;
                        break;
                }
-               memset(entry, 0, sizeof(ati_page_map));
                tables[i] = entry;
                retval = ati_create_page_map(entry);
                if (retval != 0) break;
@@ -247,6 +244,22 @@ static int ati_configure(void)
 }
 
 
+#ifdef CONFIG_PM
+static int agp_ati_resume(struct pci_dev *dev)
+{
+       pci_restore_state(dev);
+
+       return ati_configure();
+}
+
+static int agp_ati_suspend(struct pci_dev *dev, pm_message_t state)
+{
+       pci_save_state(dev);
+
+       return 0;
+}
+#endif
+
 /*
  *Since we don't need contigious memory we just try
  * to get the gatt table once
@@ -528,6 +541,10 @@ static struct pci_driver agp_ati_pci_driver = {
        .id_table       = agp_ati_pci_table,
        .probe          = agp_ati_probe,
        .remove         = agp_ati_remove,
+#ifdef CONFIG_PM
+       .resume         = agp_ati_resume,
+       .suspend        = agp_ati_suspend,
+#endif
 };
 
 static int __init agp_ati_init(void)