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
bb672f57
Commit
bb672f57
authored
Jul 29, 2003
by
Oliver Neukum
Committed by
Greg Kroah-Hartman
Jul 29, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] USB: cleanup of usblp (release and poll)
this cleans up locking and freeing in usblp_release and poll.
parent
f3f7317f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
6 deletions
+4
-6
drivers/usb/class/usblp.c
drivers/usb/class/usblp.c
+4
-6
No files found.
drivers/usb/class/usblp.c
View file @
bb672f57
...
@@ -383,7 +383,7 @@ static void usblp_cleanup (struct usblp *usblp)
...
@@ -383,7 +383,7 @@ static void usblp_cleanup (struct usblp *usblp)
usb_buffer_free
(
usblp
->
dev
,
USBLP_BUF_SIZE
,
usb_buffer_free
(
usblp
->
dev
,
USBLP_BUF_SIZE
,
usblp
->
writebuf
,
usblp
->
writeurb
->
transfer_dma
);
usblp
->
writebuf
,
usblp
->
writeurb
->
transfer_dma
);
usb_buffer_free
(
usblp
->
dev
,
USBLP_BUF_SIZE
,
usb_buffer_free
(
usblp
->
dev
,
USBLP_BUF_SIZE
,
usblp
->
readbuf
,
usblp
->
write
urb
->
transfer_dma
);
usblp
->
readbuf
,
usblp
->
read
urb
->
transfer_dma
);
kfree
(
usblp
->
device_id_string
);
kfree
(
usblp
->
device_id_string
);
kfree
(
usblp
->
statusbuf
);
kfree
(
usblp
->
statusbuf
);
usb_free_urb
(
usblp
->
writeurb
);
usb_free_urb
(
usblp
->
writeurb
);
...
@@ -403,14 +403,12 @@ static int usblp_release(struct inode *inode, struct file *file)
...
@@ -403,14 +403,12 @@ static int usblp_release(struct inode *inode, struct file *file)
struct
usblp
*
usblp
=
file
->
private_data
;
struct
usblp
*
usblp
=
file
->
private_data
;
down
(
&
usblp
->
sem
);
down
(
&
usblp
->
sem
);
lock_kernel
();
usblp
->
used
=
0
;
usblp
->
used
=
0
;
if
(
usblp
->
present
)
{
if
(
usblp
->
present
)
{
usblp_unlink_urbs
(
usblp
);
usblp_unlink_urbs
(
usblp
);
up
(
&
usblp
->
sem
);
up
(
&
usblp
->
sem
);
}
else
/* finish cleanup from disconnect */
}
else
/* finish cleanup from disconnect */
usblp_cleanup
(
usblp
);
usblp_cleanup
(
usblp
);
unlock_kernel
();
return
0
;
return
0
;
}
}
...
@@ -419,8 +417,8 @@ static unsigned int usblp_poll(struct file *file, struct poll_table_struct *wait
...
@@ -419,8 +417,8 @@ static unsigned int usblp_poll(struct file *file, struct poll_table_struct *wait
{
{
struct
usblp
*
usblp
=
file
->
private_data
;
struct
usblp
*
usblp
=
file
->
private_data
;
poll_wait
(
file
,
&
usblp
->
wait
,
wait
);
poll_wait
(
file
,
&
usblp
->
wait
,
wait
);
return
((
!
usblp
->
bidir
||
usblp
->
readurb
->
status
==
-
EINPROGRESS
)
?
0
:
POLLIN
|
POLLRDNORM
)
return
((
!
usblp
->
bidir
||
!
usblp
->
rcomplete
)
?
0
:
POLLIN
|
POLLRDNORM
)
|
(
usblp
->
writeurb
->
status
==
-
EINPROGRESS
?
0
:
POLLOUT
|
POLLWRNORM
);
|
(
!
usblp
->
wcomplete
?
0
:
POLLOUT
|
POLLWRNORM
);
}
}
static
int
usblp_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
static
int
usblp_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
...
@@ -738,7 +736,7 @@ static ssize_t usblp_read(struct file *file, char __user *buffer, size_t count,
...
@@ -738,7 +736,7 @@ static ssize_t usblp_read(struct file *file, char __user *buffer, size_t count,
usblp
->
readurb
->
dev
=
usblp
->
dev
;
usblp
->
readurb
->
dev
=
usblp
->
dev
;
usblp
->
readcount
=
0
;
usblp
->
readcount
=
0
;
if
(
usb_submit_urb
(
usblp
->
readurb
,
GFP_KERNEL
)
<
0
)
if
(
usb_submit_urb
(
usblp
->
readurb
,
GFP_KERNEL
)
<
0
)
dbg
(
"error submitting urb"
);
dbg
(
"error submitting urb"
);
count
=
-
EIO
;
count
=
-
EIO
;
goto
done
;
goto
done
;
}
}
...
...
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