Missing patch.

From: Rogier Wolff (R.E.Wolff@BitWizard.nl)
Date: Thu Aug 24 2000 - 02:42:14 EST


And here is the patch that belonged with the previous Email....

                                Roger.

diff -ur linux-2.4.0-test7.clean/drivers/atm/ambassador.c linux-2.4.0-test7.atmrefcount/drivers/atm/ambassador.c
--- linux-2.4.0-test7.clean/drivers/atm/ambassador.c Wed Aug 2 10:26:41 2000
+++ linux-2.4.0-test7.atmrefcount/drivers/atm/ambassador.c Thu Aug 24 08:57:07 2000
@@ -1251,15 +1251,10 @@
     }
   }
   
- // prevent module unload while sleeping (kmalloc/down)
- // doing this any earlier would complicate more error return paths
- MOD_INC_USE_COUNT;
-
   // get space for our vcc stuff
   vcc = kmalloc (sizeof(amb_vcc), GFP_KERNEL);
   if (!vcc) {
     PRINTK (KERN_ERR, "out of memory!");
- MOD_DEC_USE_COUNT;
     return -ENOMEM;
   }
   atm_vcc->dev_data = (void *) vcc;
@@ -1425,7 +1420,6 @@
   // say the VPI/VCI is free again
   clear_bit(ATM_VF_ADDR,&atm_vcc->flags);
 
- MOD_DEC_USE_COUNT;
   return;
 }
 
@@ -1703,7 +1697,8 @@
   close: amb_close,
   send: amb_send,
   sg_send: amb_sg_send,
- proc_read: amb_proc_read
+ proc_read: amb_proc_read,
+ owner: THIS_MODULE,
 };
 
 /********** housekeeping **********/
diff -ur linux-2.4.0-test7.clean/drivers/atm/atmtcp.c linux-2.4.0-test7.atmrefcount/drivers/atm/atmtcp.c
--- linux-2.4.0-test7.clean/drivers/atm/atmtcp.c Sun Jul 2 11:25:57 2000
+++ linux-2.4.0-test7.atmrefcount/drivers/atm/atmtcp.c Thu Aug 24 08:57:07 2000
@@ -109,7 +109,7 @@
 
 static void atmtcp_v_dev_close(struct atm_dev *dev)
 {
- MOD_DEC_USE_COUNT;
+ /* Nothing.... Isn't this simple :-) -- REW */
 }
 
 
@@ -297,7 +297,8 @@
         close: atmtcp_v_close,
         ioctl: atmtcp_v_ioctl,
         send: atmtcp_v_send,
- proc_read: atmtcp_v_proc
+ proc_read: atmtcp_v_proc,
+ owner: THIS_MODULE
 };
 
 
@@ -330,18 +331,14 @@
         struct atmtcp_dev_data *dev_data;
         struct atm_dev *dev;
 
- MOD_INC_USE_COUNT;
-
         dev_data = kmalloc(sizeof(*dev_data),GFP_KERNEL);
         if (!dev_data) {
- MOD_DEC_USE_COUNT;
                 return -ENOMEM;
         }
 
         dev = atm_dev_register(DEV_LABEL,&atmtcp_v_dev_ops,itf,NULL);
         if (!dev) {
                 kfree(dev_data);
- MOD_DEC_USE_COUNT;
                 return itf == -1 ? -ENOMEM : -EBUSY;
         }
         dev->ci_range.vpi_bits = MAX_VPI_BITS;
diff -ur linux-2.4.0-test7.clean/drivers/atm/fore200e.c linux-2.4.0-test7.atmrefcount/drivers/atm/fore200e.c
--- linux-2.4.0-test7.clean/drivers/atm/fore200e.c Wed Aug 2 10:26:41 2000
+++ linux-2.4.0-test7.atmrefcount/drivers/atm/fore200e.c Thu Aug 24 08:57:07 2000
@@ -1407,8 +1407,6 @@
     struct fore200e* fore200e = FORE200E_DEV(vcc->dev);
     struct fore200e_vcc* fore200e_vcc;
     
