1 lets try this again. for now there are two owner pointers, the original
2 in atmdev_ops and another in the struct shared between the common code
3 and the lane code. the shared one pointers to the private owner.
4 would that be the 'right' way or should i just ignore the owner field
7 Index: linux/net/atm/lec.h
8 ===================================================================
9 RCS file: /home/chas/CVSROOT/linux/net/atm/lec.h,v
10 retrieving revision 1.3
11 retrieving revision 1.4
13 --- linux/net/atm/lec.h 24 Feb 2003 13:24:46 -0000 1.3
14 +++ linux/net/atm/lec.h 26 Feb 2003 15:52:44 -0000 1.4
16 int (*mcast_attach)(struct atm_vcc *vcc, int arg);
17 int (*vcc_attach)(struct atm_vcc *vcc, void *arg);
18 struct net_device **(*get_lecs)(void);
19 + struct module *owner;
23 Index: linux/net/atm/proc.c
24 ===================================================================
25 RCS file: /home/chas/CVSROOT/linux/net/atm/proc.c,v
26 retrieving revision 1.1
27 retrieving revision 1.2
29 --- linux/net/atm/proc.c 20 Feb 2003 13:46:30 -0000 1.1
30 +++ linux/net/atm/proc.c 26 Feb 2003 15:52:44 -0000 1.2
33 if (atm_lane_ops.get_lecs == NULL)
34 return 0; /* the lane module is not there yet */
36 - dev_lec = atm_lane_ops.get_lecs();
38 + if (!try_module_get(atm_lane_ops.owner))
41 + dev_lec = atm_lane_ops.get_lecs();
44 for(d=0;d<MAX_LEC_ITF;d++) {
48 lec_info(entry,buf+e);
49 + module_put(atm_lane_ops.owner);
54 if (--count) continue;
55 e=sprintf(buf,"%s ",dev_lec[d]->name);
56 lec_info(entry, buf+e);
57 + module_put(atm_lane_ops.owner);
60 for(entry=priv->lec_no_forward; entry;
62 if (--count) continue;
63 e=sprintf(buf,"%s ",dev_lec[d]->name);
64 lec_info(entry, buf+e);
65 + module_put(atm_lane_ops.owner);
68 for(entry=priv->mcast_fwds; entry;
70 if (--count) continue;
71 e=sprintf(buf,"%s ",dev_lec[d]->name);
72 lec_info(entry, buf+e);
73 + module_put(atm_lane_ops.owner);
77 + module_put(atm_lane_ops.owner);
81 Index: linux/net/atm/common.c
82 ===================================================================
83 RCS file: /home/chas/CVSROOT/linux/net/atm/common.c,v
84 retrieving revision 1.4
85 retrieving revision 1.5
87 --- linux/net/atm/common.c 25 Feb 2003 20:06:54 -0000 1.4
88 +++ linux/net/atm/common.c 26 Feb 2003 15:52:44 -0000 1.5
91 if (atm_lane_ops.lecd_attach == NULL)
93 - if (atm_lane_ops.lecd_attach == NULL) { /* try again */
94 + if (!try_module_get(atm_lane_ops.owner)) { /* try again */
98 error = atm_lane_ops.lecd_attach(vcc, (int)arg);
99 - if (error >= 0) sock->state = SS_CONNECTED;
101 + sock->state = SS_CONNECTED;
103 + module_put(atm_lane_ops.owner);
107 Index: linux/net/atm/lec.c
108 ===================================================================
109 RCS file: /home/chas/CVSROOT/linux/net/atm/lec.c,v
110 retrieving revision 1.8
111 retrieving revision 1.10
113 --- linux/net/atm/lec.c 25 Feb 2003 11:59:08 -0000 1.8
114 +++ linux/net/atm/lec.c 26 Feb 2003 15:52:44 -0000 1.10
115 @@ -543,12 +543,12 @@
118 printk("%s: Shut down!\n", dev->name);
122 static struct atmdev_ops lecdev_ops = {
123 close: lec_atm_close,
125 + send: lec_atm_send,
129 static struct atm_dev lecatm_dev = {
131 if (dev_lec[i]->flags & IFF_UP) {
132 netif_start_queue(dev_lec[i]);
139 ops->mcast_attach = lec_mcast_attach;
140 ops->vcc_attach = lec_vcc_attach;
141 ops->get_lecs = get_dev_lec;
142 + ops->owner = lecdev_ops.owner;
144 printk("lec.c: " __DATE__ " " __TIME__ " initialized\n");
147 atm_lane_ops.mcast_attach = NULL;
148 atm_lane_ops.vcc_attach = NULL;
149 atm_lane_ops.get_lecs = NULL;
150 + atm_lane_ops.owner = NULL;
152 for (i = 0; i < MAX_LEC_ITF; i++) {
153 if (dev_lec[i] != NULL) {
155 To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
156 the body of a message to majordomo@vger.kernel.org
157 More majordomo info at http://vger.kernel.org/majordomo-info.html
158 Please read the FAQ at http://www.tux.org/lkml/