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
66f2e3e1
Commit
66f2e3e1
authored
Jul 27, 2002
by
Ralf Bächle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Protect linkfail_list with a spinlock instead of the previous cli / sti mess.
parent
3a62a477
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
15 deletions
+15
-15
net/ax25/TODO
net/ax25/TODO
+3
-2
net/ax25/ax25_iface.c
net/ax25/ax25_iface.c
+12
-13
No files found.
net/ax25/TODO
View file @
66f2e3e1
...
...
@@ -10,6 +10,7 @@ af_ax25.c:ax25_connect:
}
Do the spinlocks ax25_list_lock, ax25_uid_lock, ax25_route_lock,
protocol_list_lock and ax25_dev_lock really have to be interrupt safe?
protocol_list_lock, ax25_dev_lock and linkfail_lockreally have to be interrupt
safe?
What locking will be needed for li
nkfail_list and li
sten_list?
What locking will be needed for listen_list?
net/ax25/ax25_iface.c
View file @
66f2e3e1
...
...
@@ -47,6 +47,7 @@ static struct linkfail_struct {
struct
linkfail_struct
*
next
;
void
(
*
func
)(
ax25_cb
*
,
int
);
}
*
linkfail_list
;
static
spinlock_t
linkfail_lock
=
SPIN_LOCK_UNLOCKED
;
static
struct
listen_struct
{
struct
listen_struct
*
next
;
...
...
@@ -122,31 +123,27 @@ int ax25_linkfail_register(void (*func)(ax25_cb *, int))
linkfail
->
func
=
func
;
save_flags
(
flags
);
cli
();
spin_lock_irqsave
(
&
linkfail_lock
,
flags
);
linkfail
->
next
=
linkfail_list
;
linkfail_list
=
linkfail
;
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
linkfail_lock
,
flags
);
return
1
;
}
void
ax25_linkfail_release
(
void
(
*
func
)(
ax25_cb
*
,
int
))
{
struct
linkfail_struct
*
s
,
*
linkfail
=
linkfail_list
;
struct
linkfail_struct
*
s
,
*
linkfail
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
linkfail_lock
,
flags
);
linkfail
=
linkfail_list
;
if
(
linkfail
==
NULL
)
return
;
save_flags
(
flags
);
cli
();
if
(
linkfail
->
func
==
func
)
{
linkfail_list
=
linkfail
->
next
;
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
linkfail_lock
,
flags
);
kfree
(
linkfail
);
return
;
}
...
...
@@ -155,15 +152,14 @@ void ax25_linkfail_release(void (*func)(ax25_cb *, int))
if
(
linkfail
->
next
->
func
==
func
)
{
s
=
linkfail
->
next
;
linkfail
->
next
=
linkfail
->
next
->
next
;
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
linkfail_lock
,
flags
);
kfree
(
s
);
return
;
}
linkfail
=
linkfail
->
next
;
}
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
linkfail_lock
,
flags
);
}
int
ax25_listen_register
(
ax25_address
*
callsign
,
struct
net_device
*
dev
)
...
...
@@ -255,9 +251,12 @@ int ax25_listen_mine(ax25_address *callsign, struct net_device *dev)
void
ax25_link_failed
(
ax25_cb
*
ax25
,
int
reason
)
{
struct
linkfail_struct
*
linkfail
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
linkfail_lock
,
flags
);
for
(
linkfail
=
linkfail_list
;
linkfail
!=
NULL
;
linkfail
=
linkfail
->
next
)
(
linkfail
->
func
)(
ax25
,
reason
);
spin_unlock_irqrestore
(
&
linkfail_lock
,
flags
);
}
int
ax25_protocol_is_registered
(
unsigned
int
pid
)
...
...
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