All of lore.kernel.org
 help / color / mirror / Atom feed
* PATCH: sonypi wrongly claims ownership of ISA and ACPI bridges
@ 2001-10-15  8:21 Marcus Meissner
  2001-10-15 11:56 ` Stelian Pop
  0 siblings, 1 reply; 2+ messages in thread
From: Marcus Meissner @ 2001-10-15  8:21 UTC (permalink / raw)
  To: stelian.pop, Alan Cox, linux-kernel

Hi Stelian,

Your sonypi driver claims the ownership of 2 Intel ACPI bridges and 1 ISA 
bridge.

All 3 are used in standard Intel chipsets, not just in Sony VAIOs.

Please do not use them, it confuses the hell out of the autoprobing and
automatic PCI driver registration.

I suggest checking up if this device has PnPBIOS entries and using them,
or using a different method of autoprobing.

Ciao, Marcus

Index: sonypi.c
===================================================================
RCS file: /build/mm/work/repository/linux-mm/drivers/char/sonypi.c,v
retrieving revision 1.20
diff -u -r1.20 sonypi.c
--- sonypi.c	2001/10/14 19:13:21	1.20
+++ sonypi.c	2001/10/15 08:16:25
@@ -689,8 +689,6 @@
 	{ }
 };
 
-MODULE_DEVICE_TABLE(pci, sonypi_id_tbl);
-
 static struct pci_driver sonypi_driver = {
 	name:		"sonypi",
 	id_table:	sonypi_id_tbl,

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

* Re: PATCH: sonypi wrongly claims ownership of ISA and ACPI bridges
  2001-10-15  8:21 PATCH: sonypi wrongly claims ownership of ISA and ACPI bridges Marcus Meissner
@ 2001-10-15 11:56 ` Stelian Pop
  0 siblings, 0 replies; 2+ messages in thread
From: Stelian Pop @ 2001-10-15 11:56 UTC (permalink / raw)
  To: Marcus Meissner; +Cc: Alan Cox, linux-kernel

On Mon, Oct 15, 2001 at 10:21:10AM +0200, Marcus Meissner wrote:

> Your sonypi driver claims the ownership of 2 Intel ACPI bridges and 1 ISA 
> bridge.
> 
> All 3 are used in standard Intel chipsets, not just in Sony VAIOs.
> 
> Please do not use them, it confuses the hell out of the autoprobing and
> automatic PCI driver registration.
> 
> I suggest checking up if this device has PnPBIOS entries and using them,
> or using a different method of autoprobing.

Testing against is_sony_vaio_laptop should be sufficient here.

Alan, please apply the following patch (instead of Marcus' one).
It changes the initialisation sequence (first the ISA bridge for
the older hardware, then it supposes newer hardware), and doesn't
registers itself in the kernel pci device table.

A little documentation update is also included.

Thanks,

Stelian.

diff -uNr --exclude-from=dontdiff linux-2.4.12-ac2.orig/Documentation/sonypi.txt linux-2.4.12-ac2/Documentation/sonypi.txt
--- linux-2.4.12-ac2.orig/Documentation/sonypi.txt	Mon Oct 15 12:36:00 2001
+++ linux-2.4.12-ac2/Documentation/sonypi.txt	Mon Oct 15 12:32:35 2001
@@ -55,7 +55,9 @@
 			in order to let the driver access to the camera
 
 	fnkeyinit:	on some Vaios (C1VE, C1VR etc), the Fn key events don't
-			get enabled unless you set this parameter to 1
+			get enabled unless you set this parameter to 1.
+			Do not use this option unless it's actually necessary,
+			some Vaio models don't deal well with this option.
 
 	verbose:	print unknown events from the sonypi device
 
@@ -71,7 +73,7 @@
 lines in your /etc/modules.conf file:
 
 	alias char-major-10-250 sonypi
-	options sonypi minor=250 fnkeyinit=1
+	options sonypi minor=250
 
 This supposes the use of minor 250 for the sonypi device:
 
diff -uNr --exclude-from=dontdiff linux-2.4.12-ac2.orig/drivers/char/sonypi.c linux-2.4.12-ac2/drivers/char/sonypi.c
--- linux-2.4.12-ac2.orig/drivers/char/sonypi.c	Mon Oct 15 12:36:13 2001
+++ linux-2.4.12-ac2/drivers/char/sonypi.c	Mon Oct 15 12:36:39 2001
@@ -550,23 +550,20 @@
 	-1, "sonypi", &sonypi_misc_fops
 };
 
