Merge branch 'drm-patches' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied...
[sfrench/cifs-2.6.git] / drivers / ata / ata_piix.c
index ad070861bb5373051e9a8dfa255f87cc926b60af..071d274afaabcf6a971831019c44e50900d306c9 100644 (file)
@@ -436,7 +436,7 @@ static const struct piix_map_db ich8_map_db = {
                /* PM   PS   SM   SS       MAP */
                {  P0,  P2,  P1,  P3 }, /* 00b (hardwired when in AHCI) */
                {  RV,  RV,  RV,  RV },
-               {  IDE,  IDE,  NA,  NA }, /* 10b (IDE mode) */
+               {  P0,  P2, IDE, IDE }, /* 10b (IDE mode) */
                {  RV,  RV,  RV,  RV },
        },
 };
@@ -890,37 +890,53 @@ static void ich_set_dmamode (struct ata_port *ap, struct ata_device *adev)
 }
 
 #ifdef CONFIG_PM
-static struct dmi_system_id piix_broken_suspend_dmi_table[] = {
-       {
-               .ident = "TECRA M5",
-               .matches = {
-                       DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
-                       DMI_MATCH(DMI_PRODUCT_NAME, "TECRA M5"),
+static int piix_broken_suspend(void)
+{
+       static struct dmi_system_id sysids[] = {
+               {
+                       .ident = "TECRA M5",
+                       .matches = {
+                               DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
+                               DMI_MATCH(DMI_PRODUCT_NAME, "TECRA M5"),
+                       },
                },
-       },
-       {
-               .ident = "Satellite U200",
-               .matches = {
-                       DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
-                       DMI_MATCH(DMI_PRODUCT_NAME, "Satellite U200"),
+               {
+                       .ident = "TECRA M7",
+                       .matches = {
+                               DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
+                               DMI_MATCH(DMI_PRODUCT_NAME, "TECRA M7"),
+                       },
                },
-       },
-       {
-               .ident = "Satellite U205",
-               .matches = {
-                       DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
-                       DMI_MATCH(DMI_PRODUCT_NAME, "Satellite U205"),
+               {
+                       .ident = "Satellite U205",
+                       .matches = {
+                               DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
+                               DMI_MATCH(DMI_PRODUCT_NAME, "Satellite U205"),
+                       },
                },
-       },
-       {
-               .ident = "Portege M500",
-               .matches = {
-                       DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
-                       DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE M500"),
+               {
+                       .ident = "Portege M500",
+                       .matches = {
+                               DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
+                               DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE M500"),
+                       },
                },
-       },
-       { }
-};
+               { }
+       };
+       static const char *oemstrs[] = {
+               "Tecra M3,",
+       };
+       int i;
+
+       if (dmi_check_system(sysids))
+               return 1;
+
+       for (i = 0; i < ARRAY_SIZE(oemstrs); i++)
+               if (dmi_find_device(DMI_DEV_TYPE_OEM_STRING, oemstrs[i], NULL))
+                       return 1;
+
+       return 0;
+}
 
 static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
 {
@@ -937,8 +953,7 @@ static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
         * cycles and power trying to do something to the sleeping
         * beauty.
         */
-       if (dmi_check_system(piix_broken_suspend_dmi_table) &&
-           mesg.event == PM_EVENT_SUSPEND) {
+       if (piix_broken_suspend() && mesg.event == PM_EVENT_SUSPEND) {
                pci_save_state(pdev);
 
                /* mark its power state as "unknown", since we don't
@@ -973,10 +988,10 @@ static int piix_pci_device_resume(struct pci_dev *pdev)
                pci_restore_state(pdev);
 
                /* PCI device wasn't disabled during suspend.  Use
-                * __pci_reenable_device() to avoid affecting the
-                * enable count.
+                * pci_reenable_device() to avoid affecting the enable
+                * count.
                 */
-               rc = __pci_reenable_device(pdev);
+               rc = pci_reenable_device(pdev);
                if (rc)
                        dev_printk(KERN_ERR, &pdev->dev, "failed to enable "
                                   "device after resume (%d)\n", rc);