linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] 2.4.24-pre1 amd76x_pm.c
@ 2003-12-14 20:18 Alexander & Tatiana Bogdashevsky
  0 siblings, 0 replies; only message in thread
From: Alexander & Tatiana Bogdashevsky @ 2003-12-14 20:18 UTC (permalink / raw)
  To: linux-kernel; +Cc: marcelo.tosatti

[-- Attachment #1: Type: text/plain, Size: 3309 bytes --]

Hi,

I did not find who is the maintainer of this module now (after Alan Cox went
studying), so I am sending the patch here.

There is a problem with amd76x_pm module in 2.4.23 and 2.4.24-pre1: it is
trying to grab southbridge unconditionally and if some other process already
did this, amd76x_pm just fails. As example: it is not compatible with
lm-sensor 2.8 and up.
This patch fixes this problem. It is based on Pasi Savolainen's patch for
2.6.0-test9(southbridge related changes only). The patch was tested (I am
using it on my ASUS A7M266-D with 2 Athlon MP 2000 CPUs without any problems).

With best regards,
Alexander Bogdashevsky
-------------------- start of patch ------------------
diff -ruN linux-2.4.24-pre1/drivers/char/amd76x_pm.c
linux-2.4.24-pre1-amd76x_pm/drivers/char/amd76x_pm.c---
linux-2.4.24-pre1/drivers/char/amd76x_pm.c	2003-11-28 13:26:20.000000000
-0500+++ linux-2.4.24-pre1-amd76x_pm/drivers/char/amd76x_pm.c	2003-12-08 22:56:24.000000000 -0500@@ -95,10 +95,6 @@
 static int __devinit amd_nb_init(struct pci_dev *pdev,
 				 const struct pci_device_id *ent);
 static void amd_nb_remove(struct pci_dev *pdev);
-static int __devinit amd_sb_init(struct pci_dev *pdev,
-				 const struct pci_device_id *ent);
-static void amd_sb_remove(struct pci_dev *pdev);
-
 
 static struct pci_dev *pdev_nb;
 static struct pci_dev *pdev_sb;
@@ -141,14 +137,6 @@
 	remove:__devexit_p(amd_nb_remove),
 };
 
-static struct pci_driver amd_sb_driver = {
-	name:"amd76x_pm-sb",
-	id_table:amd_sb_tbl,
-	probe:amd_sb_init,
-	remove:__devexit_p(amd_sb_remove),
-};
-
-
 static int __devinit
 amd_nb_init(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
@@ -165,24 +153,6 @@
 {
 }
 
-
-static int __devinit
-amd_sb_init(struct pci_dev *pdev, const struct pci_device_id *ent)
-{
-	pdev_sb = pdev;
-	printk(KERN_INFO "amd76x_pm: Initializing southbridge %s\n",
-	       pdev_sb->name);
-
-	return 0;
-}
-
-
-static void __devexit
-amd_sb_remove(struct pci_dev *pdev)
-{
-}
-
-
 /*
  * Configures the AMD-762 northbridge to support PM calls
  */
@@ -576,6 +546,17 @@
 {
 	int found;
 
+        /* Find southbridge */
+        pdev_sb = NULL;
+        while ((pdev_sb = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev_sb))
!= NULL) {+                if (pci_match_device(amd_sb_tbl, pdev_sb) != NULL)
+                        goto found_sb;
+        }
+        printk(KERN_ERR "amd76x_pm: Could not find southbridge\n");
+        return -ENODEV;
+
+found_sb:
+
 	/* Find northbridge */
 	found = pci_register_driver(&amd_nb_driver);
 	if (found <= 0) {
@@ -584,15 +565,6 @@
 		return 1;
 	}
 
-	/* Find southbridge */
-	found = pci_register_driver(&amd_sb_driver);
-	if (found <= 0) {
-		printk(KERN_ERR "amd76x_pm: Could not find southbridge\n");
-		pci_unregister_driver(&amd_sb_driver);
-		pci_unregister_driver(&amd_nb_driver);
-		return 1;
-	}
-
 	/* Init southbridge */
 	switch (pdev_sb->device) {
 	case PCI_DEVICE_ID_AMD_VIPER_7413:	/* AMD-765 or 766 */
@@ -623,7 +595,6 @@
 	if (!amd76x_pm_cfg.curr_idle) {
 		printk(KERN_ERR "amd76x_pm: Idle function not changed\n");
 		pci_unregister_driver(&amd_nb_driver);
-		pci_unregister_driver(&amd_sb_driver);
 		return 1;
 	}
 
@@ -683,8 +654,6 @@
 #endif
 
 	pci_unregister_driver(&amd_nb_driver);
-	pci_unregister_driver(&amd_sb_driver);
-
 }
 
 

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-12-14 20:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-14 20:18 [PATCH] 2.4.24-pre1 amd76x_pm.c Alexander & Tatiana Bogdashevsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).