ChangeSet 1.837.4.1, 2002/12/05 23:31:21-06:00, am...@neo.rr.com
[PATCH] Linux PnP Support V0.93 - 2.5.50
Attached is a patch, that updates the 2.5.50 to the latest pnp
version. It includes all 9 of the previously submitted patches.
Highlights are as follows:
-PnP BIOS fixes
-Several new macros
-PnP Card Services
-Various bug fixes
-more drivers converted to the new APIs
diff -Nru a/drivers/input/gameport/ns558.c b/drivers/input/gameport/ns558.c
--- a/drivers/input/gameport/ns558.c Fri Dec 6 10:38:41 2002
+++ b/drivers/input/gameport/ns558.c Fri Dec 6 10:38:41 2002
@@ -37,7 +37,7 @@
#include <linux/init.h>
#include <linux/gameport.h>
#include <linux/slab.h>
-#include <linux/isapnp.h>
+#include <linux/pnp.h>
MODULE_AUTHOR("Vojtech Pavlik <vojt...@ucw.cz>");
MODULE_DESCRIPTION("Classic gameport (ISA/PnP) driver");
@@ -52,7 +52,7 @@
struct ns558 {
int type;
int size;
- struct pci_dev *dev;
+ struct pnp_dev *dev;
struct list_head node;
struct gameport gameport;
char phys[32];
@@ -159,67 +159,55 @@
list_add(&port->node, &ns558_list);
}
-#ifdef __ISAPNP__
+#ifdef CONFIG_PNP
-#define NS558_DEVICE(a,b,c,d)\
- .card_vendor = ISAPNP_ANY_ID, card_device: ISAPNP_ANY_ID,\
- .vendor = ISAPNP_VENDOR(a,b,c), function: ISAPNP_DEVICE(d)
-
-static struct isapnp_device_id pnp_devids[] = {
- { NS558_DEVICE('@','P','@',0x0001) }, /* ALS 100 */
- { NS558_DEVICE('@','P','@',0x0020) }, /* ALS 200 */
- { NS558_DEVICE('@','P','@',0x1001) }, /* ALS 100+ */
- { NS558_DEVICE('@','P','@',0x2001) }, /* ALS 120 */
- { NS558_DEVICE('A','S','B',0x16fd) }, /* AdLib NSC16 */
- { NS558_DEVICE('A','Z','T',0x3001) }, /* AZT1008 */
- { NS558_DEVICE('C','D','C',0x0001) }, /* Opl3-SAx */
- { NS558_DEVICE('C','S','C',0x0001) }, /* CS4232 */
- { NS558_DEVICE('C','S','C',0x000f) }, /* CS4236 */
- { NS558_DEVICE('C','S','C',0x0101) }, /* CS4327 */
- { NS558_DEVICE('C','T','L',0x7001) }, /* SB16 */
- { NS558_DEVICE('C','T','L',0x7002) }, /* AWE64 */
- { NS558_DEVICE('C','T','L',0x7005) }, /* Vibra16 */
- { NS558_DEVICE('E','N','S',0x2020) }, /* SoundscapeVIVO */
- { NS558_DEVICE('E','S','S',0x0001) }, /* ES1869 */
- { NS558_DEVICE('E','S','S',0x0005) }, /* ES1878 */
- { NS558_DEVICE('E','S','S',0x6880) }, /* ES688 */
- { NS558_DEVICE('I','B','M',0x0012) }, /* CS4232 */
- { NS558_DEVICE('O','P','T',0x0001) }, /* OPTi Audio16 */
- { NS558_DEVICE('Y','M','H',0x0006) }, /* Opl3-SA */
- { NS558_DEVICE('Y','M','H',0x0022) }, /* Opl3-SAx */
- { NS558_DEVICE('P','N','P',0xb02f) }, /* Generic */
- { 0, },
+static struct pnp_id pnp_devids[] = {
+ { .id = "@P@0001", .driver_data = 0 }, /* ALS 100 */
+ { .id = "@P@0020", .driver_data = 0 }, /* ALS 200 */
+ { .id = "@P@1001", .driver_data = 0 }, /* ALS 100+ */
+ { .id = "@P@2001", .driver_data = 0 }, /* ALS 120 */
+ { .id = "ASB16fd", .driver_data = 0 }, /* AdLib NSC16 */
+ { .id = "AZT3001", .driver_data = 0 }, /* AZT1008 */
+ { .id = "CDC0001", .driver_data = 0 }, /* Opl3-SAx */
+ { .id = "CSC0001", .driver_data = 0 }, /* CS4232 */
+ { .id = "CSC000f", .driver_data = 0 }, /* CS4236 */
+ { .id = "CSC0101", .driver_data = 0 }, /* CS4327 */
+ { .id = "CTL7001", .driver_data = 0 }, /* SB16 */
+ { .id = "CTL7002", .driver_data = 0 }, /* AWE64 */
+ { .id = "CTL7005", .driver_data = 0 }, /* Vibra16 */
+ { .id = "ENS2020", .driver_data = 0 }, /* SoundscapeVIVO */
+ { .id = "ESS0001", .driver_data = 0 }, /* ES1869 */
+ { .id = "ESS0005", .driver_data = 0 }, /* ES1878 */
+ { .id = "ESS6880", .driver_data = 0 }, /* ES688 */
+ { .id = "IBM0012", .driver_data = 0 }, /* CS4232 */
+ { .id = "OPT0001", .driver_data = 0 }, /* OPTi Audio16 */
+ { .id = "YMH0006", .driver_data = 0 }, /* Opl3-SA */
+ { .id = "YMH0022", .driver_data = 0 }, /* Opl3-SAx */
+ { .id = "PNPb02f", .driver_data = 0 }, /* Generic */
+ { .id = "", },
};
-MODULE_DEVICE_TABLE(isapnp, pnp_devids);
+MODULE_DEVICE_TABLE(pnp, pnp_devids);
-static void ns558_pnp_probe(struct pci_dev *dev)
+static int ns558_pnp_probe(struct pnp_dev *dev, const struct pnp_id *cid, const struct pnp_id *did)
{
int ioport, iolen;
struct ns558 *port;
- if (dev->prepare && dev->prepare(dev) < 0)
- return;
-
if (!(dev->resource[0].flags & IORESOURCE_IO)) {
printk(KERN_WARNING "ns558: No i/o ports on a gameport? Weird\n");
- return;
+ return -ENODEV;
}
- if (dev->activate && dev->activate(dev) < 0) {
- printk(KERN_ERR "ns558: PnP resource allocation failed\n");
- return;
- }
-
- ioport = pci_resource_start(dev, 0);
- iolen = pci_resource_len(dev, 0);
+ ioport = pnp_port_start(dev,0);
+ iolen = pnp_port_len(dev,0);
if (!request_region(ioport, iolen, "ns558-pnp"))
- goto deactivate;
+ return -EBUSY;
if (!(port = kmalloc(sizeof(struct ns558), GFP_KERNEL))) {
printk(KERN_ERR "ns558: Memory allocation failed.\n");
- goto deactivate;
+ return -ENOMEM;
}
memset(port, 0, sizeof(struct ns558));
@@ -231,54 +219,46 @@
port->gameport.phys = port->phys;
port->gameport.name = port->name;
port->gameport.id.bustype = BUS_ISAPNP;
- port->gameport.id.vendor = dev->vendor;
- port->gameport.id.product = dev->device;
port->gameport.id.version = 0x100;
- sprintf(port->phys, "isapnp%d.%d/gameport0", PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
+ sprintf(port->phys, "pnp%s/gameport0", dev->dev.bus_id);
sprintf(port->name, "%s", dev->dev.name[0] ? dev->dev.name : "NS558 PnP Gameport");
gameport_register_port(&port->gameport);
- printk(KERN_INFO "gameport: NS558 PnP at isapnp%d.%d io %#x",
- PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn), port->gameport.io);
+ printk(KERN_INFO "gameport: NS558 PnP at pnp%s io %#x",
+ dev->dev.bus_id, port->gameport.io);
if (iolen > 1) printk(" size %d", iolen);
printk(" speed %d kHz\n", port->gameport.speed);
list_add_tail(&port->node, &ns558_list);
- return;
-
-deactivate:
- if (dev->deactivate)
- dev->deactivate(dev);
+ return 0;
}
+
+static struct pnp_driver ns558_pnp_driver = {
+ .name = "ns558",
+ .id_table = pnp_devids,
+ .probe = ns558_pnp_probe,
+};
+
+#else
+
+static const struct pnp_driver ns558_pnp_driver;
+
#endif
int __init ns558_init(void)
{
int i = 0;
-#ifdef __ISAPNP__
- struct isapnp_device_id *devid;
- struct pci_dev *dev = NULL;
-#endif
/*
* Probe for ISA ports.
*/
- while (ns558_isa_portlist[i])
+ while (ns558_isa_portlist[i])
ns558_isa_probe(ns558_isa_portlist[i++]);
-/*
- * Probe for PnP ports.
- */
-
-#ifdef __ISAPNP__
- for (devid = pnp_devids; devid->vendor; devid++)
- while ((dev = isapnp_find_dev(NULL, devid->vendor, devid->function, dev)))
- ns558_pnp_probe(dev);
-#endif
-
+ pnp_register_driver(&ns558_pnp_driver);
return list_empty(&ns558_list) ? -ENODEV : 0;
}
@@ -290,13 +270,10 @@
gameport_unregister_port(&port->gameport);
switch (port->type) {
-#ifdef __ISAPNP__
+#ifdef CONFIG_PNP
case NS558_PNP:
- if (port->dev->deactivate)
- port->dev->deactivate(port->dev);
/* fall through */
#endif
-
case NS558_ISA:
release_region(port->gameport.io, port->size);
break;
@@ -305,6 +282,7 @@
break;
}
}
+ pnp_unregister_driver(&ns558_pnp_driver);
}
module_init(ns558_init);
diff -Nru a/drivers/net/e100/e100_main.c b/drivers/net/e100/e100_main.c
--- a/drivers/net/e100/e100_main.c Fri Dec 6 10:38:41 2002
+++ b/drivers/net/e100/e100_main.c Fri Dec 6 10:38:41 2002
@@ -87,8 +87,8 @@
extern int e100_create_proc_subdir(struct e100_private *, char *);
extern void e100_remove_proc_subdir(struct e100_private *, char *);
#else
-#define e100_create_proc_subdir(X) 0
-#define e100_remove_proc_subdir(X) do {} while(0)
+#define e100_create_proc_subdir(X, Y) 0
+#define e100_remove_proc_subdir(X, Y) do {} while(0)
#endif
static int e100_do_ethtool_ioctl(struct net_device *, struct ifreq *);
diff -Nru a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
--- a/drivers/parport/parport_pc.c Fri Dec 6 10:38:41 2002
+++ b/drivers/parport/parport_pc.c Fri Dec 6 10:38:41 2002
@@ -2973,7 +2973,7 @@
#endif /* CONFIG_PCI */
#ifdef CONFIG_PNP
-static const struct pnp_id pnp_dev_table[] = {
+static const struct pnp_device_id pnp_dev_table[] = {
/* Standard LPT Printer Port */
{.id = "PNP0400", .driver_data = 0},
/* ECP Printer Port */
@@ -2984,7 +2984,6 @@
/* we only need the pnp layer to activate the device, at least for now */
static struct pnp_driver parport_pc_pnp_driver = {
.name = "parport_pc",
- .card_id_table = NULL,
.id_table = pnp_dev_table,
};
#else
diff -Nru a/drivers/pnp/Kconfig b/drivers/pnp/Kconfig
--- a/drivers/pnp/Kconfig Fri Dec 6 10:38:41 2002
+++ b/drivers/pnp/Kconfig Fri Dec 6 10:38:41 2002
@@ -2,7 +2,7 @@
# Plug and Play configuration
#
-menu "Plug and Play configuration"
+menu "Plug and Play support"
config PNP
bool "Plug and Play support"
@@ -30,11 +30,20 @@
If unsure, say Y.
+config PNP_CARD
+ bool "Plug and Play card services"
+ depends on PNP
+ help
+ Select Y if you want the PnP Layer to manage cards. Cards are groups
+ of PnP devices. Some drivers, especially PnP sound card drivers, use
+ these cards. If you want to use the protocol ISAPNP you will need to
+ say Y here.
+
config PNP_DEBUG
bool "PnP Debug Messages"
depends on PNP
help
- Say Y if you want the Plug and Play Layer to print debug messages.
+ Say Y if you want the Plug and Play Layer to print debug messages.
This is useful if you are developing a PnP driver or troubleshooting.
comment "Protocols"
@@ -42,7 +51,7 @@
config ISAPNP
bool "ISA Plug and Play support (EXPERIMENTAL)"
- depends on PNP && EXPERIMENTAL
+ depends on PNP && EXPERIMENTAL && PNP_CARD
help
Say Y here if you would like support for ISA Plug and Play devices.
Some information is in <file:Documentation/isapnp.txt>.
diff -Nru a/drivers/pnp/Makefile b/drivers/pnp/Makefile
--- a/drivers/pnp/Makefile Fri Dec 6 10:38:41 2002
+++ b/drivers/pnp/Makefile Fri Dec 6 10:38:41 2002
@@ -2,11 +2,13 @@
# Makefile for the Linux Plug-and-Play Support.
#
-obj-y := core.o
...
read more »