Commit 6cbb2ab5 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://linux-pnp.bkbits.net/linux-pnp

into home.transmeta.com:/home/torvalds/v2.5/linux
parents a104ba57 a36e0e18
...@@ -30,15 +30,6 @@ config PNP_NAMES ...@@ -30,15 +30,6 @@ config PNP_NAMES
If unsure, say Y. 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 config PNP_DEBUG
bool "PnP Debug Messages" bool "PnP Debug Messages"
depends on PNP depends on PNP
...@@ -51,7 +42,7 @@ comment "Protocols" ...@@ -51,7 +42,7 @@ comment "Protocols"
config ISAPNP config ISAPNP
bool "ISA Plug and Play support (EXPERIMENTAL)" bool "ISA Plug and Play support (EXPERIMENTAL)"
depends on PNP && EXPERIMENTAL && PNP_CARD depends on PNP && EXPERIMENTAL
help help
Say Y here if you would like support for ISA Plug and Play devices. Say Y here if you would like support for ISA Plug and Play devices.
Some information is in <file:Documentation/isapnp.txt>. Some information is in <file:Documentation/isapnp.txt>.
......
...@@ -2,9 +2,7 @@ ...@@ -2,9 +2,7 @@
# Makefile for the Linux Plug-and-Play Support. # Makefile for the Linux Plug-and-Play Support.
# #
pnp-card-$(CONFIG_PNP_CARD) = card.o obj-y := core.o card.o driver.o resource.o manager.o support.o interface.o quirks.o names.o system.o
obj-y := core.o driver.o resource.o manager.o support.o interface.o quirks.o names.o system.o $(pnp-card-y)
obj-$(CONFIG_PNPBIOS) += pnpbios/ obj-$(CONFIG_PNPBIOS) += pnpbios/
obj-$(CONFIG_ISAPNP) += isapnp/ obj-$(CONFIG_ISAPNP) += isapnp/
This diff is collapsed.
...@@ -53,12 +53,11 @@ int compare_pnp_id(struct pnp_id *pos, const char *id) ...@@ -53,12 +53,11 @@ int compare_pnp_id(struct pnp_id *pos, const char *id)
static const struct pnp_device_id * match_device(struct pnp_driver *drv, struct pnp_dev *dev) static const struct pnp_device_id * match_device(struct pnp_driver *drv, struct pnp_dev *dev)
{ {
const struct pnp_device_id *drv_id = drv->id_table; const struct pnp_device_id *drv_id = drv->id_table;
if (!drv) if (!drv_id)
return NULL; return NULL;
if (!dev)
return NULL; while (*drv_id->id) {
while (*drv_id->id){ if (compare_pnp_id(dev->id, drv_id->id))
if (compare_pnp_id(dev->id,drv_id->id))
return drv_id; return drv_id;
drv_id++; drv_id++;
} }
...@@ -102,14 +101,19 @@ static int pnp_device_probe(struct device *dev) ...@@ -102,14 +101,19 @@ static int pnp_device_probe(struct device *dev)
return error; return error;
if (pnp_dev->active == 0) { if (pnp_dev->active == 0) {
if (!(pnp_drv->flags & PNP_DRIVER_DO_NOT_ACTIVATE)) { if (!(pnp_drv->flags & PNP_DRIVER_RES_DO_NOT_CHANGE)) {
error = pnp_activate_dev(pnp_dev); error = pnp_activate_dev(pnp_dev);
if (error < 0) if (error < 0)
return error; return error;
} }
} else if ((pnp_drv->flags & PNP_DRIVER_RES_DISABLE)
== PNP_DRIVER_RES_DISABLE) {
error = pnp_disable_dev(pnp_dev);
if (error < 0)
return error;
} }
error = 0; error = 0;
if (pnp_drv->probe && pnp_dev->active) { if (pnp_drv->probe) {
dev_id = match_device(pnp_drv, pnp_dev); dev_id = match_device(pnp_drv, pnp_dev);
if (dev_id != NULL) if (dev_id != NULL)
error = pnp_drv->probe(pnp_dev, dev_id); error = pnp_drv->probe(pnp_dev, dev_id);
...@@ -117,9 +121,8 @@ static int pnp_device_probe(struct device *dev) ...@@ -117,9 +121,8 @@ static int pnp_device_probe(struct device *dev)
if (error >= 0){ if (error >= 0){
pnp_dev->driver = pnp_drv; pnp_dev->driver = pnp_drv;
error = 0; error = 0;
} } else
else goto fail;
goto fail;
return error; return error;
fail: fail:
......
...@@ -332,11 +332,18 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, char *buf) ...@@ -332,11 +332,18 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, char *buf)
buffer->buffer = buf; buffer->buffer = buf;
buffer->curr = buffer->buffer; buffer->curr = buffer->buffer;
pnp_printf(buffer,"mode = ");
if (dev->config_mode & PNP_CONFIG_MANUAL)
pnp_printf(buffer,"manual\n");
else
pnp_printf(buffer,"auto\n");
pnp_printf(buffer,"state = "); pnp_printf(buffer,"state = ");
if (dev->active) if (dev->active)
pnp_printf(buffer,"active\n"); pnp_printf(buffer,"active\n");
else else
pnp_printf(buffer,"disabled\n"); pnp_printf(buffer,"disabled\n");
for (i = 0; i < PNP_MAX_PORT; i++) { for (i = 0; i < PNP_MAX_PORT; i++) {
if (pnp_port_valid(dev, i)) { if (pnp_port_valid(dev, i)) {
pnp_printf(buffer,"io"); pnp_printf(buffer,"io");
...@@ -402,13 +409,13 @@ pnp_set_current_resources(struct device * dmdev, const char * ubuf, size_t count ...@@ -402,13 +409,13 @@ pnp_set_current_resources(struct device * dmdev, const char * ubuf, size_t count
retval = pnp_activate_dev(dev); retval = pnp_activate_dev(dev);
goto done; goto done;
} }
if (!strnicmp(buf,"auto-config",11)) { if (!strnicmp(buf,"auto",4)) {
if (dev->active) if (dev->active)
goto done; goto done;
retval = pnp_auto_config_dev(dev); retval = pnp_auto_config_dev(dev);
goto done; goto done;
} }
if (!strnicmp(buf,"clear-config",12)) { if (!strnicmp(buf,"clear",5)) {
if (dev->active) if (dev->active)
goto done; goto done;
spin_lock(&pnp_lock); spin_lock(&pnp_lock);
......
...@@ -626,7 +626,7 @@ isapnp_parse_name(char *name, unsigned int name_max, unsigned short *size) ...@@ -626,7 +626,7 @@ isapnp_parse_name(char *name, unsigned int name_max, unsigned short *size)
isapnp_peek(name, size1); isapnp_peek(name, size1);
name[size1] = '\0'; name[size1] = '\0';
*size -= size1; *size -= size1;
/* clean whitespace from end of string */ /* clean whitespace from end of string */
while (size1 > 0 && name[--size1] == ' ') while (size1 > 0 && name[--size1] == ' ')
name[size1] = '\0'; name[size1] = '\0';
...@@ -647,7 +647,7 @@ static int __init isapnp_create_device(struct pnp_card *card, ...@@ -647,7 +647,7 @@ static int __init isapnp_create_device(struct pnp_card *card,
return 1; return 1;
if (pnp_build_resource(dev, 0) == NULL) if (pnp_build_resource(dev, 0) == NULL)
return 1; return 1;
pnpc_add_device(card,dev); pnp_add_card_device(card,dev);
while (1) { while (1) {
if (isapnp_read_tag(&type, &size)<0) if (isapnp_read_tag(&type, &size)<0)
return 1; return 1;
...@@ -659,7 +659,7 @@ static int __init isapnp_create_device(struct pnp_card *card, ...@@ -659,7 +659,7 @@ static int __init isapnp_create_device(struct pnp_card *card,
if ((dev = isapnp_parse_device(card, size, number++)) == NULL) if ((dev = isapnp_parse_device(card, size, number++)) == NULL)
return 1; return 1;
pnp_build_resource(dev,0); pnp_build_resource(dev,0);
pnpc_add_device(card,dev); pnp_add_card_device(card,dev);
size = 0; size = 0;
skip = 0; skip = 0;
} else { } else {
...@@ -852,7 +852,7 @@ static void isapnp_parse_card_id(struct pnp_card * card, unsigned short vendor, ...@@ -852,7 +852,7 @@ static void isapnp_parse_card_id(struct pnp_card * card, unsigned short vendor,
device & 0x0f, device & 0x0f,
(device >> 12) & 0x0f, (device >> 12) & 0x0f,
(device >> 8) & 0x0f); (device >> 8) & 0x0f);
pnpc_add_id(id,card); pnp_add_card_id(id,card);
} }
...@@ -962,7 +962,7 @@ static int __init isapnp_build_device_list(void) ...@@ -962,7 +962,7 @@ static int __init isapnp_build_device_list(void)
isapnp_parse_current_resources(dev, &dev->res); isapnp_parse_current_resources(dev, &dev->res);
} }
pnpc_add_card(card); pnp_add_card(card);
} }
isapnp_wait(); isapnp_wait();
return 0; return 0;
......
...@@ -532,6 +532,39 @@ int pnp_auto_config_dev(struct pnp_dev *dev) ...@@ -532,6 +532,39 @@ int pnp_auto_config_dev(struct pnp_dev *dev)
return error; return error;
} }
static void pnp_process_manual_resources(struct pnp_resource_table * ctab, struct pnp_resource_table * ntab)
{
int idx;
for (idx = 0; idx < PNP_MAX_IRQ; idx++) {
if (ntab->irq_resource[idx].flags & IORESOURCE_AUTO)
continue;
ctab->irq_resource[idx].start = ntab->irq_resource[idx].start;
ctab->irq_resource[idx].end = ntab->irq_resource[idx].end;
ctab->irq_resource[idx].flags = ntab->irq_resource[idx].flags;
}
for (idx = 0; idx < PNP_MAX_DMA; idx++) {
if (ntab->dma_resource[idx].flags & IORESOURCE_AUTO)
continue;
ctab->dma_resource[idx].start = ntab->dma_resource[idx].start;
ctab->dma_resource[idx].end = ntab->dma_resource[idx].end;
ctab->dma_resource[idx].flags = ntab->dma_resource[idx].flags;
}
for (idx = 0; idx < PNP_MAX_PORT; idx++) {
if (ntab->port_resource[idx].flags & IORESOURCE_AUTO)
continue;
ctab->port_resource[idx].start = ntab->port_resource[idx].start;
ctab->port_resource[idx].end = ntab->port_resource[idx].end;
ctab->port_resource[idx].flags = ntab->port_resource[idx].flags;
}
for (idx = 0; idx < PNP_MAX_MEM; idx++) {
if (ntab->irq_resource[idx].flags & IORESOURCE_AUTO)
continue;
ctab->irq_resource[idx].start = ntab->mem_resource[idx].start;
ctab->irq_resource[idx].end = ntab->mem_resource[idx].end;
ctab->irq_resource[idx].flags = ntab->mem_resource[idx].flags;
}
}
/** /**
* pnp_manual_config_dev - Disables Auto Config and Manually sets the resource table * pnp_manual_config_dev - Disables Auto Config and Manually sets the resource table
* @dev: pointer to the desired device * @dev: pointer to the desired device
...@@ -554,7 +587,7 @@ int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table * res, ...@@ -554,7 +587,7 @@ int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table * res,
*bak = dev->res; *bak = dev->res;
spin_lock(&pnp_lock); spin_lock(&pnp_lock);
dev->res = *res; pnp_process_manual_resources(&dev->res, res);
if (!(mode & PNP_CONFIG_FORCE)) { if (!(mode & PNP_CONFIG_FORCE)) {
for (i = 0; i < PNP_MAX_PORT; i++) { for (i = 0; i < PNP_MAX_PORT; i++) {
if(pnp_check_port(dev,i)) if(pnp_check_port(dev,i))
...@@ -681,7 +714,7 @@ int pnp_disable_dev(struct pnp_dev *dev) ...@@ -681,7 +714,7 @@ int pnp_disable_dev(struct pnp_dev *dev)
return -1; return -1;
} }
dev->active = 0; /* just in case the protocol doesn't do this */ dev->active = 0; /* just in case the protocol doesn't do this */
pnp_dbg("the device '%s' has been disabled.", dev->dev.bus_id); pnp_dbg("res: the device '%s' has been disabled.", dev->dev.bus_id);
return 0; return 0;
} }
......
...@@ -558,25 +558,25 @@ void pnp_init_resource_table(struct pnp_resource_table *table) ...@@ -558,25 +558,25 @@ void pnp_init_resource_table(struct pnp_resource_table *table)
table->irq_resource[idx].name = NULL; table->irq_resource[idx].name = NULL;
table->irq_resource[idx].start = -1; table->irq_resource[idx].start = -1;
table->irq_resource[idx].end = -1; table->irq_resource[idx].end = -1;
table->irq_resource[idx].flags = 0; table->irq_resource[idx].flags = IORESOURCE_AUTO;
} }
for (idx = 0; idx < PNP_MAX_DMA; idx++) { for (idx = 0; idx < PNP_MAX_DMA; idx++) {
table->dma_resource[idx].name = NULL; table->dma_resource[idx].name = NULL;
table->dma_resource[idx].start = -1; table->dma_resource[idx].start = -1;
table->dma_resource[idx].end = -1; table->dma_resource[idx].end = -1;
table->dma_resource[idx].flags = 0; table->dma_resource[idx].flags = IORESOURCE_AUTO;
} }
for (idx = 0; idx < PNP_MAX_PORT; idx++) { for (idx = 0; idx < PNP_MAX_PORT; idx++) {
table->port_resource[idx].name = NULL; table->port_resource[idx].name = NULL;
table->port_resource[idx].start = 0; table->port_resource[idx].start = 0;
table->port_resource[idx].end = 0; table->port_resource[idx].end = 0;
table->port_resource[idx].flags = 0; table->port_resource[idx].flags = IORESOURCE_AUTO;
} }
for (idx = 0; idx < PNP_MAX_MEM; idx++) { for (idx = 0; idx < PNP_MAX_MEM; idx++) {
table->mem_resource[idx].name = NULL; table->mem_resource[idx].name = NULL;
table->mem_resource[idx].start = 0; table->mem_resource[idx].start = 0;
table->mem_resource[idx].end = 0; table->mem_resource[idx].end = 0;
table->mem_resource[idx].flags = 0; table->mem_resource[idx].flags = IORESOURCE_AUTO;
} }
} }
......
...@@ -93,8 +93,8 @@ static int system_pnp_probe(struct pnp_dev * dev, const struct pnp_device_id *de ...@@ -93,8 +93,8 @@ static int system_pnp_probe(struct pnp_dev * dev, const struct pnp_device_id *de
static struct pnp_driver system_pnp_driver = { static struct pnp_driver system_pnp_driver = {
.name = "system", .name = "system",
.flags = PNP_DRIVER_DO_NOT_ACTIVATE,
.id_table = pnp_dev_table, .id_table = pnp_dev_table,
.flags = PNP_DRIVER_RES_DO_NOT_CHANGE,
.probe = system_pnp_probe, .probe = system_pnp_probe,
.remove = NULL, .remove = NULL,
}; };
......
...@@ -138,11 +138,8 @@ struct pnp_card { ...@@ -138,11 +138,8 @@ struct pnp_card {
struct list_head global_list; /* node in global list of cards */ struct list_head global_list; /* node in global list of cards */
struct list_head protocol_list; /* node in protocol's list of cards */ struct list_head protocol_list; /* node in protocol's list of cards */
struct list_head devices; /* devices attached to the card */ struct list_head devices; /* devices attached to the card */
struct list_head rdevs; /* a list of devices requested by the card driver */
int status;
struct pnp_protocol * protocol; struct pnp_protocol * protocol;
struct pnpc_driver * driver;
struct pnp_id * id; /* contains supported EISA IDs*/ struct pnp_id * id; /* contains supported EISA IDs*/
void * protocol_data; /* Used to store protocol specific data */ void * protocol_data; /* Used to store protocol specific data */
...@@ -161,24 +158,30 @@ struct pnp_card { ...@@ -161,24 +158,30 @@ struct pnp_card {
(card) != global_to_pnp_card(&pnp_cards); \ (card) != global_to_pnp_card(&pnp_cards); \
(card) = global_to_pnp_card((card)->global_list.next)) (card) = global_to_pnp_card((card)->global_list.next))
static inline void *pnpc_get_drvdata (struct pnp_card *pcard) static inline void *pnp_get_card_protodata (struct pnp_card *pcard)
{ {
return dev_get_drvdata(&pcard->dev); return pcard->protocol_data;
} }
static inline void pnpc_set_drvdata (struct pnp_card *pcard, void *data) static inline void pnp_set_card_protodata (struct pnp_card *pcard, void *data)
{ {
dev_set_drvdata(&pcard->dev, data); pcard->protocol_data = data;
} }
static inline void *pnpc_get_protodata (struct pnp_card *pcard) struct pnp_card_link {
struct pnp_card * card;
struct pnp_card_driver * driver;
void * driver_data;
};
static inline void *pnp_get_card_drvdata (struct pnp_card_link *pcard)
{ {
return pcard->protocol_data; return pcard->driver_data;
} }
static inline void pnpc_set_protodata (struct pnp_card *pcard, void *data) static inline void pnp_set_card_drvdata (struct pnp_card_link *pcard, void *data)
{ {
pcard->protocol_data = data; pcard->driver_data = data;
} }
struct pnp_dev { struct pnp_dev {
...@@ -196,6 +199,7 @@ struct pnp_dev { ...@@ -196,6 +199,7 @@ struct pnp_dev {
struct pnp_protocol * protocol; struct pnp_protocol * protocol;
struct pnp_card * card; /* card the device is attached to, none if NULL */ struct pnp_card * card; /* card the device is attached to, none if NULL */
struct pnp_driver * driver; struct pnp_driver * driver;
struct pnp_card_link * card_link;
struct pnp_id * id; /* supported EISA IDs*/ struct pnp_id * id; /* supported EISA IDs*/
struct pnp_resource_table res; /* contains the currently chosen resources */ struct pnp_resource_table res; /* contains the currently chosen resources */
...@@ -299,11 +303,8 @@ struct pnp_card_id { ...@@ -299,11 +303,8 @@ struct pnp_card_id {
} devs[PNP_MAX_DEVICES]; /* logical devices */ } devs[PNP_MAX_DEVICES]; /* logical devices */
}; };
#define PNP_DRIVER_DO_NOT_ACTIVATE (1<<0)
struct pnp_driver { struct pnp_driver {
struct list_head node; char * name;
char *name;
const struct pnp_device_id *id_table; const struct pnp_device_id *id_table;
unsigned int flags; unsigned int flags;
int (*probe) (struct pnp_dev *dev, const struct pnp_device_id *dev_id); int (*probe) (struct pnp_dev *dev, const struct pnp_device_id *dev_id);
...@@ -311,21 +312,22 @@ struct pnp_driver { ...@@ -311,21 +312,22 @@ struct pnp_driver {
struct device_driver driver; struct device_driver driver;
}; };
#define to_pnp_driver(drv) container_of(drv,struct pnp_driver, driver) #define to_pnp_driver(drv) container_of(drv, struct pnp_driver, driver)
#define PNPC_DRIVER_DO_NOT_ACTIVATE (1<<0)
struct pnpc_driver { struct pnp_card_driver {
struct list_head node; char * name;
char *name;
const struct pnp_card_id *id_table; const struct pnp_card_id *id_table;
unsigned int flags; unsigned int flags;
int (*probe) (struct pnp_card *card, const struct pnp_card_id *card_id); int (*probe) (struct pnp_card_link *card, const struct pnp_card_id *card_id);
void (*remove) (struct pnp_card *card); void (*remove) (struct pnp_card_link *card);
struct device_driver driver; struct pnp_driver link;
}; };
#define to_pnpc_driver(drv) container_of(drv,struct pnpc_driver, driver) #define to_pnp_card_driver(drv) container_of(drv, struct pnp_card_driver, link)
/* pnp driver flags */
#define PNP_DRIVER_RES_DO_NOT_CHANGE 0x0001 /* do not change the state of the device */
#define PNP_DRIVER_RES_DISABLE 0x0003 /* ensure the device is disabled */
/* /*
...@@ -366,9 +368,21 @@ int pnp_register_protocol(struct pnp_protocol *protocol); ...@@ -366,9 +368,21 @@ int pnp_register_protocol(struct pnp_protocol *protocol);
void pnp_unregister_protocol(struct pnp_protocol *protocol); void pnp_unregister_protocol(struct pnp_protocol *protocol);
int pnp_add_device(struct pnp_dev *dev); int pnp_add_device(struct pnp_dev *dev);
void pnp_remove_device(struct pnp_dev *dev); void pnp_remove_device(struct pnp_dev *dev);
extern struct list_head pnp_global;
int pnp_device_attach(struct pnp_dev *pnp_dev); int pnp_device_attach(struct pnp_dev *pnp_dev);
void pnp_device_detach(struct pnp_dev *pnp_dev); void pnp_device_detach(struct pnp_dev *pnp_dev);
extern struct list_head pnp_global;
/* card */
int pnp_add_card(struct pnp_card *card);
void pnp_remove_card(struct pnp_card *card);
int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev);
void pnp_remove_card_device(struct pnp_dev *dev);
int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card);
struct pnp_dev * pnp_request_card_device(struct pnp_card_link *clink, const char * id, struct pnp_dev * from);
void pnp_release_card_device(struct pnp_dev * dev);
int pnp_register_card_driver(struct pnp_card_driver * drv);
void pnp_unregister_card_driver(struct pnp_card_driver * drv);
extern struct list_head pnp_cards;
/* resource */ /* resource */
struct pnp_resources * pnp_build_resource(struct pnp_dev *dev, int dependent); struct pnp_resources * pnp_build_resource(struct pnp_dev *dev, int dependent);
...@@ -413,6 +427,17 @@ static inline void pnp_remove_device(struct pnp_dev *dev) { } ...@@ -413,6 +427,17 @@ static inline void pnp_remove_device(struct pnp_dev *dev) { }
static inline int pnp_device_attach(struct pnp_dev *pnp_dev) { return -ENODEV; } static inline int pnp_device_attach(struct pnp_dev *pnp_dev) { return -ENODEV; }
static inline void pnp_device_detach(struct pnp_dev *pnp_dev) { ; } static inline void pnp_device_detach(struct pnp_dev *pnp_dev) { ; }
/* card */
static inline int pnp_add_card(struct pnp_card *card) { return -ENODEV; }
static inline void pnp_remove_card(struct pnp_card *card) { ; }
static inline int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev) { return -ENODEV; }
static inline void pnp_remove_card_device(struct pnp_dev *dev) { ; }
static inline int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card) { return -ENODEV; }
static inline struct pnp_dev * pnp_request_card_device(struct pnp_card_link *clink, const char * id, struct pnp_dev * from) { return -ENODEV; }
static inline void pnp_release_card_device(struct pnp_dev * dev) { ; }
static inline int pnp_register_card_driver(struct pnp_card_driver * drv) { return -ENODEV; }
static inline void pnp_unregister_card_driver(struct pnp_card_driver * drv) { ; }
/* resource */ /* resource */
static inline struct pnp_resources * pnp_build_resource(struct pnp_dev *dev, int dependent) { return NULL; } static inline struct pnp_resources * pnp_build_resource(struct pnp_dev *dev, int dependent) { return NULL; }
static inline struct pnp_resources * pnp_find_resources(struct pnp_dev *dev, int depnum) { return NULL; } static inline struct pnp_resources * pnp_find_resources(struct pnp_dev *dev, int depnum) { return NULL; }
...@@ -446,37 +471,6 @@ static inline unsigned char * pnp_write_resources(unsigned char * p, unsigned ch ...@@ -446,37 +471,6 @@ static inline unsigned char * pnp_write_resources(unsigned char * p, unsigned ch
#endif /* CONFIG_PNP */ #endif /* CONFIG_PNP */
#if defined(CONFIG_PNP_CARD)
/* card */
int pnpc_add_card(struct pnp_card *card);
void pnpc_remove_card(struct pnp_card *card);
int pnpc_add_device(struct pnp_card *card, struct pnp_dev *dev);
void pnpc_remove_device(struct pnp_dev *dev);
struct pnp_dev * pnp_request_card_device(struct pnp_card *card, const char *id, struct pnp_dev *from);
void pnp_release_card_device(struct pnp_dev *dev);
int pnpc_register_driver(struct pnpc_driver * drv);
void pnpc_unregister_driver(struct pnpc_driver *drv);
int pnpc_add_id(struct pnp_id *id, struct pnp_card *card);
extern struct list_head pnp_cards;
int pnpc_attach(struct pnp_card *card);
void pnpc_detach(struct pnp_card *card);
#else
/* card */
static inline int pnpc_add_card(struct pnp_card *card) { return -ENODEV; }
static inline void pnpc_remove_card(struct pnp_card *card) { ; }
static inline int pnpc_add_device(struct pnp_card *card, struct pnp_dev *dev) { return -ENODEV; }
static inline void pnpc_remove_device(struct pnp_dev *dev) { ; }
static inline struct pnp_dev * pnp_request_card_device(struct pnp_card *card, const char *id, struct pnp_dev *from) { return NULL; }
static inline void pnp_release_card_device(struct pnp_dev *dev) { ; }
static inline int pnpc_register_driver(struct pnpc_driver *drv) { return -ENODEV; }
static inline void pnpc_unregister_driver(struct pnpc_driver *drv) { ; }
static inline int pnpc_add_id(struct pnp_id *id, struct pnp_card *card) { return -ENODEV; }
#endif /* CONFIG_PNP_CARD */
#define pnp_err(format, arg...) printk(KERN_ERR "pnp: " format "\n" , ## arg) #define pnp_err(format, arg...) printk(KERN_ERR "pnp: " format "\n" , ## arg)
#define pnp_info(format, arg...) printk(KERN_INFO "pnp: " format "\n" , ## arg) #define pnp_info(format, arg...) printk(KERN_INFO "pnp: " format "\n" , ## arg)
#define pnp_warn(format, arg...) printk(KERN_WARNING "pnp: " format "\n" , ## arg) #define pnp_warn(format, arg...) printk(KERN_WARNING "pnp: " format "\n" , ## arg)
......
This diff is collapsed.
...@@ -32,9 +32,9 @@ ...@@ -32,9 +32,9 @@
#include "sound_config.h" #include "sound_config.h"
#include "sb_mixer.h" #include "sb_mixer.h"
#include "sb.h" #include "sb.h"
#ifdef CONFIG_PNP_CARD #ifdef CONFIG_PNP
#include <linux/pnp.h> #include <linux/pnp.h>
#endif #endif /* CONFIG_PNP */
#include "sb_card.h" #include "sb_card.h"
MODULE_DESCRIPTION("OSS Soundblaster ISA PnP and legacy sound driver"); MODULE_DESCRIPTION("OSS Soundblaster ISA PnP and legacy sound driver");
...@@ -54,7 +54,7 @@ static int __initdata sm_games = 0; /* Logitech soundman games? */ ...@@ -54,7 +54,7 @@ static int __initdata sm_games = 0; /* Logitech soundman games? */
struct sb_card_config *legacy = NULL; struct sb_card_config *legacy = NULL;
#ifdef CONFIG_PNP_CARD #ifdef CONFIG_PNP
static int __initdata pnp = 1; static int __initdata pnp = 1;
/* /*
static int __initdata uart401 = 0; static int __initdata uart401 = 0;
...@@ -85,7 +85,7 @@ module_param(acer, int, 000); ...@@ -85,7 +85,7 @@ module_param(acer, int, 000);
MODULE_PARM_DESC(acer, "Set this to detect cards in some ACER notebooks "\ MODULE_PARM_DESC(acer, "Set this to detect cards in some ACER notebooks "\
"(doesn't work with pnp)"); "(doesn't work with pnp)");
#ifdef CONFIG_PNP_CARD #ifdef CONFIG_PNP
module_param(pnp, int, 000); module_param(pnp, int, 000);
MODULE_PARM_DESC(pnp, "Went set to 0 will disable detection using PnP. "\ MODULE_PARM_DESC(pnp, "Went set to 0 will disable detection using PnP. "\
"Default is 1.\n"); "Default is 1.\n");
...@@ -95,7 +95,7 @@ module_param(uart401, int, 000); ...@@ -95,7 +95,7 @@ module_param(uart401, int, 000);
MODULE_PARM_DESC(uart401, "When set to 1, will attempt to detect and enable"\ MODULE_PARM_DESC(uart401, "When set to 1, will attempt to detect and enable"\
"the mpu on some clones"); "the mpu on some clones");
*/ */
#endif /* CONFIG_PNP_CARD */ #endif /* CONFIG_PNP */
/* OSS subsystem card registration shared by PnP and legacy routines */ /* OSS subsystem card registration shared by PnP and legacy routines */
static int sb_register_oss(struct sb_card_config *scc, struct sb_module_options *sbmo) static int sb_register_oss(struct sb_card_config *scc, struct sb_module_options *sbmo)
...@@ -157,7 +157,7 @@ static int sb_init_legacy(void) ...@@ -157,7 +157,7 @@ static int sb_init_legacy(void)
return sb_register_oss(legacy, &sbmo); return sb_register_oss(legacy, &sbmo);
} }
#ifdef CONFIG_PNP_CARD #ifdef CONFIG_PNP
/* Populate the OSS subsystem structures with information from PnP */ /* Populate the OSS subsystem structures with information from PnP */
static void sb_dev2cfg(struct pnp_dev *dev, struct sb_card_config *scc) static void sb_dev2cfg(struct pnp_dev *dev, struct sb_card_config *scc)
...@@ -224,7 +224,7 @@ static void sb_dev2cfg(struct pnp_dev *dev, struct sb_card_config *scc) ...@@ -224,7 +224,7 @@ static void sb_dev2cfg(struct pnp_dev *dev, struct sb_card_config *scc)
} }
/* Probe callback function for the PnP API */ /* Probe callback function for the PnP API */
static int sb_pnp_probe(struct pnp_card *card, const struct pnp_card_id *card_id) static int sb_pnp_probe(struct pnp_card_link *card, const struct pnp_card_id *card_id)
{ {
struct sb_card_config *scc; struct sb_card_config *scc;
struct sb_module_options sbmo = {0}; /* Default to 0 for PnP */ struct sb_module_options sbmo = {0}; /* Default to 0 for PnP */
...@@ -252,14 +252,14 @@ static int sb_pnp_probe(struct pnp_card *card, const struct pnp_card_id *card_id ...@@ -252,14 +252,14 @@ static int sb_pnp_probe(struct pnp_card *card, const struct pnp_card_id *card_id
"dma=%d, dma16=%d\n", scc->conf.io_base, scc->conf.irq, "dma=%d, dma16=%d\n", scc->conf.io_base, scc->conf.irq,
scc->conf.dma, scc->conf.dma2); scc->conf.dma, scc->conf.dma2);
pnpc_set_drvdata(card, scc); pnp_set_card_drvdata(card, scc);
return sb_register_oss(scc, &sbmo); return sb_register_oss(scc, &sbmo);
} }
static void sb_pnp_remove(struct pnp_card *card) static void sb_pnp_remove(struct pnp_card_link *card)
{ {
struct sb_card_config *scc = pnpc_get_drvdata(card); struct sb_card_config *scc = pnp_get_card_drvdata(card);
if(!scc) if(!scc)
return; return;
...@@ -269,13 +269,13 @@ static void sb_pnp_remove(struct pnp_card *card) ...@@ -269,13 +269,13 @@ static void sb_pnp_remove(struct pnp_card *card)
sb_unload(scc); sb_unload(scc);
} }
static struct pnpc_driver sb_pnp_driver = { static struct pnp_card_driver sb_pnp_driver = {
.name = "OSS SndBlstr", /* 16 character limit */ .name = "OSS SndBlstr", /* 16 character limit */
.id_table = sb_pnp_card_table, .id_table = sb_pnp_card_table,
.probe = sb_pnp_probe, .probe = sb_pnp_probe,
.remove = sb_pnp_remove, .remove = sb_pnp_remove,
}; };
#endif /* CONFIG_PNP_CARD */ #endif /* CONFIG_PNP */
static int __init sb_init(void) static int __init sb_init(void)
{ {
...@@ -293,9 +293,9 @@ static int __init sb_init(void) ...@@ -293,9 +293,9 @@ static int __init sb_init(void)
printk(KERN_ERR "sb: Error: At least io, irq, and dma "\ printk(KERN_ERR "sb: Error: At least io, irq, and dma "\
"must be set for legacy cards.\n"); "must be set for legacy cards.\n");
#ifdef CONFIG_PNP_CARD #ifdef CONFIG_PNP
if(pnp) { if(pnp) {
pres = pnpc_register_driver(&sb_pnp_driver); pres = pnp_register_card_driver(&sb_pnp_driver);
} }
#endif #endif
printk(KERN_INFO "sb: Init: Done\n"); printk(KERN_INFO "sb: Init: Done\n");
...@@ -315,8 +315,8 @@ static void __exit sb_exit(void) ...@@ -315,8 +315,8 @@ static void __exit sb_exit(void)
sb_unload(legacy); sb_unload(legacy);
} }
#ifdef CONFIG_PNP_CARD #ifdef CONFIG_PNP
pnpc_unregister_driver(&sb_pnp_driver); pnp_unregister_card_driver(&sb_pnp_driver);
#endif #endif
if (smw_free) { if (smw_free) {
......
...@@ -16,7 +16,7 @@ struct sb_card_config { ...@@ -16,7 +16,7 @@ struct sb_card_config {
int mpu; int mpu;
}; };
#ifdef CONFIG_PNP_CARD #ifdef CONFIG_PNP
/* /*
* SoundBlaster PnP tables and structures. * SoundBlaster PnP tables and structures.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment