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
9d501551
Commit
9d501551
authored
Feb 26, 2004
by
Ben Collins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IEEE1394(r1167): Cleanup hostnum allocation to prevent race of double allocation.
parent
cd4f8d79
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
drivers/ieee1394/hosts.c
drivers/ieee1394/hosts.c
+7
-6
No files found.
drivers/ieee1394/hosts.c
View file @
9d501551
...
@@ -103,6 +103,7 @@ static int alloc_hostnum_cb(struct hpsb_host *host, void *__data)
...
@@ -103,6 +103,7 @@ static int alloc_hostnum_cb(struct hpsb_host *host, void *__data)
* Return Value: a pointer to the &hpsb_host if succesful, %NULL if
* Return Value: a pointer to the &hpsb_host if succesful, %NULL if
* no memory was available.
* no memory was available.
*/
*/
static
DECLARE_MUTEX
(
host_num_alloc
);
struct
hpsb_host
*
hpsb_alloc_host
(
struct
hpsb_host_driver
*
drv
,
size_t
extra
,
struct
hpsb_host
*
hpsb_alloc_host
(
struct
hpsb_host_driver
*
drv
,
size_t
extra
,
struct
device
*
dev
)
struct
device
*
dev
)
...
@@ -148,14 +149,12 @@ struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra,
...
@@ -148,14 +149,12 @@ struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra,
h
->
topology_map
=
h
->
csr
.
topology_map
+
3
;
h
->
topology_map
=
h
->
csr
.
topology_map
+
3
;
h
->
speed_map
=
(
u8
*
)(
h
->
csr
.
speed_map
+
2
);
h
->
speed_map
=
(
u8
*
)(
h
->
csr
.
speed_map
+
2
);
while
(
1
)
{
down
(
&
host_num_alloc
);
if
(
!
nodemgr_for_each_host
(
&
hostnum
,
alloc_hostnum_cb
))
{
h
->
id
=
hostnum
;
break
;
}
while
(
nodemgr_for_each_host
(
&
hostnum
,
alloc_hostnum_cb
))
hostnum
++
;
hostnum
++
;
}
h
->
id
=
hostnum
;
memcpy
(
&
h
->
device
,
&
nodemgr_dev_template_host
,
sizeof
(
h
->
device
));
memcpy
(
&
h
->
device
,
&
nodemgr_dev_template_host
,
sizeof
(
h
->
device
));
h
->
device
.
parent
=
dev
;
h
->
device
.
parent
=
dev
;
...
@@ -169,6 +168,8 @@ struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra,
...
@@ -169,6 +168,8 @@ struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra,
class_device_register
(
&
h
->
class_dev
);
class_device_register
(
&
h
->
class_dev
);
get_device
(
&
h
->
device
);
get_device
(
&
h
->
device
);
up
(
&
host_num_alloc
);
return
h
;
return
h
;
}
}
...
...
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