* [PATCH][ATM] remove mod_inc_use_count from lec
@ 2003-02-26 12:30 chas williams
2003-02-26 12:42 ` Duncan Sands
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: chas williams @ 2003-02-26 12:30 UTC (permalink / raw)
To: linux-kernel
this patch removes the deprecated MOD_INC_USE_COUNT/MOD_DEC_USE_COUNT
from the lane client.
Index: linux/net/atm/lec.c
===================================================================
RCS file: /home/chas/CVSROOT/linux/net/atm/lec.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- linux/net/atm/lec.c 25 Feb 2003 11:59:08 -0000 1.8
+++ linux/net/atm/lec.c 25 Feb 2003 19:48:44 -0000 1.9
@@ -543,7 +543,6 @@
}
printk("%s: Shut down!\n", dev->name);
- MOD_DEC_USE_COUNT;
}
static struct atmdev_ops lecdev_ops = {
@@ -824,7 +823,6 @@
if (dev_lec[i]->flags & IFF_UP) {
netif_start_queue(dev_lec[i]);
}
- MOD_INC_USE_COUNT;
return i;
}
Index: linux/net/atm/mpc.c
===================================================================
RCS file: /home/chas/CVSROOT/linux/net/atm/mpc.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- linux/net/atm/mpc.c 20 Feb 2003 13:46:30 -0000 1.1
+++ linux/net/atm/mpc.c 26 Feb 2003 12:27:30 -0000 1.2
@@ -799,7 +799,6 @@
send_set_mps_ctrl_addr(mpc->mps_ctrl_addr, mpc);
}
- MOD_INC_USE_COUNT;
return arg;
}
@@ -848,7 +847,6 @@
printk("mpoa: (%s) going down\n",
(mpc->dev) ? mpc->dev->name : "<unknown>");
- MOD_DEC_USE_COUNT;
return;
}
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH][ATM] remove mod_inc_use_count from lec 2003-02-26 12:30 [PATCH][ATM] remove mod_inc_use_count from lec chas williams @ 2003-02-26 12:42 ` Duncan Sands 2003-02-26 12:48 ` chas williams 2003-02-26 15:07 ` Jeff Garzik 2003-02-26 16:09 ` chas williams 2 siblings, 1 reply; 7+ messages in thread From: Duncan Sands @ 2003-02-26 12:42 UTC (permalink / raw) To: chas williams, linux-kernel On Wednesday 26 February 2003 13:30, chas williams wrote: > this patch removes the deprecated MOD_INC_USE_COUNT/MOD_DEC_USE_COUNT > from the lane client. Woah! Shouldn't you add some try_module_get calls in the atm device handling routines first? All the best, Duncan. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][ATM] remove mod_inc_use_count from lec 2003-02-26 12:42 ` Duncan Sands @ 2003-02-26 12:48 ` chas williams 0 siblings, 0 replies; 7+ messages in thread From: chas williams @ 2003-02-26 12:48 UTC (permalink / raw) To: Duncan Sands; +Cc: linux-kernel In message <200302261342.20282.baldrick@wanadoo.fr>,Duncan Sands writes: >Woah! Shouldn't you add some try_module_get calls in the atm device handling >routines first? yeah someone pointed this out already -- working on it. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][ATM] remove mod_inc_use_count from lec 2003-02-26 12:30 [PATCH][ATM] remove mod_inc_use_count from lec chas williams 2003-02-26 12:42 ` Duncan Sands @ 2003-02-26 15:07 ` Jeff Garzik 2003-02-26 16:09 ` chas williams 2 siblings, 0 replies; 7+ messages in thread From: Jeff Garzik @ 2003-02-26 15:07 UTC (permalink / raw) To: chas williams; +Cc: linux-kernel, David S. Miller chas williams wrote: > this patch removes the deprecated MOD_INC_USE_COUNT/MOD_DEC_USE_COUNT > from the lane client. For patches that look ok and do not require feedback, I would suggest CC'ing your patches to David Miller, who is the net stack maintainer and seems to have been applying several of your patches so far. Though "To: linux-kernel" gets your patch published, you typically want to find a "patch penguin" who will apply your patches and send them to Linus/Marcelo... Jeff ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][ATM] remove mod_inc_use_count from lec 2003-02-26 12:30 [PATCH][ATM] remove mod_inc_use_count from lec chas williams 2003-02-26 12:42 ` Duncan Sands 2003-02-26 15:07 ` Jeff Garzik @ 2003-02-26 16:09 ` chas williams 2003-02-27 4:29 ` David S. Miller 2 siblings, 1 reply; 7+ messages in thread From: chas williams @ 2003-02-26 16:09 UTC (permalink / raw) To: linux-kernel lets try this again. for now there are two owner pointers, the original in atmdev_ops and another in the struct shared between the common code and the lane code. the shared one pointers to the private owner. would that be the 'right' way or should i just ignore the owner field in atmdev_ops. Index: linux/net/atm/lec.h =================================================================== RCS file: /home/chas/CVSROOT/linux/net/atm/lec.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- linux/net/atm/lec.h 24 Feb 2003 13:24:46 -0000 1.3 +++ linux/net/atm/lec.h 26 Feb 2003 15:52:44 -0000 1.4 @@ -65,6 +65,7 @@ int (*mcast_attach)(struct atm_vcc *vcc, int arg); int (*vcc_attach)(struct atm_vcc *vcc, void *arg); struct net_device **(*get_lecs)(void); + struct module *owner; }; /* Index: linux/net/atm/proc.c =================================================================== RCS file: /home/chas/CVSROOT/linux/net/atm/proc.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- linux/net/atm/proc.c 20 Feb 2003 13:46:30 -0000 1.1 +++ linux/net/atm/proc.c 26 Feb 2003 15:52:44 -0000 1.2 @@ -444,8 +444,11 @@ } if (atm_lane_ops.get_lecs == NULL) return 0; /* the lane module is not there yet */ - else - dev_lec = atm_lane_ops.get_lecs(); + + if (!try_module_get(atm_lane_ops.owner)) + return 0; + + dev_lec = atm_lane_ops.get_lecs(); count = pos; for(d=0;d<MAX_LEC_ITF;d++) { @@ -458,6 +461,7 @@ e=sprintf(buf,"%s ", dev_lec[d]->name); lec_info(entry,buf+e); + module_put(atm_lane_ops.owner); return strlen(buf); } } @@ -466,6 +470,7 @@ if (--count) continue; e=sprintf(buf,"%s ",dev_lec[d]->name); lec_info(entry, buf+e); + module_put(atm_lane_ops.owner); return strlen(buf); } for(entry=priv->lec_no_forward; entry; @@ -473,6 +478,7 @@ if (--count) continue; e=sprintf(buf,"%s ",dev_lec[d]->name); lec_info(entry, buf+e); + module_put(atm_lane_ops.owner); return strlen(buf); } for(entry=priv->mcast_fwds; entry; @@ -480,9 +486,11 @@ if (--count) continue; e=sprintf(buf,"%s ",dev_lec[d]->name); lec_info(entry, buf+e); + module_put(atm_lane_ops.owner); return strlen(buf); } } + module_put(atm_lane_ops.owner); return 0; } #endif Index: linux/net/atm/common.c =================================================================== RCS file: /home/chas/CVSROOT/linux/net/atm/common.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- linux/net/atm/common.c 25 Feb 2003 20:06:54 -0000 1.4 +++ linux/net/atm/common.c 26 Feb 2003 15:52:44 -0000 1.5 @@ -685,12 +685,15 @@ } if (atm_lane_ops.lecd_attach == NULL) atm_lane_init(); - if (atm_lane_ops.lecd_attach == NULL) { /* try again */ + if (!try_module_get(atm_lane_ops.owner)) { /* try again */ ret_val = -ENOSYS; goto done; } error = atm_lane_ops.lecd_attach(vcc, (int)arg); - if (error >= 0) sock->state = SS_CONNECTED; + if (error >= 0) + sock->state = SS_CONNECTED; + else + module_put(atm_lane_ops.owner); ret_val = error; goto done; case ATMLEC_MCAST: Index: linux/net/atm/lec.c =================================================================== RCS file: /home/chas/CVSROOT/linux/net/atm/lec.c,v retrieving revision 1.8 retrieving revision 1.10 diff -u -r1.8 -r1.10 --- linux/net/atm/lec.c 25 Feb 2003 11:59:08 -0000 1.8 +++ linux/net/atm/lec.c 26 Feb 2003 15:52:44 -0000 1.10 @@ -543,12 +543,12 @@ } printk("%s: Shut down!\n", dev->name); - MOD_DEC_USE_COUNT; } static struct atmdev_ops lecdev_ops = { .close = lec_atm_close, - .send = lec_atm_send + .send = lec_atm_send, + .owner = THIS_MODULE }; static struct atm_dev lecatm_dev = { @@ -824,7 +824,6 @@ if (dev_lec[i]->flags & IFF_UP) { netif_start_queue(dev_lec[i]); } - MOD_INC_USE_COUNT; return i; } @@ -834,6 +833,7 @@ ops->mcast_attach = lec_mcast_attach; ops->vcc_attach = lec_vcc_attach; ops->get_lecs = get_dev_lec; + ops->owner = lecdev_ops.owner; printk("lec.c: " __DATE__ " " __TIME__ " initialized\n"); @@ -859,6 +859,7 @@ atm_lane_ops.mcast_attach = NULL; atm_lane_ops.vcc_attach = NULL; atm_lane_ops.get_lecs = NULL; + atm_lane_ops.owner = NULL; for (i = 0; i < MAX_LEC_ITF; i++) { if (dev_lec[i] != NULL) { ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][ATM] remove mod_inc_use_count from lec 2003-02-26 16:09 ` chas williams @ 2003-02-27 4:29 ` David S. Miller 2003-02-27 10:07 ` chas williams 0 siblings, 1 reply; 7+ messages in thread From: David S. Miller @ 2003-02-27 4:29 UTC (permalink / raw) To: chas williams; +Cc: linux-kernel On Wed, 2003-02-26 at 08:09, chas williams wrote: > lets try this again. Chas, if you don't CC: me I assume you don't want this patch applied yet. Just making sure you understand this :) ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][ATM] remove mod_inc_use_count from lec 2003-02-27 4:29 ` David S. Miller @ 2003-02-27 10:07 ` chas williams 0 siblings, 0 replies; 7+ messages in thread From: chas williams @ 2003-02-27 10:07 UTC (permalink / raw) To: David S. Miller; +Cc: linux-kernel In message <1046320155.8085.2.camel@rth.ninka.net>,"David S. Miller" writes: >Chas, if you don't CC: me I assume you don't want this patch >applied yet. Just making sure you understand this :) that was the intent. i dont know if i like the pointer to the pointer to the owner. i really dont like exporting a struct. maybe this should be a pointer to a struct instead. ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2003-02-27 9:57 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2003-02-26 12:30 [PATCH][ATM] remove mod_inc_use_count from lec chas williams 2003-02-26 12:42 ` Duncan Sands 2003-02-26 12:48 ` chas williams 2003-02-26 15:07 ` Jeff Garzik 2003-02-26 16:09 ` chas williams 2003-02-27 4:29 ` David S. Miller 2003-02-27 10:07 ` chas williams
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.