- MOD_INC_USE_COUNT;
-
     /* find a free VPI/VCI */
     fore200e_walk_vccs(vcc, &vpi, &vci);
 
@@ -1417,7 +1415,6 @@
 
     /* ressource checking only? */
     if (vci == ATM_VCI_UNSPEC || vpi == ATM_VPI_UNSPEC) {
- MOD_DEC_USE_COUNT;
         return 0;
     }
 
@@ -1437,7 +1434,6 @@
         down(&fore200e->rate_sf);
         if (fore200e->available_cell_rate < vcc->qos.txtp.max_pcr) {
             up(&fore200e->rate_sf);
- MOD_DEC_USE_COUNT;
             return -EAGAIN;
         }
         /* reserving the pseudo-CBR bandwidth at this point grants us
@@ -1454,7 +1450,6 @@
         down(&fore200e->rate_sf);
         fore200e->available_cell_rate += vcc->qos.txtp.max_pcr;
         up(&fore200e->rate_sf);
- MOD_DEC_USE_COUNT;
         return -ENOMEM;
     }
 
@@ -1465,7 +1460,6 @@
         down(&fore200e->rate_sf);
         fore200e->available_cell_rate += vcc->qos.txtp.max_pcr;
         up(&fore200e->rate_sf);
- MOD_DEC_USE_COUNT;
         return -EBUSY;
     }
     
@@ -1498,10 +1492,6 @@
     
     fore200e_activate_vcin(fore200e, 0, vcc, 0);
     
-#ifdef MODULE
- MOD_DEC_USE_COUNT;
-#endif
-
     kfree(FORE200E_VCC(vcc));
         
     if ((vcc->qos.txtp.traffic_class == ATM_CBR) && (vcc->qos.txtp.max_pcr > 0)) {
@@ -2599,8 +2589,6 @@
 
     printk(FORE200E "FORE Systems 200E-series driver - version " FORE200E_VERSION "\n");
 
- MOD_INC_USE_COUNT;
-
     /* for each configured bus interface */
     for (link = 0, bus = fore200e_bus; bus->model_name; bus++) {
 
@@ -2626,9 +2614,6 @@
         }
     }
 
- if (link <= 0)
- MOD_DEC_USE_COUNT;
-
     return link;
 }
 
@@ -2943,21 +2928,15 @@
 
 static const struct atmdev_ops fore200e_ops =
 {
- NULL, /* fore200e_dev_close */
- fore200e_open,
- fore200e_close,
- fore200e_ioctl,
- fore200e_getsockopt,
- fore200e_setsockopt,
- fore200e_send,
- NULL, /* fore200e_sg_send, */
- NULL, /* fore200e_send_oam, */
- NULL, /* fore200e_phy_put, */
- NULL, /* fore200e_phy_get, */
- NULL, /* fore200e_feedback, */
- fore200e_change_qos,
- NULL, /* fore200e_free_rx_skb */
- fore200e_proc_read
+ open: fore200e_open,
+ close: fore200e_close,
+ ioctl: fore200e_ioctl,
+ getsockopt: fore200e_getsockopt,
+ setsockopt: fore200e_setsockopt,
+ send: fore200e_send,
+ change_qos: fore200e_change_qos,
+ proc_read: fore200e_proc_read,
+ owner: THIS_MODULE,
 };
 
 
diff -ur linux-2.4.0-test7.clean/drivers/atm/horizon.c linux-2.4.0-test7.atmrefcount/drivers/atm/horizon.c
--- linux-2.4.0-test7.clean/drivers/atm/horizon.c Wed Aug 2 10:26:41 2000
+++ linux-2.4.0-test7.atmrefcount/drivers/atm/horizon.c Thu Aug 24 08:57:08 2000
@@ -2491,15 +2491,10 @@
     return -EINVAL;
   }
   
- // prevent module unload while sleeping (kmalloc)
- // doing this any earlier would complicate more error return paths
- MOD_INC_USE_COUNT;
-
   // get space for our vcc stuff and copy parameters into it
   vccp = kmalloc (sizeof(hrz_vcc), GFP_KERNEL);
   if (!vccp) {
     PRINTK (KERN_ERR, "out of memory!");
- MOD_DEC_USE_COUNT;
     return -ENOMEM;
   }
   *vccp = vcc;
