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
ea2959a2
Commit
ea2959a2
authored
May 15, 2008
by
Jonathan Corbet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
paride: cdev lock_kernel() pushdown
Signed-off-by:
Jonathan Corbet
<
corbet@lwn.net
>
parent
579174a5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
7 deletions
+23
-7
drivers/block/paride/pg.c
drivers/block/paride/pg.c
+16
-6
drivers/block/paride/pt.c
drivers/block/paride/pt.c
+7
-1
No files found.
drivers/block/paride/pg.c
View file @
ea2959a2
...
...
@@ -162,6 +162,7 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV, D_DLY};
#include <linux/pg.h>
#include <linux/device.h>
#include <linux/sched.h>
/* current, TASK_* */
#include <linux/smp_lock.h>
#include <linux/jiffies.h>
#include <asm/uaccess.h>
...
...
@@ -515,12 +516,18 @@ static int pg_open(struct inode *inode, struct file *file)
{
int
unit
=
iminor
(
inode
)
&
0x7f
;
struct
pg
*
dev
=
&
devices
[
unit
];
int
ret
=
0
;
if
((
unit
>=
PG_UNITS
)
||
(
!
dev
->
present
))
return
-
ENODEV
;
lock_kernel
();
if
((
unit
>=
PG_UNITS
)
||
(
!
dev
->
present
))
{
ret
=
-
ENODEV
;
goto
out
;
}
if
(
test_and_set_bit
(
0
,
&
dev
->
access
))
return
-
EBUSY
;
if
(
test_and_set_bit
(
0
,
&
dev
->
access
))
{
ret
=
-
EBUSY
;
goto
out
;
}
if
(
dev
->
busy
)
{
pg_reset
(
dev
);
...
...
@@ -533,12 +540,15 @@ static int pg_open(struct inode *inode, struct file *file)
if
(
dev
->
bufptr
==
NULL
)
{
clear_bit
(
0
,
&
dev
->
access
);
printk
(
"%s: buffer allocation failed
\n
"
,
dev
->
name
);
return
-
ENOMEM
;
ret
=
-
ENOMEM
;
goto
out
;
}
file
->
private_data
=
dev
;
return
0
;
out:
unlock_kernel
();
return
ret
;
}
static
int
pg_release
(
struct
inode
*
inode
,
struct
file
*
file
)
...
...
drivers/block/paride/pt.c
View file @
ea2959a2
...
...
@@ -146,6 +146,7 @@ static int (*drives[4])[6] = {&drive0, &drive1, &drive2, &drive3};
#include <linux/mtio.h>
#include <linux/device.h>
#include <linux/sched.h>
/* current, TASK_*, schedule_timeout() */
#include <linux/smp_lock.h>
#include <asm/uaccess.h>
...
...
@@ -650,8 +651,11 @@ static int pt_open(struct inode *inode, struct file *file)
struct
pt_unit
*
tape
=
pt
+
unit
;
int
err
;
if
(
unit
>=
PT_UNITS
||
(
!
tape
->
present
))
lock_kernel
();
if
(
unit
>=
PT_UNITS
||
(
!
tape
->
present
))
{
unlock_kernel
();
return
-
ENODEV
;
}
err
=
-
EBUSY
;
if
(
!
atomic_dec_and_test
(
&
tape
->
available
))
...
...
@@ -678,10 +682,12 @@ static int pt_open(struct inode *inode, struct file *file)
}
file
->
private_data
=
tape
;
unlock_kernel
();
return
0
;
out:
atomic_inc
(
&
tape
->
available
);
unlock_kernel
();
return
err
;
}
...
...
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