-static int __devinit sonypi_probe(struct pci_dev *pcidev, 
-		                  const struct pci_device_id *ent) {
+static int __devinit sonypi_probe(struct pci_dev *pcidev) {
 	int i, ret;
 	struct sonypi_ioport_list *ioport_list;
 	struct sonypi_irq_list *irq_list;
 
-	if (sonypi_device.dev) {
-		printk(KERN_ERR "sonypi: only one device allowed!\n"),
-		ret = -EBUSY;
-		goto out1;
-	}
 	sonypi_device.dev = pcidev;
-	sonypi_device.model = (int)ent->driver_data;
+	if (pcidev)
+		sonypi_device.model = SONYPI_DEVICE_MODEL_TYPE1;
+	else
+		sonypi_device.model = SONYPI_DEVICE_MODEL_TYPE2;
 	sonypi_initq();
 	init_MUTEX(&sonypi_device.lock);
 	
-	if (pci_enable_device(pcidev)) {
+	if (pcidev && pci_enable_device(pcidev)) {
 		printk(KERN_ERR "sonypi: pci_enable_device failed\n");
 		ret = -EIO;
 		goto out1;
@@ -638,11 +635,10 @@
 	printk(KERN_INFO "sonypi: Sony Programmable I/O Controller Driver v%d.%d.\n",
 	       SONYPI_DRIVER_MAJORVERSION,
 	       SONYPI_DRIVER_MINORVERSION);
-	printk(KERN_INFO "sonypi: detected %s model (%04x:%04x), "
+	printk(KERN_INFO "sonypi: detected %s model, "
 	       "camera = %s, compat = %s\n",
 	       (sonypi_device.model == SONYPI_DEVICE_MODEL_TYPE1) ?
 			"type1" : "type2",
-	       sonypi_device.dev->vendor, sonypi_device.dev->device,
 	       camera ? "on" : "off",
 	       compat ? "on" : "off");
 	printk(KERN_INFO "sonypi: enabled at irq=%d, port1=0x%x, port2=0x%x\n",
@@ -662,7 +658,7 @@
 	return ret;
 }
 
-static void __devexit sonypi_remove(struct pci_dev *pcidev) {
+static void __devexit sonypi_remove(void) {
 	sonypi_call2(0x81, 0); /* make sure we don't get any more events */
 	if (camera)
 		sonypi_camera_off();
@@ -676,37 +672,21 @@
 	printk(KERN_INFO "sonypi: removed.\n");
 }
 
-static struct pci_device_id sonypi_id_tbl[] __devinitdata = {
-	{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, 
-	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
-	  (unsigned long) SONYPI_DEVICE_MODEL_TYPE1 },
-	{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_10,
-	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
-	  (unsigned long) SONYPI_DEVICE_MODEL_TYPE2 },
-	{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12,
-	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
-	  (unsigned long) SONYPI_DEVICE_MODEL_TYPE2 },
-	{ }
-};
-
-MODULE_DEVICE_TABLE(pci, sonypi_id_tbl);
-
-static struct pci_driver sonypi_driver = {
-	name:		"sonypi",
-	id_table:	sonypi_id_tbl,
-	probe:		sonypi_probe,
-	remove:		sonypi_remove,
-};
-
 static int __init sonypi_init_module(void) {
-	if (is_sony_vaio_laptop)
-		return pci_module_init(&sonypi_driver);
+	struct pci_dev *pcidev = NULL;
+
+	if (is_sony_vaio_laptop) {
+		pcidev = pci_find_device(PCI_VENDOR_ID_INTEL, 
+					 PCI_DEVICE_ID_INTEL_82371AB_3, 
+					 NULL);
+		return sonypi_probe(pcidev);
+	}
 	else
 		return -ENODEV;
 }
 
 static void __exit sonypi_cleanup_module(void) {
-	pci_unregister_driver(&sonypi_driver);
+	sonypi_remove();
 }
 
 #ifndef MODULE
diff -uNr --exclude-from=dontdiff linux-2.4.12-ac2.orig/drivers/char/sonypi.h linux-2.4.12-ac2/drivers/char/sonypi.h
--- linux-2.4.12-ac2.orig/drivers/char/sonypi.h	Mon Oct 15 12:36:13 2001
+++ linux-2.4.12-ac2/drivers/char/sonypi.h	Mon Oct 15 12:33:42 2001
@@ -35,7 +35,7 @@
 #ifdef __KERNEL__
 
 #define SONYPI_DRIVER_MAJORVERSION	1
-#define SONYPI_DRIVER_MINORVERSION	6
+#define SONYPI_DRIVER_MINORVERSION	7
 
 #include <linux/types.h>
 #include <linux/pci.h>
-- 
Stelian Pop <stelian.pop@fr.alcove.com>
|---------------- Free Software Engineer -----------------|
| Alcôve - http://www.alcove.com - Tel: +33 1 49 22 68 00 |
|------------- Alcôve, liberating software ---------------|

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

end of thread, other threads:[~2001-10-15 11:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-10-15  8:21 PATCH: sonypi wrongly claims ownership of ISA and ACPI bridges Marcus Meissner
2001-10-15 11:56 ` Stelian Pop

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.