public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: PATCH: linux-2.4.7-pre3/drivers/char/sonypi.c would hang some non-Sony notebooks
@ 2001-07-08 10:26 Adam J. Richter
  2001-07-08 16:46 ` Robert J.Dunlop
  0 siblings, 1 reply; 11+ messages in thread
From: Adam J. Richter @ 2001-07-08 10:26 UTC (permalink / raw)
  To: rjd; +Cc: jun1m, linux-kernel, m.ashley, stelian.pop, t-kinjo, tridge

>From: "Robert J.Dunlop" <rjd@xyzzy.clara.co.uk>
>Hi,

>First off, it works for me on my VAIO PCG-Z600NE.

	Great.  Thanks for testing it!

[...]
>Just a niggle however. This still isn't a very good test to finding a
>Sony laptop. What'll happen on machines that have any sort of Sony
>plugin device ?

>How's about we test for a machine that has a host bridge with the Sony
>subvendor ID, rather than any device.

	On my Sony Vaio C1VN PictureBook, the host bridge subsystem
vendor ID is Transmeta, not Sony.  The device with the Sony subsystem
vendor ID are the firewire controller, sound devices, soft modem,
cardbus bridge and video.  So, you could would not work on it (although
I did not actually try it).

>I guess this'll still pickup Sony desktops.

	Sony desktops are also called "Vaio."  I do not know whether
they have the hardware that sonypi tries to talk to.


>Perhaps we need a survey of lspci -nv results for sony and non-sony
>machines ?

	Yes, although that is a task that is never complete.  So, I
would recommend that we adopt a simple test that should work into the
stock kernels with the expectation that the test will probably be
refined in the future.  Perhaps we could check the Cardbus bridge.
Does "lspci -v" on your Sony Vaio indicate that its cardbus bridge
have a subsystem vendor ID of Sony?

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."

^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: PATCH: linux-2.4.7-pre3/drivers/char/sonypi.c would hang some non-Sony notebooks
@ 2001-07-09 12:54 Adam J. Richter
  0 siblings, 0 replies; 11+ messages in thread
From: Adam J. Richter @ 2001-07-09 12:54 UTC (permalink / raw)
  To: linux-kernel

	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) {

^ permalink raw reply	[flat|nested] 11+ messages in thread
* PATCH: linux-2.4.7-pre3/drivers/char/sonypi.c would hang some non-Sony notebooks
@ 2001-07-08  1:04 Adam J. Richter
  2001-07-08  9:42 ` Robert J.Dunlop
  0 siblings, 1 reply; 11+ messages in thread
From: Adam J. Richter @ 2001-07-08  1:04 UTC (permalink / raw)
  To: stelian.pop, m.ashley, jun1m, t-kinjo, tridge; +Cc: linux-kernel

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

	The pci_device_id tables in linux-2.4.7-pre3/drivers/char/sonypi.c
claims that the driver wants to be loaded on all computers that have
an that have a PCI device with vendor id PCI_VENDOR_ID_INTEL and
a device ID of either PCI_DEVICE_ID_INTEL_82371AB_3 (0x7110) or
PCI_DEVICE_ID_INTEL_82801BA_10 (0x244c).  My Kapok 1100m notebook
computer has an Intel 82371ab, so the sonypi module automatically
loads at boot time and hangs the computer.

	sonypi_init_module needs to do some kind of test to figure out
if it is on a Sony Vaio and abort otherwise.  Looking at the result of
"lspci -v" on my Sony Vaio Picturebook, I see that, while none of the
PCI devices have Sony's vendor ID, a number of them have Sony's
vendor ID as their subsystem vendor ID's.  So, I have implemented the
following test to cause sonypi only to be loadable on machines that
have at least one PCI device that has a subsystem vendor ID of
PCI_VENDOR_ID_SONY.

-- 
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."

[-- Attachment #2: sony.patch --]
[-- Type: text/plain, Size: 465 bytes --]

--- linux-2.4.7-pre3/drivers/char/sonypi.c	Sat Jul  7 18:00:12 2001
+++ linux/drivers/char/sonypi.c	Sat Jul  7 18:00:28 2001
@@ -690,7 +690,11 @@
 };
 
 static int __init sonypi_init_module(void) {
-	return pci_module_init(&sonypi_driver);
+	if (pci_find_subsys(PCI_ANY_ID, PCI_ANY_ID,
+			    PCI_VENDOR_ID_SONY, PCI_ANY_ID, NULL) != NULL)
+		return pci_module_init(&sonypi_driver);
+	else
+		return -ENODEV;
 }
 
 static void __exit sonypi_cleanup_module(void) {

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2001-07-09 13:31 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-07-08 10:26 PATCH: linux-2.4.7-pre3/drivers/char/sonypi.c would hang some non-Sony notebooks Adam J. Richter
2001-07-08 16:46 ` Robert J.Dunlop
2001-07-09  7:52   ` Alexander Griesser
2001-07-09  9:35   ` Stelian Pop
  -- strict thread matches above, loose matches on Subject: below --
2001-07-09 12:54 Adam J. Richter
2001-07-08  1:04 Adam J. Richter
2001-07-08  9:42 ` Robert J.Dunlop
2001-07-08 10:51   ` arjan
2001-07-09  9:43     ` Stelian Pop
2001-07-09 10:39       ` Alan Cox
2001-07-09 13:31         ` Stelian Pop

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox