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
Kirill Smelkov
linux
Commits
e991a288
Commit
e991a288
authored
Aug 02, 2002
by
Kai Germaschewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ISDN: Use a list.h list for the global list of ISDN net devices
parent
83c5d21c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
66 deletions
+61
-66
drivers/isdn/i4l/isdn_common.c
drivers/isdn/i4l/isdn_common.c
+4
-2
drivers/isdn/i4l/isdn_common.h
drivers/isdn/i4l/isdn_common.h
+2
-0
drivers/isdn/i4l/isdn_net.c
drivers/isdn/i4l/isdn_net.c
+50
-60
drivers/isdn/i4l/isdn_ppp.c
drivers/isdn/i4l/isdn_ppp.c
+5
-4
No files found.
drivers/isdn/i4l/isdn_common.c
View file @
e991a288
...
@@ -433,7 +433,7 @@ isdn_status_callback(isdn_ctrl * c)
...
@@ -433,7 +433,7 @@ isdn_status_callback(isdn_ctrl * c)
int
r
;
int
r
;
int
retval
=
0
;
int
retval
=
0
;
isdn_ctrl
cmd
;
isdn_ctrl
cmd
;
isdn_net_dev
*
p
;
struct
list_head
*
l
;
di
=
c
->
driver
;
di
=
c
->
driver
;
i
=
isdn_dc2minor
(
di
,
c
->
arg
);
i
=
isdn_dc2minor
(
di
,
c
->
arg
);
...
@@ -509,13 +509,15 @@ isdn_status_callback(isdn_ctrl * c)
...
@@ -509,13 +509,15 @@ isdn_status_callback(isdn_ctrl * c)
case
1
:
case
1
:
/* Schedule connection-setup */
/* Schedule connection-setup */
isdn_net_dial
();
isdn_net_dial
();
for
(
p
=
dev
->
netdev
;
p
;
p
=
p
->
next
)
list_for_each
(
l
,
&
isdn_net_devs
)
{
isdn_net_dev
*
p
=
list_entry
(
l
,
isdn_net_dev
,
global_list
);
if
(
p
->
local
.
isdn_slot
==
isdn_dc2minor
(
di
,
cmd
.
arg
))
{
if
(
p
->
local
.
isdn_slot
==
isdn_dc2minor
(
di
,
cmd
.
arg
))
{
strcpy
(
cmd
.
parm
.
setup
.
eazmsn
,
p
->
local
.
msn
);
strcpy
(
cmd
.
parm
.
setup
.
eazmsn
,
p
->
local
.
msn
);
isdn_slot_command
(
p
->
local
.
isdn_slot
,
ISDN_CMD_ACCEPTD
,
&
cmd
);
isdn_slot_command
(
p
->
local
.
isdn_slot
,
ISDN_CMD_ACCEPTD
,
&
cmd
);
retval
=
1
;
retval
=
1
;
break
;
break
;
}
}
}
break
;
break
;
case
2
:
/* For calling back, first reject incoming call ... */
case
2
:
/* For calling back, first reject incoming call ... */
...
...
drivers/isdn/i4l/isdn_common.h
View file @
e991a288
...
@@ -70,6 +70,8 @@ struct dial_info {
...
@@ -70,6 +70,8 @@ struct dial_info {
unsigned
char
*
phone
;
unsigned
char
*
phone
;
};
};
extern
struct
list_head
isdn_net_devs
;
extern
int
isdn_get_free_slot
(
int
,
int
,
int
,
int
,
int
,
char
*
);
extern
int
isdn_get_free_slot
(
int
,
int
,
int
,
int
,
int
,
char
*
);
extern
void
isdn_slot_free
(
int
slot
,
int
usage
);
extern
void
isdn_slot_free
(
int
slot
,
int
usage
);
extern
void
isdn_slot_all_eaz
(
int
slot
);
extern
void
isdn_slot_all_eaz
(
int
slot
);
...
...
drivers/isdn/i4l/isdn_net.c
View file @
e991a288
...
@@ -59,6 +59,8 @@ enum {
...
@@ -59,6 +59,8 @@ enum {
EV_NET_DIAL
=
0x200
,
EV_NET_DIAL
=
0x200
,
};
};
LIST_HEAD
(
isdn_net_devs
);
/* Linked list of isdn_net_dev's */
/*
/*
* Outline of new tbusy handling:
* Outline of new tbusy handling:
*
*
...
@@ -355,11 +357,12 @@ unsigned long last_jiffies = -HZ;
...
@@ -355,11 +357,12 @@ unsigned long last_jiffies = -HZ;
void
void
isdn_net_autohup
()
isdn_net_autohup
()
{
{
isdn_net_dev
*
p
=
dev
->
netdev
;
struct
list_head
*
l
;
int
anymore
;
int
anymore
;
anymore
=
0
;
anymore
=
0
;
while
(
p
)
{
list_for_each
(
l
,
&
isdn_net_devs
)
{
isdn_net_dev
*
p
=
list_entry
(
l
,
isdn_net_dev
,
global_list
);
isdn_net_local
*
l
=
&
p
->
local
;
isdn_net_local
*
l
=
&
p
->
local
;
if
(
jiffies
==
last_jiffies
)
if
(
jiffies
==
last_jiffies
)
l
->
cps
=
l
->
transcount
;
l
->
cps
=
l
->
transcount
;
...
@@ -407,7 +410,6 @@ isdn_net_autohup()
...
@@ -407,7 +410,6 @@ isdn_net_autohup()
break
;
break
;
}
}
}
}
p
=
(
isdn_net_dev
*
)
p
->
next
;
}
}
last_jiffies
=
jiffies
;
last_jiffies
=
jiffies
;
isdn_timer_ctrl
(
ISDN_TIMER_NETHANGUP
,
anymore
);
isdn_timer_ctrl
(
ISDN_TIMER_NETHANGUP
,
anymore
);
...
@@ -879,9 +881,10 @@ void
...
@@ -879,9 +881,10 @@ void
isdn_net_dial
(
void
)
isdn_net_dial
(
void
)
{
{
int
anymore
=
0
;
int
anymore
=
0
;
isdn_net_dev
*
p
=
dev
->
netdev
;
struct
list_head
*
l
;
for
(
p
=
dev
->
netdev
;
p
;
p
=
p
->
next
)
{
list_for_each
(
l
,
&
isdn_net_devs
)
{
isdn_net_dev
*
p
=
list_entry
(
l
,
isdn_net_dev
,
global_list
);
isdn_net_local
*
lp
=
&
p
->
local
;
isdn_net_local
*
lp
=
&
p
->
local
;
if
(
lp
->
dialstate
==
ST_0
)
if
(
lp
->
dialstate
==
ST_0
)
...
@@ -2129,12 +2132,14 @@ isdn_net_init(struct net_device *ndev)
...
@@ -2129,12 +2132,14 @@ isdn_net_init(struct net_device *ndev)
static
void
static
void
isdn_net_swapbind
(
int
drvidx
)
isdn_net_swapbind
(
int
drvidx
)
{
{
isdn_net_dev
*
p
;
struct
list_head
*
l
;
dbg_net_icall
(
"n_fi: swapping ch of %d
\n
"
,
drvidx
);
dbg_net_icall
(
"n_fi: swapping ch of %d
\n
"
,
drvidx
);
p
=
dev
->
netdev
;
list_for_each
(
l
,
&
isdn_net_devs
)
{
while
(
p
)
{
isdn_net_dev
*
p
=
list_entry
(
l
,
isdn_net_dev
,
global_list
);
if
(
p
->
local
.
pre_device
==
drvidx
)
if
(
p
->
local
.
pre_device
!=
drvidx
)
continue
;
switch
(
p
->
local
.
pre_channel
)
{
switch
(
p
->
local
.
pre_channel
)
{
case
0
:
case
0
:
p
->
local
.
pre_channel
=
1
;
p
->
local
.
pre_channel
=
1
;
...
@@ -2143,7 +2148,6 @@ isdn_net_swapbind(int drvidx)
...
@@ -2143,7 +2148,6 @@ isdn_net_swapbind(int drvidx)
p
->
local
.
pre_channel
=
0
;
p
->
local
.
pre_channel
=
0
;
break
;
break
;
}
}
p
=
(
isdn_net_dev
*
)
p
->
next
;
}
}
}
}
...
@@ -2184,7 +2188,7 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
...
@@ -2184,7 +2188,7 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
int
wret
;
int
wret
;
int
swapped
;
int
swapped
;
int
sidx
=
0
;
int
sidx
=
0
;
isdn_net_dev
*
p
;
struct
list_head
*
l
;
isdn_net_phone
*
n
;
isdn_net_phone
*
n
;
ulong
flags
;
ulong
flags
;
char
nr
[
32
];
char
nr
[
32
];
...
@@ -2218,13 +2222,14 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
...
@@ -2218,13 +2222,14 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
return
0
;
return
0
;
}
}
n
=
(
isdn_net_phone
*
)
0
;
n
=
(
isdn_net_phone
*
)
0
;
p
=
dev
->
netdev
;
ematch
=
wret
=
swapped
=
0
;
ematch
=
wret
=
swapped
=
0
;
dbg_net_icall
(
"n_fi: di=%d ch=%d idx=%d usg=%d
\n
"
,
di
,
ch
,
idx
,
dbg_net_icall
(
"n_fi: di=%d ch=%d idx=%d usg=%d
\n
"
,
di
,
ch
,
idx
,
dev
->
usage
[
idx
]);
dev
->
usage
[
idx
]);
while
(
p
)
{
list_for_each
(
l
,
&
isdn_net_devs
)
{
int
matchret
;
int
matchret
;
isdn_net_dev
*
p
=
list_entry
(
l
,
isdn_net_dev
,
global_list
);
isdn_net_local
*
lp
=
&
p
->
local
;
isdn_net_local
*
lp
=
&
p
->
local
;
/* If last check has triggered as binding-swap, revert it */
/* If last check has triggered as binding-swap, revert it */
...
@@ -2298,7 +2303,6 @@ p = dev->netdev;
...
@@ -2298,7 +2303,6 @@ p = dev->netdev;
swapped
=
1
;
swapped
=
1
;
}
else
{
}
else
{
/* ... else iterate next device */
/* ... else iterate next device */
p
=
(
isdn_net_dev
*
)
p
->
next
;
continue
;
continue
;
}
}
}
else
{
}
else
{
...
@@ -2314,7 +2318,6 @@ p = dev->netdev;
...
@@ -2314,7 +2318,6 @@ p = dev->netdev;
((
lp
->
pre_channel
!=
ch
)
||
((
lp
->
pre_channel
!=
ch
)
||
(
lp
->
pre_device
!=
di
)))
{
(
lp
->
pre_device
!=
di
)))
{
dbg_net_icall
(
"n_fi: final check failed
\n
"
);
dbg_net_icall
(
"n_fi: final check failed
\n
"
);
p
=
(
isdn_net_dev
*
)
p
->
next
;
continue
;
continue
;
}
}
}
}
...
@@ -2378,7 +2381,6 @@ p = dev->netdev;
...
@@ -2378,7 +2381,6 @@ p = dev->netdev;
/* Found parent, if it's offline iterate next device */
/* Found parent, if it's offline iterate next device */
printk
(
KERN_DEBUG
"mlpf: %d
\n
"
,
mlp
->
flags
&
ISDN_NET_CONNECTED
);
printk
(
KERN_DEBUG
"mlpf: %d
\n
"
,
mlp
->
flags
&
ISDN_NET_CONNECTED
);
if
(
!
(
mlp
->
flags
&
ISDN_NET_CONNECTED
))
{
if
(
!
(
mlp
->
flags
&
ISDN_NET_CONNECTED
))
{
p
=
(
isdn_net_dev
*
)
p
->
next
;
continue
;
continue
;
}
}
}
}
...
@@ -2472,7 +2474,6 @@ p = dev->netdev;
...
@@ -2472,7 +2474,6 @@ p = dev->netdev;
}
}
}
}
}
}
p
=
(
isdn_net_dev
*
)
p
->
next
;
}
}
/* If none of configured EAZ/MSN matched and not verbose, be silent */
/* If none of configured EAZ/MSN matched and not verbose, be silent */
if
(
!
ematch
||
dev
->
net_verbose
)
if
(
!
ematch
||
dev
->
net_verbose
)
...
@@ -2487,14 +2488,14 @@ p = dev->netdev;
...
@@ -2487,14 +2488,14 @@ p = dev->netdev;
isdn_net_dev
*
isdn_net_dev
*
isdn_net_findif
(
char
*
name
)
isdn_net_findif
(
char
*
name
)
{
{
isdn_net_dev
*
p
=
dev
->
netdev
;
struct
list_head
*
l
;
while
(
p
)
{
list_for_each
(
l
,
&
isdn_net_devs
)
{
isdn_net_dev
*
p
=
list_entry
(
l
,
isdn_net_dev
,
global_list
);
if
(
!
strcmp
(
p
->
local
.
name
,
name
))
if
(
!
strcmp
(
p
->
local
.
name
,
name
))
return
p
;
return
p
;
p
=
(
isdn_net_dev
*
)
p
->
next
;
}
}
return
(
isdn_net_dev
*
)
NULL
;
return
NULL
;
}
}
/*
/*
...
@@ -2663,8 +2664,7 @@ isdn_net_new(char *name, struct net_device *master)
...
@@ -2663,8 +2664,7 @@ isdn_net_new(char *name, struct net_device *master)
netdev
->
local
.
dialwait_timer
=
0
;
/* Jiffies of earliest next dial-start */
netdev
->
local
.
dialwait_timer
=
0
;
/* Jiffies of earliest next dial-start */
/* Put into to netdev-chain */
/* Put into to netdev-chain */
netdev
->
next
=
dev
->
netdev
;
list_add
(
&
netdev
->
global_list
,
&
isdn_net_devs
);
dev
->
netdev
=
netdev
;
return
netdev
->
dev
.
name
;
return
netdev
->
dev
.
name
;
}
}
...
@@ -3158,7 +3158,7 @@ isdn_net_force_hangup(char *name)
...
@@ -3158,7 +3158,7 @@ isdn_net_force_hangup(char *name)
* Helper-function for isdn_net_rm: Do the real work.
* Helper-function for isdn_net_rm: Do the real work.
*/
*/
static
int
static
int
isdn_net_realrm
(
isdn_net_dev
*
p
,
isdn_net_dev
*
q
)
isdn_net_realrm
(
isdn_net_dev
*
p
)
{
{
unsigned
long
flags
;
unsigned
long
flags
;
...
@@ -3188,26 +3188,22 @@ isdn_net_realrm(isdn_net_dev * p, isdn_net_dev * q)
...
@@ -3188,26 +3188,22 @@ isdn_net_realrm(isdn_net_dev * p, isdn_net_dev * q)
unregister_netdev
(
&
p
->
dev
);
unregister_netdev
(
&
p
->
dev
);
}
}
/* Unlink device from chain */
/* Unlink device from chain */
if
(
q
)
list_del
(
&
p
->
global_list
);
q
->
next
=
p
->
next
;
else
dev
->
netdev
=
p
->
next
;
if
(
p
->
local
.
slave
)
{
if
(
p
->
local
.
slave
)
{
/* If this interface has a slave, remove it also */
/* If this interface has a slave, remove it also */
char
*
slavename
=
((
isdn_net_local
*
)
(
p
->
local
.
slave
->
priv
))
->
name
;
char
*
slavename
=
((
isdn_net_local
*
)
(
p
->
local
.
slave
->
priv
))
->
name
;
isdn_net_dev
*
n
=
dev
->
netdev
;
struct
list_head
*
l
;
q
=
NULL
;
while
(
n
)
{
list_for_each
(
l
,
&
isdn_net_devs
)
{
isdn_net_dev
*
n
=
list_entry
(
l
,
isdn_net_dev
,
global_list
);
if
(
!
strcmp
(
n
->
local
.
name
,
slavename
))
{
if
(
!
strcmp
(
n
->
local
.
name
,
slavename
))
{
isdn_net_realrm
(
n
,
q
);
isdn_net_realrm
(
n
);
break
;
break
;
}
}
q
=
n
;
n
=
(
isdn_net_dev
*
)
n
->
next
;
}
}
}
}
/* If no more net-devices remain, disable auto-hangup timer */
/* If no more net-devices remain, disable auto-hangup timer */
if
(
dev
->
netdev
==
NULL
)
if
(
list_empty
(
&
isdn_net_devs
)
)
isdn_timer_ctrl
(
ISDN_TIMER_NETHANGUP
,
0
);
isdn_timer_ctrl
(
ISDN_TIMER_NETHANGUP
,
0
);
restore_flags
(
flags
);
restore_flags
(
flags
);
kfree
(
p
);
kfree
(
p
);
...
@@ -3221,21 +3217,14 @@ isdn_net_realrm(isdn_net_dev * p, isdn_net_dev * q)
...
@@ -3221,21 +3217,14 @@ isdn_net_realrm(isdn_net_dev * p, isdn_net_dev * q)
int
int
isdn_net_rm
(
char
*
name
)
isdn_net_rm
(
char
*
name
)
{
{
isdn_net_dev
*
p
;
struct
list_head
*
l
;
isdn_net_dev
*
q
;
/* Search name in netdev-chain */
/* Search name in netdev-chain */
p
=
dev
->
netdev
;
list_for_each
(
l
,
&
isdn_net_devs
)
{
q
=
NULL
;
isdn_net_dev
*
p
=
list_entry
(
l
,
isdn_net_dev
,
global_list
);
while
(
p
)
{
if
(
!
strcmp
(
p
->
local
.
name
,
name
))
if
(
!
strcmp
(
p
->
local
.
name
,
name
))
return
(
isdn_net_realrm
(
p
,
q
));
return
isdn_net_realrm
(
p
);
q
=
p
;
p
=
(
isdn_net_dev
*
)
p
->
next
;
}
}
/* If no more net-devices remain, disable auto-hangup timer */
if
(
dev
->
netdev
==
NULL
)
isdn_timer_ctrl
(
ISDN_TIMER_NETHANGUP
,
0
);
return
-
ENODEV
;
return
-
ENODEV
;
}
}
...
@@ -3251,16 +3240,17 @@ isdn_net_rmall(void)
...
@@ -3251,16 +3240,17 @@ isdn_net_rmall(void)
/* Walk through netdev-chain */
/* Walk through netdev-chain */
save_flags
(
flags
);
save_flags
(
flags
);
cli
();
cli
();
while
(
dev
->
netdev
)
{
while
(
!
list_empty
(
&
isdn_net_devs
))
{
if
(
!
dev
->
netdev
->
local
.
master
)
{
isdn_net_dev
*
p
=
list_entry
(
isdn_net_devs
.
next
,
isdn_net_dev
,
global_list
);
/* Remove master-devices only, slaves get removed with their master */
/* Remove master-devices only, slaves get removed with their master */
if
((
ret
=
isdn_net_realrm
(
dev
->
netdev
,
NULL
)))
{
if
(
!
p
->
local
.
master
)
{
if
((
ret
=
isdn_net_realrm
(
p
)))
{
restore_flags
(
flags
);
restore_flags
(
flags
);
return
ret
;
return
ret
;
}
}
}
}
}
}
dev
->
netdev
=
NULL
;
restore_flags
(
flags
);
restore_flags
(
flags
);
return
0
;
return
0
;
}
}
drivers/isdn/i4l/isdn_ppp.c
View file @
e991a288
...
@@ -165,14 +165,15 @@ isdn_ppp_bind(isdn_net_local * lp)
...
@@ -165,14 +165,15 @@ isdn_ppp_bind(isdn_net_local * lp)
save_flags
(
flags
);
save_flags
(
flags
);
cli
();
cli
();
if
(
lp
->
pppbind
<
0
)
{
/* device bounded to ippp device ? */
if
(
lp
->
pppbind
<
0
)
{
/* device bounded to ippp device ? */
isdn_net_dev
*
net_dev
=
dev
->
netdev
;
struct
list_head
*
l
;
char
exclusive
[
ISDN_MAX_CHANNELS
];
/* exclusive flags */
char
exclusive
[
ISDN_MAX_CHANNELS
];
/* exclusive flags */
memset
(
exclusive
,
0
,
ISDN_MAX_CHANNELS
);
memset
(
exclusive
,
0
,
ISDN_MAX_CHANNELS
);
while
(
net_dev
)
{
/* step through net devices to find exclusive minors */
/* step through net devices to find exclusive minors */
isdn_net_local
*
lp
=
&
net_dev
->
local
;
list_for_each
(
l
,
&
isdn_net_devs
)
{
isdn_net_dev
*
p
=
list_entry
(
l
,
isdn_net_dev
,
global_list
);
isdn_net_local
*
lp
=
&
p
->
local
;
if
(
lp
->
pppbind
>=
0
)
if
(
lp
->
pppbind
>=
0
)
exclusive
[
lp
->
pppbind
]
=
1
;
exclusive
[
lp
->
pppbind
]
=
1
;
net_dev
=
net_dev
->
next
;
}
}
/*
/*
* search a free device / slot
* search a free device / slot
...
...
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