Update of /cvsroot/alsa/alsa-driver/support/pnp
In directory sc8-pr-cvs1:/tmp/cvs-serv21447

Modified Files:
        pnp.c pnp.h 
Log Message:
- added pnp_disable_dev().
- disable the devices when PNP_DRIVER_RES_DISABLE is set in
  pnp_register_card_driver().



Index: pnp.c
===================================================================
RCS file: /cvsroot/alsa/alsa-driver/support/pnp/pnp.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- pnp.c       8 Jul 2003 13:37:40 -0000       1.11
+++ pnp.c       5 Sep 2003 17:44:12 -0000       1.12
@@ -145,9 +145,6 @@
        if (parse_id(id, &vendor, &function) < 0)
                return NULL;
        dev = (struct pnp_dev *)isapnp_find_dev((struct isapnp_card *)clink->card, 
vendor, function, (struct isapnp_dev *)from);
-       if (dev != NULL && dev->p.active &&
-           (clink->driver->flags & PNP_DRIVER_RES_DO_NOT_CHANGE) == 0)
-               return NULL;
        return dev;
 }
 
@@ -193,6 +190,15 @@
                                        dev = ninst->devs[i] = (struct pnp_dev 
*)isapnp_find_dev((struct isapnp_card *)card, vendor, device, NULL);
                                        if (dev == NULL)
                                                goto __next;
+                                       if (! dev->p.active) {
+                                               if (! (drv->flags & 
PNP_DRIVER_RES_DO_NOT_CHANGE)) {
+                                                       pnp_activate_dev(dev);
+                                               }
+                                       } else {
+                                               if ((drv->flags & 
PNP_DRIVER_RES_DISABLE) == PNP_DRIVER_RES_DISABLE) {
+                                                       pnp_disable_dev(dev);
+                                               }
+                                       }
                                }
                                ninst->link.card = card;
                                ninst->link.driver = drv;
@@ -216,16 +222,12 @@
 {
        struct pnp_card_driver_instance *inst;
        struct list_head *p, *n;
-       unsigned int i;
        
        list_for_each_safe(p, n, &pnp_card_drivers) {
                inst = list_entry(p, struct pnp_card_driver_instance, list);
                if (inst->link.driver == drv) {
                        list_del(p);
                        drv->remove(&inst->link);
-                       if ((drv->flags & PNP_DRIVER_RES_DO_NOT_CHANGE) == 0)
-                               for (i = 0; i < PNP_MAX_DEVICES && inst->devs[i]; i++)
-                                       pnp_release_card_device(inst->devs[i]);
                        kfree(inst);
                }
        }
@@ -346,7 +348,7 @@
        unsigned int idx;
 
        if (dev->p.active)
-               return -EBUSY;
+               return 0; /* FIXME: should be -EBUSY but 2.6 pnp layer behaves like 
this */
 
        /* reserve the manual configuration */
        tmp = kmalloc(sizeof(*tmp), GFP_KERNEL);
@@ -369,6 +371,14 @@
        return dev->p.activate((struct isapnp_dev *)dev);
 }
 
+int pnp_disable_dev(struct pnp_dev *dev)
+{
+       if (! dev->p.active)
+               return 0;
+       return dev->p.deactivate((struct isapnp_dev *)dev);
+       /* FIXME: do we need clean up the resources again? */
+}
+
 static int __init pnp_init(void)
 {
        return 0;
@@ -390,3 +400,4 @@
 EXPORT_SYMBOL(pnp_init_resource_table);
 EXPORT_SYMBOL(pnp_manual_config_dev);
 EXPORT_SYMBOL(pnp_activate_dev);
+EXPORT_SYMBOL(pnp_disable_dev);

Index: pnp.h
===================================================================
RCS file: /cvsroot/alsa/alsa-driver/support/pnp/pnp.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- pnp.h       16 May 2003 09:08:24 -0000      1.3
+++ pnp.h       5 Sep 2003 17:44:12 -0000       1.4
@@ -198,6 +198,7 @@
 int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int 
mode);
 int pnp_activate_dev(struct pnp_dev *dev);
 static inline int pnp_is_active(struct pnp_dev *dev) { return dev->p.active; }
+int pnp_disable_dev(struct pnp_dev *dev);
 
 #else
 
@@ -211,6 +212,7 @@
 static inline int pnp_manual_config_dev(struct pnp_dev *dev, struct 
pnp_resource_table *res, int mode) { return -ENODEV; }
 static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; }
 static inline int pnp_is_active(struct pnp_dev * dev) { return -ENODEV; }
+static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; }
 
 #endif
 



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to