@@ -2531,7 +2526,6 @@
   if (error) {
     PRINTD (DBG_QOS|DBG_VCC, "insufficient cell rate resources");
     kfree (vccp);
- MOD_DEC_USE_COUNT;
     return error;
   }
   
@@ -2550,7 +2544,6 @@
       error = hrz_open_rx (dev, channel);
     if (error) {
       kfree (vccp);
- MOD_DEC_USE_COUNT;
       return error;
     }
     // this link allows RX frames through
@@ -2620,7 +2613,6 @@
   kfree (vcc);
   // say the VPI/VCI is free again
   clear_bit(ATM_VF_ADDR,&atm_vcc->flags);
- MOD_DEC_USE_COUNT;
 }
 
 #if 0
@@ -2751,7 +2743,8 @@
   close: hrz_close,
   send: hrz_send,
   sg_send: hrz_sg_send,
- proc_read: hrz_proc_read
+ proc_read: hrz_proc_read,
+ owner: THIS_MODULE,
 };
 
 static int __init hrz_probe (void) {
diff -ur linux-2.4.0-test7.clean/drivers/atm/iphase.c linux-2.4.0-test7.atmrefcount/drivers/atm/iphase.c
--- linux-2.4.0-test7.clean/drivers/atm/iphase.c Sat Aug 12 10:47:11 2000
+++ linux-2.4.0-test7.atmrefcount/drivers/atm/iphase.c Thu Aug 24 08:57:08 2000
@@ -3143,7 +3143,8 @@
         phy_put: ia_phy_put,
         phy_get: ia_phy_get,
         change_qos: ia_change_qos,
- proc_read: ia_proc_read
+ proc_read: ia_proc_read,
+ owner: THIS_MODULE,
 };
           
   
@@ -3219,7 +3220,6 @@
                 printk(KERN_ERR DEV_LABEL ": no adapter found\n");
                 return -ENXIO;
         }
- // MOD_INC_USE_COUNT;
            ia_timer.expires = jiffies + 3*HZ;
            add_timer(&ia_timer);
    
@@ -3235,7 +3235,6 @@
         int i, j= 0;
  
         IF_EVENT(printk(">ia cleanup_module\n");)
- // MOD_DEC_USE_COUNT;
         if (MOD_IN_USE)
                 printk("ia: module in use\n");
         del_timer(&ia_timer);
diff -ur linux-2.4.0-test7.clean/drivers/atm/nicstar.c linux-2.4.0-test7.atmrefcount/drivers/atm/nicstar.c
--- linux-2.4.0-test7.clean/drivers/atm/nicstar.c Wed Aug 2 10:26:41 2000
+++ linux-2.4.0-test7.atmrefcount/drivers/atm/nicstar.c Thu Aug 24 08:57:08 2000
@@ -268,7 +268,8 @@
    send: ns_send,
    phy_put: ns_phy_put,
    phy_get: ns_phy_get,
- proc_read: ns_proc_read
+ proc_read: ns_proc_read,
+ owner: THIS_MODULE,
 };
 static struct timer_list ns_timer;
 static char *mac[NS_MAX_CARDS] = { NULL
@@ -1649,7 +1650,6 @@
    }
    
    set_bit(ATM_VF_READY,&vcc->flags);
- MOD_INC_USE_COUNT;
    return 0;
 }
 
@@ -1778,7 +1778,6 @@
    vcc->dev_data = NULL;
    clear_bit(ATM_VF_PARTIAL,&vcc->flags);
    clear_bit(ATM_VF_ADDR,&vcc->flags);
