Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
43ec4349
Commit
43ec4349
authored
Jan 04, 2003
by
Kai Germaschewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ISDN/HiSax: Shared bc_open/close()
Another bunch of duplicated code is gone..
parent
d4c12f8b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
67 additions
and
202 deletions
+67
-202
drivers/isdn/hisax/avm_pci.c
drivers/isdn/hisax/avm_pci.c
+2
-40
drivers/isdn/hisax/hscx.c
drivers/isdn/hisax/hscx.c
+2
-37
drivers/isdn/hisax/ipacx.c
drivers/isdn/hisax/ipacx.c
+2
-41
drivers/isdn/hisax/isdnl1.h
drivers/isdn/hisax/isdnl1.h
+56
-1
drivers/isdn/hisax/jade.c
drivers/isdn/hisax/jade.c
+3
-42
drivers/isdn/hisax/w6692.c
drivers/isdn/hisax/w6692.c
+2
-41
No files found.
drivers/isdn/hisax/avm_pci.c
View file @
43ec4349
...
...
@@ -467,51 +467,13 @@ void
close_hdlcstate
(
struct
BCState
*
bcs
)
{
modehdlc
(
bcs
,
0
,
0
);
if
(
test_and_clear_bit
(
BC_FLG_INIT
,
&
bcs
->
Flag
))
{
if
(
bcs
->
rcvbuf
)
{
kfree
(
bcs
->
rcvbuf
);
bcs
->
rcvbuf
=
NULL
;
}
if
(
bcs
->
blog
)
{
kfree
(
bcs
->
blog
);
bcs
->
blog
=
NULL
;
}
skb_queue_purge
(
&
bcs
->
rqueue
);
skb_queue_purge
(
&
bcs
->
squeue
);
if
(
bcs
->
tx_skb
)
{
dev_kfree_skb_any
(
bcs
->
tx_skb
);
bcs
->
tx_skb
=
NULL
;
test_and_clear_bit
(
BC_FLG_BUSY
,
&
bcs
->
Flag
);
}
}
bc_close
(
bcs
);
}
int
open_hdlcstate
(
struct
IsdnCardState
*
cs
,
struct
BCState
*
bcs
)
{
if
(
!
test_and_set_bit
(
BC_FLG_INIT
,
&
bcs
->
Flag
))
{
if
(
!
(
bcs
->
rcvbuf
=
kmalloc
(
HSCX_BUFMAX
,
GFP_ATOMIC
)))
{
printk
(
KERN_WARNING
"HiSax: No memory for hdlc.rcvbuf
\n
"
);
return
(
1
);
}
if
(
!
(
bcs
->
blog
=
kmalloc
(
MAX_BLOG_SPACE
,
GFP_ATOMIC
)))
{
printk
(
KERN_WARNING
"HiSax: No memory for bcs->blog
\n
"
);
test_and_clear_bit
(
BC_FLG_INIT
,
&
bcs
->
Flag
);
kfree
(
bcs
->
rcvbuf
);
bcs
->
rcvbuf
=
NULL
;
return
(
2
);
}
skb_queue_head_init
(
&
bcs
->
rqueue
);
skb_queue_head_init
(
&
bcs
->
squeue
);
}
bcs
->
tx_skb
=
NULL
;
test_and_clear_bit
(
BC_FLG_BUSY
,
&
bcs
->
Flag
);
bcs
->
event
=
0
;
bcs
->
rcvidx
=
0
;
bcs
->
tx_cnt
=
0
;
return
(
0
);
return
bc_open
(
bcs
);
}
int
...
...
drivers/isdn/hisax/hscx.c
View file @
43ec4349
...
...
@@ -152,48 +152,13 @@ void
close_hscxstate
(
struct
BCState
*
bcs
)
{
modehscx
(
bcs
,
0
,
bcs
->
channel
);
if
(
test_and_clear_bit
(
BC_FLG_INIT
,
&
bcs
->
Flag
))
{
if
(
bcs
->
rcvbuf
)
{
kfree
(
bcs
->
rcvbuf
);
bcs
->
rcvbuf
=
NULL
;
}
if
(
bcs
->
blog
)
{
kfree
(
bcs
->
blog
);
bcs
->
blog
=
NULL
;
}
skb_queue_purge
(
&
bcs
->
rqueue
);
skb_queue_purge
(
&
bcs
->
squeue
);
skb_queue_purge
(
&
bcs
->
cmpl_queue
);
if
(
bcs
->
tx_skb
)
{
dev_kfree_skb_any
(
bcs
->
tx_skb
);
bcs
->
tx_skb
=
NULL
;
test_and_clear_bit
(
BC_FLG_BUSY
,
&
bcs
->
Flag
);
}
}
bc_close
(
bcs
);
}
int
open_hscxstate
(
struct
IsdnCardState
*
cs
,
struct
BCState
*
bcs
)
{
if
(
!
test_and_set_bit
(
BC_FLG_INIT
,
&
bcs
->
Flag
))
{
if
(
!
(
bcs
->
rcvbuf
=
kmalloc
(
HSCX_BUFMAX
,
GFP_ATOMIC
)))
{
printk
(
KERN_WARNING
"HiSax: No memory for hscx.rcvbuf
\n
"
);
test_and_clear_bit
(
BC_FLG_INIT
,
&
bcs
->
Flag
);
return
(
1
);
}
if
(
!
(
bcs
->
blog
=
kmalloc
(
MAX_BLOG_SPACE
,
GFP_ATOMIC
)))
{
printk
(
KERN_WARNING
"HiSax: No memory for bcs->blog
\n
"
);
test_and_clear_bit
(
BC_FLG_INIT
,
&
bcs
->
Flag
);
kfree
(
bcs
->
rcvbuf
);
bcs
->
rcvbuf
=
NULL
;
return
(
2
);
}
skb_queue_head_init
(
&
bcs
->
rqueue
);
skb_queue_head_init
(
&
bcs
->
squeue
);
skb_queue_head_init
(
&
bcs
->
cmpl_queue
);
}
bc_open
(
bcs
);
bcs
->
tx_skb
=
NULL
;
test_and_clear_bit
(
BC_FLG_BUSY
,
&
bcs
->
Flag
);
bcs
->
event
=
0
;
...
...
drivers/isdn/hisax/ipacx.c
View file @
43ec4349
...
...
@@ -644,23 +644,7 @@ static void
bch_close_state
(
struct
BCState
*
bcs
)
{
bch_mode
(
bcs
,
0
,
bcs
->
channel
);
if
(
test_and_clear_bit
(
BC_FLG_INIT
,
&
bcs
->
Flag
))
{
if
(
bcs
->
rcvbuf
)
{
kfree
(
bcs
->
rcvbuf
);
bcs
->
rcvbuf
=
NULL
;
}
if
(
bcs
->
blog
)
{
kfree
(
bcs
->
blog
);
bcs
->
blog
=
NULL
;
}
skb_queue_purge
(
&
bcs
->
rqueue
);
skb_queue_purge
(
&
bcs
->
squeue
);
if
(
bcs
->
tx_skb
)
{
dev_kfree_skb_any
(
bcs
->
tx_skb
);
bcs
->
tx_skb
=
NULL
;
clear_bit
(
BC_FLG_BUSY
,
&
bcs
->
Flag
);
}
}
bc_close
(
bcs
);
}
//----------------------------------------------------------
...
...
@@ -668,30 +652,7 @@ bch_close_state(struct BCState *bcs)
static
int
bch_open_state
(
struct
IsdnCardState
*
cs
,
struct
BCState
*
bcs
)
{
if
(
!
test_and_set_bit
(
BC_FLG_INIT
,
&
bcs
->
Flag
))
{
if
(
!
(
bcs
->
rcvbuf
=
kmalloc
(
HSCX_BUFMAX
,
GFP_ATOMIC
)))
{
printk
(
KERN_WARNING
"HiSax open_bchstate(): No memory for hscx.rcvbuf
\n
"
);
clear_bit
(
BC_FLG_INIT
,
&
bcs
->
Flag
);
return
(
1
);
}
if
(
!
(
bcs
->
blog
=
kmalloc
(
MAX_BLOG_SPACE
,
GFP_ATOMIC
)))
{
printk
(
KERN_WARNING
"HiSax open_bchstate: No memory for bcs->blog
\n
"
);
clear_bit
(
BC_FLG_INIT
,
&
bcs
->
Flag
);
kfree
(
bcs
->
rcvbuf
);
bcs
->
rcvbuf
=
NULL
;
return
(
2
);
}
skb_queue_head_init
(
&
bcs
->
rqueue
);
skb_queue_head_init
(
&
bcs
->
squeue
);
}
bcs
->
tx_skb
=
NULL
;
clear_bit
(
BC_FLG_BUSY
,
&
bcs
->
Flag
);
bcs
->
event
=
0
;
bcs
->
rcvidx
=
0
;
bcs
->
tx_cnt
=
0
;
return
(
0
);
return
bc_open
(
bcs
);
}
//----------------------------------------------------------
...
...
drivers/isdn/hisax/isdnl1.h
View file @
43ec4349
...
...
@@ -459,7 +459,7 @@ recv_rme_b(struct BCState *bcs)
skb
=
dev_alloc_skb
(
count
);
if
(
!
skb
)
{
printk
(
KERN_WARNING
"%s: out of memory
\n
"
,
__FUNCTION__
);
printk
(
KERN_WARNING
"
HiSax:
%s: out of memory
\n
"
,
__FUNCTION__
);
return
;
}
memcpy
(
skb_put
(
skb
,
count
),
bcs
->
rcvbuf
,
count
);
...
...
@@ -476,3 +476,58 @@ recv_rpf_b(struct BCState *bcs)
recv_rme_b
(
bcs
);
}
static
inline
int
bc_open
(
struct
BCState
*
bcs
)
{
if
(
test_and_set_bit
(
BC_FLG_INIT
,
&
bcs
->
Flag
))
return
0
;
bcs
->
rcvbuf
=
kmalloc
(
HSCX_BUFMAX
,
GFP_ATOMIC
);
if
(
!
bcs
->
rcvbuf
)
goto
err
;
bcs
->
blog
=
kmalloc
(
MAX_BLOG_SPACE
,
GFP_ATOMIC
);
if
(
!
bcs
->
blog
)
goto
err_rcvbuf
;
skb_queue_head_init
(
&
bcs
->
rqueue
);
skb_queue_head_init
(
&
bcs
->
squeue
);
skb_queue_head_init
(
&
bcs
->
cmpl_queue
);
clear_bit
(
BC_FLG_BUSY
,
&
bcs
->
Flag
);
bcs
->
tx_skb
=
NULL
;
bcs
->
rcvidx
=
0
;
bcs
->
tx_cnt
=
0
;
bcs
->
event
=
0
;
return
0
;
err_rcvbuf:
kfree
(
bcs
->
rcvbuf
);
err:
clear_bit
(
BC_FLG_INIT
,
&
bcs
->
Flag
);
printk
(
KERN_WARNING
"HiSax: %s: out of memory
\n
"
,
__FUNCTION__
);
return
-
ENOMEM
;;
}
static
inline
void
bc_close
(
struct
BCState
*
bcs
)
{
if
(
!
test_and_clear_bit
(
BC_FLG_INIT
,
&
bcs
->
Flag
))
return
;
kfree
(
bcs
->
rcvbuf
);
bcs
->
rcvbuf
=
NULL
;
kfree
(
bcs
->
blog
);
bcs
->
blog
=
NULL
;
skb_queue_purge
(
&
bcs
->
rqueue
);
skb_queue_purge
(
&
bcs
->
squeue
);
skb_queue_purge
(
&
bcs
->
cmpl_queue
);
if
(
bcs
->
tx_skb
)
{
dev_kfree_skb_any
(
bcs
->
tx_skb
);
bcs
->
tx_skb
=
NULL
;
clear_bit
(
BC_FLG_BUSY
,
&
bcs
->
Flag
);
}
}
drivers/isdn/hisax/jade.c
View file @
43ec4349
...
...
@@ -189,53 +189,14 @@ jade_l2l1(struct PStack *st, int pr, void *arg)
void
close_jadestate
(
struct
BCState
*
bcs
)
{
modejade
(
bcs
,
0
,
bcs
->
channel
);
if
(
test_and_clear_bit
(
BC_FLG_INIT
,
&
bcs
->
Flag
))
{
if
(
bcs
->
rcvbuf
)
{
kfree
(
bcs
->
rcvbuf
);
bcs
->
rcvbuf
=
NULL
;
}
if
(
bcs
->
blog
)
{
kfree
(
bcs
->
blog
);
bcs
->
blog
=
NULL
;
}
skb_queue_purge
(
&
bcs
->
rqueue
);
skb_queue_purge
(
&
bcs
->
squeue
);
if
(
bcs
->
tx_skb
)
{
dev_kfree_skb_any
(
bcs
->
tx_skb
);
bcs
->
tx_skb
=
NULL
;
test_and_clear_bit
(
BC_FLG_BUSY
,
&
bcs
->
Flag
);
}
}
modejade
(
bcs
,
0
,
bcs
->
channel
);
bc_close
(
bcs
);
}
static
int
open_jadestate
(
struct
IsdnCardState
*
cs
,
struct
BCState
*
bcs
)
{
if
(
!
test_and_set_bit
(
BC_FLG_INIT
,
&
bcs
->
Flag
))
{
if
(
!
(
bcs
->
rcvbuf
=
kmalloc
(
HSCX_BUFMAX
,
GFP_ATOMIC
)))
{
printk
(
KERN_WARNING
"HiSax: No memory for hscx.rcvbuf
\n
"
);
test_and_clear_bit
(
BC_FLG_INIT
,
&
bcs
->
Flag
);
return
(
1
);
}
if
(
!
(
bcs
->
blog
=
kmalloc
(
MAX_BLOG_SPACE
,
GFP_ATOMIC
)))
{
printk
(
KERN_WARNING
"HiSax: No memory for bcs->blog
\n
"
);
test_and_clear_bit
(
BC_FLG_INIT
,
&
bcs
->
Flag
);
kfree
(
bcs
->
rcvbuf
);
bcs
->
rcvbuf
=
NULL
;
return
(
2
);
}
skb_queue_head_init
(
&
bcs
->
rqueue
);
skb_queue_head_init
(
&
bcs
->
squeue
);
}
bcs
->
tx_skb
=
NULL
;
test_and_clear_bit
(
BC_FLG_BUSY
,
&
bcs
->
Flag
);
bcs
->
event
=
0
;
bcs
->
rcvidx
=
0
;
bcs
->
tx_cnt
=
0
;
return
(
0
);
return
bc_open
(
bcs
);;
}
...
...
drivers/isdn/hisax/w6692.c
View file @
43ec4349
...
...
@@ -598,52 +598,13 @@ static void
close_w6692state
(
struct
BCState
*
bcs
)
{
W6692Bmode
(
bcs
,
0
,
bcs
->
channel
);
if
(
test_and_clear_bit
(
BC_FLG_INIT
,
&
bcs
->
Flag
))
{
if
(
bcs
->
rcvbuf
)
{
kfree
(
bcs
->
rcvbuf
);
bcs
->
rcvbuf
=
NULL
;
}
if
(
bcs
->
blog
)
{
kfree
(
bcs
->
blog
);
bcs
->
blog
=
NULL
;
}
skb_queue_purge
(
&
bcs
->
rqueue
);
skb_queue_purge
(
&
bcs
->
squeue
);
if
(
bcs
->
tx_skb
)
{
dev_kfree_skb_any
(
bcs
->
tx_skb
);
bcs
->
tx_skb
=
NULL
;
test_and_clear_bit
(
BC_FLG_BUSY
,
&
bcs
->
Flag
);
}
}
bc_close
(
bcs
);
}
static
int
open_w6692state
(
struct
IsdnCardState
*
cs
,
struct
BCState
*
bcs
)
{
if
(
!
test_and_set_bit
(
BC_FLG_INIT
,
&
bcs
->
Flag
))
{
if
(
!
(
bcs
->
rcvbuf
=
kmalloc
(
HSCX_BUFMAX
,
GFP_ATOMIC
)))
{
printk
(
KERN_WARNING
"HiSax: No memory for w6692.rcvbuf
\n
"
);
test_and_clear_bit
(
BC_FLG_INIT
,
&
bcs
->
Flag
);
return
(
1
);
}
if
(
!
(
bcs
->
blog
=
kmalloc
(
MAX_BLOG_SPACE
,
GFP_ATOMIC
)))
{
printk
(
KERN_WARNING
"HiSax: No memory for bcs->blog
\n
"
);
test_and_clear_bit
(
BC_FLG_INIT
,
&
bcs
->
Flag
);
kfree
(
bcs
->
rcvbuf
);
bcs
->
rcvbuf
=
NULL
;
return
(
2
);
}
skb_queue_head_init
(
&
bcs
->
rqueue
);
skb_queue_head_init
(
&
bcs
->
squeue
);
}
bcs
->
tx_skb
=
NULL
;
test_and_clear_bit
(
BC_FLG_BUSY
,
&
bcs
->
Flag
);
bcs
->
event
=
0
;
bcs
->
rcvidx
=
0
;
bcs
->
tx_cnt
=
0
;
return
(
0
);
return
bc_open
(
bcs
);
}
static
int
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment