aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/capi
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@web.de>2010-02-08 05:12:34 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-16 19:01:31 -0500
commita84fdf41b25ad4c2b83e7c8ca87268fdbe6207d1 (patch)
treec0da5a38945c8e230abc17d3e3b5e64abe41ba17 /drivers/isdn/capi
parent3d5d30fe7a6aa4c9d63dc4fe6b6da6abac423bc2 (diff)
CAPI: Drop atomic ttyopencount
Not needed, tty->count keeps track of this information. At this chance, drop traces of ancient attempts to debug this logic via _DEBUG_REFCOUNT. Signed-off-by: Jan Kiszka <jan.kiszka@web.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn/capi')
-rw-r--r--drivers/isdn/capi/capi.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
index 0b264b4565c8..867589a5916a 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -45,7 +45,6 @@ MODULE_DESCRIPTION("CAPI4Linux: Userspace /dev/capi20 interface");
45MODULE_AUTHOR("Carsten Paeth"); 45MODULE_AUTHOR("Carsten Paeth");
46MODULE_LICENSE("GPL"); 46MODULE_LICENSE("GPL");
47 47
48#undef _DEBUG_REFCOUNT /* alloc/free and open/close debug */
49#undef _DEBUG_TTYFUNCS /* call to tty_driver */ 48#undef _DEBUG_TTYFUNCS /* call to tty_driver */
50#undef _DEBUG_DATAFLOW /* data flow */ 49#undef _DEBUG_DATAFLOW /* data flow */
51 50
@@ -97,7 +96,6 @@ struct capiminor {
97 int ttyinstop; 96 int ttyinstop;
98 int ttyoutstop; 97 int ttyoutstop;
99 struct sk_buff *ttyskb; 98 struct sk_buff *ttyskb;
100 atomic_t ttyopencount;
101 99
102 struct sk_buff_head inqueue; 100 struct sk_buff_head inqueue;
103 int inbytes; 101 int inbytes;
@@ -230,7 +228,6 @@ static struct capiminor *capiminor_alloc(struct capi20_appl *ap, u32 ncci)
230 mp->ap = ap; 228 mp->ap = ap;
231 mp->ncci = ncci; 229 mp->ncci = ncci;
232 mp->msgid = 0; 230 mp->msgid = 0;
233 atomic_set(&mp->ttyopencount,0);
234 INIT_LIST_HEAD(&mp->ackqueue); 231 INIT_LIST_HEAD(&mp->ackqueue);
235 spin_lock_init(&mp->ackqlock); 232 spin_lock_init(&mp->ackqlock);
236 233
@@ -350,8 +347,17 @@ static void capincci_free_minor(struct capincci *np)
350static inline unsigned int capincci_minor_opencount(struct capincci *np) 347static inline unsigned int capincci_minor_opencount(struct capincci *np)
351{ 348{
352 struct capiminor *mp = np->minorp; 349 struct capiminor *mp = np->minorp;
350 unsigned int count = 0;
351 struct tty_struct *tty;
353 352
354 return mp ? atomic_read(&mp->ttyopencount) : 0; 353 if (mp) {
354 tty = tty_port_tty_get(&mp->port);
355 if (tty) {
356 count = tty->count;
357 tty_kref_put(tty);
358 }
359 }
360 return count;
355} 361}
356 362
357#else /* !CONFIG_ISDN_CAPI_MIDDLEWARE */ 363#else /* !CONFIG_ISDN_CAPI_MIDDLEWARE */
@@ -1054,10 +1060,6 @@ static int capinc_tty_open(struct tty_struct *tty, struct file *filp)
1054 return err; 1060 return err;
1055 1061
1056 spin_lock_irqsave(&workaround_lock, flags); 1062 spin_lock_irqsave(&workaround_lock, flags);
1057 atomic_inc(&mp->ttyopencount);
1058#ifdef _DEBUG_REFCOUNT
1059 printk(KERN_DEBUG "capinc_tty_open ocount=%d\n", atomic_read(&mp->ttyopencount));
1060#endif
1061 handle_minor_recv(mp); 1063 handle_minor_recv(mp);
1062 spin_unlock_irqrestore(&workaround_lock, flags); 1064 spin_unlock_irqrestore(&workaround_lock, flags);
1063 return 0; 1065 return 0;
@@ -1067,18 +1069,6 @@ static void capinc_tty_close(struct tty_struct *tty, struct file *filp)
1067{ 1069{
1068 struct capiminor *mp = tty->driver_data; 1070 struct capiminor *mp = tty->driver_data;
1069 1071
1070 if (atomic_dec_and_test(&mp->ttyopencount)) {
1071#ifdef _DEBUG_REFCOUNT
1072 printk(KERN_DEBUG "capinc_tty_close lastclose\n");
1073#endif
1074 }
1075#ifdef _DEBUG_REFCOUNT
1076 printk(KERN_DEBUG "capinc_tty_close ocount=%d\n", atomic_read(&mp->ttyopencount));
1077#endif
1078
1079#ifdef _DEBUG_REFCOUNT
1080 printk(KERN_DEBUG "capinc_tty_close\n");
1081#endif
1082 tty_port_close(&mp->port, tty, filp); 1072 tty_port_close(&mp->port, tty, filp);
1083} 1073}
1084 1074