- MOD_DEC_USE_COUNT;
 
 #ifdef RX_DEBUG
    {
diff -ur linux-2.4.0-test7.clean/include/linux/atm_tcp.h linux-2.4.0-test7.atmrefcount/include/linux/atm_tcp.h
--- linux-2.4.0-test7.clean/include/linux/atm_tcp.h Tue Aug 22 12:54:10 2000
+++ linux-2.4.0-test7.atmrefcount/include/linux/atm_tcp.h Thu Aug 24 09:05:49 2000
@@ -65,6 +65,7 @@
         int (*attach)(struct atm_vcc *vcc,int itf);
         int (*create_persistent)(int itf);
         int (*remove_persistent)(int itf);
+ struct module *owner;
 };
 
 extern struct atm_tcp_ops atm_tcp_ops;
diff -ur linux-2.4.0-test7.clean/include/linux/atmdev.h linux-2.4.0-test7.atmrefcount/include/linux/atmdev.h
--- linux-2.4.0-test7.clean/include/linux/atmdev.h Tue Aug 22 12:33:00 2000
+++ linux-2.4.0-test7.atmrefcount/include/linux/atmdev.h Thu Aug 24 09:05:05 2000
@@ -375,6 +375,7 @@
         void (*free_rx_skb)(struct atm_vcc *vcc, struct sk_buff *skb);
                 /* @@@ temporary hack */
         int (*proc_read)(struct atm_dev *dev,loff_t *pos,char *page);
+ struct module *owner;
 };
 
 
diff -ur linux-2.4.0-test7.clean/net/atm/common.c linux-2.4.0-test7.atmrefcount/net/atm/common.c
--- linux-2.4.0-test7.clean/net/atm/common.c Wed Aug 2 10:27:13 2000
+++ linux-2.4.0-test7.atmrefcount/net/atm/common.c Thu Aug 24 08:57:08 2000
@@ -139,6 +139,7 @@
                                 vcc->dev->ops->free_rx_skb(vcc,skb);
                         else kfree_skb(skb);
                 }
+ fops_put (vcc->dev->ops);
                 if (atomic_read(&vcc->rx_inuse))
                         printk(KERN_WARNING "atm_release_vcc: strange ... "
                             "rx_inuse == %d after closing\n",
@@ -238,9 +239,11 @@
             vcc->qos.txtp.min_pcr,vcc->qos.txtp.max_pcr,vcc->qos.txtp.max_sdu);
         DPRINTK(" RX: %d, PCR %d..%d, SDU %d\n",vcc->qos.rxtp.traffic_class,
             vcc->qos.rxtp.min_pcr,vcc->qos.rxtp.max_pcr,vcc->qos.rxtp.max_sdu);
+ fops_get (dev->ops);
         if (dev->ops->open) {
                 error = dev->ops->open(vcc,vpi,vci);
                 if (error) {
+ fops_put (dev->ops);
                         bind_vcc(vcc,NULL);
                         return error;
                 }
@@ -639,17 +642,23 @@
                 case SIOCSIFATMTCP:
                         if (!capable(CAP_NET_ADMIN)) return -EPERM;
                         if (!atm_tcp_ops.attach) return -ENOPKG;
+ fops_get (&atm_tcp_ops);
                         error = atm_tcp_ops.attach(vcc,(int) arg);
                         if (error >= 0) sock->state = SS_CONNECTED;
+ else fops_put (&atm_tcp_ops);
                         return error;
                 case ATMTCP_CREATE:
                         if (!capable(CAP_NET_ADMIN)) return -EPERM;
                         if (!atm_tcp_ops.create_persistent) return -ENOPKG;
- return atm_tcp_ops.create_persistent((int) arg);
+ error = atm_tcp_ops.create_persistent((int) arg);
+ if (error < 0) fops_put (&atm_tcp_ops);
+ return error;
                 case ATMTCP_REMOVE:
                         if (!capable(CAP_NET_ADMIN)) return -EPERM;
                         if (!atm_tcp_ops.remove_persistent) return -ENOPKG;
- return atm_tcp_ops.remove_persistent((int) arg);
+ error = atm_tcp_ops.remove_persistent((int) arg);
+ fops_put (&atm_tcp_ops);
+ return error;
 #endif
                 default:
                         break;

-- 
** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2137555 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
*       Common sense is the collection of                                *
******  prejudices acquired by age eighteen.   -- Albert Einstein ********
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Aug 31 2000 - 21:00:12 EST