linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander & Tatiana Bogdashevsky <sanderb@mail.ru>
To: linux-kernel@vger.kernel.org
Cc: marcelo.tosatti@cyclades.com
Subject: [PATCH] 2.4.24-pre1 amd76x_pm.c
Date: Sun, 14 Dec 2003 15:18:52 -0500	[thread overview]
Message-ID: <20031214151852.6743b854.sanderb@mail.ru> (raw)

[-- 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 --]

                 reply	other threads:[~2003-12-14 20:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20031214151852.6743b854.sanderb@mail.ru \
    --to=sanderb@mail.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.tosatti@cyclades.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).