Re: PATCH: linux-2.4.7-pre3/drivers/char/sonypi.c would hang some non-Sony notebooks

From: Adam J. Richter (adam@yggdrasil.com)
Date: Mon Jul 09 2001 - 07:54:43 EST


        Based on the advice and testing of Bob Dunlop, Alexander Griesser,
arjan@fenrus.demon.nl, and Stelian Pop, here is a modified sonpypi.c
patch that detects Sony Vaio computers by requiring a Cardbus bridge
that has a subsystem vendor ID of Sony, rather than just any PCI device.
This should avoid erroneous(?) installation and (possible hangs?) from
this module on Sony desktop machines, although this may break if Sony
decides to make a PCI-to-Cardbus bridge card and puts its vendor ID
in the subsystem vendor ID of that device.

        I've tried this code on a machine that is a Sony Vaio
notebook computer and one that is not, and it gets it right in
both cases.

        I am interested in figuring out a more perfect test, but,
in all cases, this patch should be better than the current 2.4.7-pre3
tree and the earlier patches that Bob and I have posted, so it would
be fine to apply it now. (In particular, I am following the discussion
about using "DMI tables"--something I'm not familiar with--but I have
to leave for a two day trip in a few hours.)

        Anyhow, I hope this patch is helpful.

Adam J. Richter __ ______________ 4880 Stevens Creek Blvd, Suite 104
adam@yggdrasil.com \ / San Jose, California 95129-1034
+1 408 261-6630 | g g d r a s i l United States of America
fax +1 408 261-6631 "Free Software For The Rest Of Us."

--- linux-2.4.7-pre3/drivers/char/sonypi.c Mon Jul 9 05:32:41 2001
+++ linux/drivers/char/sonypi.c Mon Jul 9 05:30:22 2001
@@ -689,8 +689,23 @@
         remove: sonypi_remove,
 };
 
+static int __init sony_notebook(void) {
+ struct pci_dev *dev;
+
+ dev = NULL;
+ while ((dev = pci_find_class(PCI_CLASS_BRIDGE_CARDBUS, NULL)) != NULL){
+ if (dev->subsystem_vendor == PCI_VENDOR_ID_SONY)
+ return 1;
+ }
+
+ return 0;
+}
+
 static int __init sonypi_init_module(void) {
- return pci_module_init(&sonypi_driver);
+ if (sony_notebook())
+ return pci_module_init(&sonypi_driver);
+ else
+ return -ENODEV;
 }
 
 static void __exit sonypi_cleanup_module(void) {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Jul 15 2001 - 21:00:09 EST