PnP/ALSA - Card Service Changes (1/3)
Subsystems (2)
RFC PATCH 1/1 PnP/ALSA - Card Service Changes (1/3)
Hi Jaroslav,
This patch updates PnP Card Services to support the ALSA drivers and should make it possible for them to be converted.
It makes two key changes:
1.) PnP Cards can now have several pnp card drivers bound to them
2.) PnP Card Services now use manual attaching and detaching of drivers. As a result, it can run card requests through the same code paths as regular drivers and therefore the amount of code required to handle card drivers is significantly reduced.
I would appreciate any comments.
Thanks,
Adam
drivers/pnp/Kconfig +1 -10
@@ -30,15 +30,6 @@ 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
@@ -51,7 +42,7 @@ config ISAPNP bool "ISA Plug and Play support (EXPERIMENTAL)" - depends on PNP && EXPERIMENTAL && PNP_CARD + depends on PNP && EXPERIMENTAL help Say Y here if you would like support for ISA Plug and Play devices. Some information is in <file:Documentation/isapnp.txt>.
drivers/pnp/Makefile +1 -3
@@ -2,9 +2,7 @@ # Makefile for the Linux Plug-and-Play Support. # -pnp-card-$(CONFIG_PNP_CARD) = card.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-y := core.o card.o driver.o resource.o manager.o support.o interface.o quirks.o names.o system.o obj-$(CONFIG_PNPBIOS) += pnpbios/ obj-$(CONFIG_ISAPNP) += isapnp/
drivers/pnp/card.c +99 -195
423 lines not on this page · raw message
drivers/pnp/driver.c +12 -10
@@ -53,12 +53,11 @@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; -if (!drv) +if (!drv_id)return NULL ; -if (!dev) -return NULL ; -while (*drv_id->id){ -if (compare_pnp_id (dev->id,drv_id->id)) + +while (*drv_id->id) { +if (compare_pnp_id (dev->id, drv_id->id))return drv_id; drv_id++; }
@@ -102,14 +101,18 @@return error;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);if (error <0 )return error; } + }else if (pnp_drv->flags &PNP_DRIVER_RES_DISABLE ) { + error =pnp_disable_dev (pnp_dev); +if (error <0 ) +return error; } error =0 ; -if (pnp_drv->probe && pnp_dev->active) { +if (pnp_drv->probe) { dev_id =match_device (pnp_drv, pnp_dev);if (dev_id !=NULL ) error = pnp_drv->probe (pnp_dev, dev_id);
@@ -117,9 +120,8 @@if (error >=0 ){ pnp_dev->driver = pnp_drv; error =0 ; - } -else - goto fail; + }else + goto fail;return error; fail:
drivers/pnp/isapnp/core.c +5 -5
@@ -626,7 +626,7 @@isapnp_peek (name, size1); name[size1] ='\0' ; *size -= size1; - +/* clean whitespace from end of string */ while (size1 >0 && name[--size1] ==' ' ) name[size1] ='\0' ;
@@ -647,7 +647,7 @@return 1 ;if (pnp_build_resource (dev,0 ) ==NULL )return 1 ; -pnpc_add_device (card,dev); +pnp_add_card_device (card,dev);while (1 ) {if (isapnp_read_tag (&type, &size)<0 )return 1 ;
@@ -659,7 +659,7 @@if ((dev =isapnp_parse_device (card, size, number++)) ==NULL )return 1 ;pnp_build_resource (dev,0 ); -pnpc_add_device (card,dev); +pnp_add_card_device (card,dev); size =0 ; skip =0 ; }else {
@@ -852,7 +852,7 @@ device &0x0f , (device >>12 ) &0x0f , (device >> 8) & 0x0f); -pnpc_add_id (id,card); +pnp_add_card_id (id,card); }
@@ -962,7 +962,7 @@isapnp_parse_current_resources (dev, &dev->res); } -pnpc_add_card (card); +pnp_add_card (card); }isapnp_wait ();return 0 ;
drivers/pnp/system.c +1 -1
@@ -93,7 +93,7 @@static struct pnp_driver system_pnp_driver = { .name ="system" , - .flags =PNP_DRIVER_DO_NOT_ACTIVATE , + .flags =PNP_DRIVER_RES_DO_NOT_CHANGE , .id_table = pnp_dev_table, .probe = system_pnp_probe, .remove =NULL ,
include/linux/pnp.h +38 -50
155 lines not on this page · raw message