public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: davej@codemonkey.org.uk, ak@suse.de
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] fix improper use of pci_module_init() in drivers/char/agp/amd64-agp.c
Date: Thu, 30 Sep 2004 11:42:48 -0700	[thread overview]
Message-ID: <20040930184248.GA17546@kroah.com> (raw)

Hi,

In going through the tree and auditing the usage of pci_module_init(), I
noticed that the amd64-agp driver was assuming that the return value of
this function could be greater than 0 (which is what could happen in 2.2
and 2.4 kernels.)  As this is no longer true, I think the following
patch is correct.

I can add this to my bk-pci tree if you wish, otherwise feel free to
send it upwards.

thanks,

greg k-h

-----

AGP: Fix up pci_module_init() usage in amd64-agp.c

pci_module_init() can not return a positive number in the 2.6 kernel, so
this code path was never getting run, so might as well just delete it.


Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>

--- a/drivers/char/agp/amd64-agp.c	2004-08-24 07:55:13 -07:00
+++ b/drivers/char/agp/amd64-agp.c	2004-09-30 11:37:35 -07:00
@@ -624,39 +624,9 @@
 /* Not static due to IOMMU code calling it early. */
 int __init agp_amd64_init(void)
 {
-	int err = 0;
 	if (agp_off)
 		return -EINVAL;
-	if (pci_module_init(&agp_amd64_pci_driver) > 0) {
-		struct pci_dev *dev;
-		if (!agp_try_unsupported && !agp_try_unsupported_boot) {
-			printk(KERN_INFO PFX "No supported AGP bridge found.\n");
-#ifdef MODULE
-			printk(KERN_INFO PFX "You can try agp_try_unsupported=1\n");
-#else
-			printk(KERN_INFO PFX "You can boot with agp=try_unsupported\n");
-#endif
-			return -ENODEV;
-		}
-
-		/* First check that we have at least one AMD64 NB */
-		if (!pci_find_device(PCI_VENDOR_ID_AMD, 0x1103, NULL))
-			return -ENODEV;
-
-		/* Look for any AGP bridge */
-		dev = NULL;
-		err = -ENODEV;
-		while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev))) {
-			if (!pci_find_capability(dev, PCI_CAP_ID_AGP))
-				continue;
-			/* Only one bridge supported right now */
-			if (agp_amd64_probe(dev, NULL) == 0) {
-				err = 0;
-				break;
-			}
-		}
-	}
-	return err;
+	return pci_register_driver(&agp_amd64_pci_driver);
 }
 
 static void __exit agp_amd64_cleanup(void)

             reply	other threads:[~2004-09-30 18:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-30 18:42 Greg KH [this message]
2004-09-30 19:20 ` [PATCH] fix improper use of pci_module_init() in drivers/char/agp/amd64-agp.c Andi Kleen
2004-09-30 19:59   ` Greg KH
2004-09-30 20:06     ` Andi Kleen
2004-09-30 21:05       ` Greg KH
2004-09-30 20:09     ` Greg KH
2004-10-01  1:56 ` Dave Jones

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=20040930184248.GA17546@kroah.com \
    --to=greg@kroah.com \
    --cc=ak@suse.de \
    --cc=davej@codemonkey.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /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