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
3db633ee
Commit
3db633ee
authored
May 15, 2008
by
Jonathan Corbet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
i2c: cdev lock_kernel() pushdown
Signed-off-by:
Jonathan Corbet
<
corbet@lwn.net
>
parent
5119e92e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
6 deletions
+16
-6
drivers/i2c/i2c-dev.c
drivers/i2c/i2c-dev.c
+16
-6
No files found.
drivers/i2c/i2c-dev.c
View file @
3db633ee
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
#include <linux/list.h>
#include <linux/list.h>
#include <linux/i2c.h>
#include <linux/i2c.h>
#include <linux/i2c-dev.h>
#include <linux/i2c-dev.h>
#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include <asm/uaccess.h>
static
struct
i2c_driver
i2cdev_driver
;
static
struct
i2c_driver
i2cdev_driver
;
...
@@ -441,14 +442,20 @@ static int i2cdev_open(struct inode *inode, struct file *file)
...
@@ -441,14 +442,20 @@ static int i2cdev_open(struct inode *inode, struct file *file)
struct
i2c_client
*
client
;
struct
i2c_client
*
client
;
struct
i2c_adapter
*
adap
;
struct
i2c_adapter
*
adap
;
struct
i2c_dev
*
i2c_dev
;
struct
i2c_dev
*
i2c_dev
;
int
ret
=
0
;
lock_kernel
();
i2c_dev
=
i2c_dev_get_by_minor
(
minor
);
i2c_dev
=
i2c_dev_get_by_minor
(
minor
);
if
(
!
i2c_dev
)
if
(
!
i2c_dev
)
{
return
-
ENODEV
;
ret
=
-
ENODEV
;
goto
out
;
}
adap
=
i2c_get_adapter
(
i2c_dev
->
adap
->
nr
);
adap
=
i2c_get_adapter
(
i2c_dev
->
adap
->
nr
);
if
(
!
adap
)
if
(
!
adap
)
{
return
-
ENODEV
;
ret
=
-
ENODEV
;
goto
out
;
}
/* This creates an anonymous i2c_client, which may later be
/* This creates an anonymous i2c_client, which may later be
* pointed to some address using I2C_SLAVE or I2C_SLAVE_FORCE.
* pointed to some address using I2C_SLAVE or I2C_SLAVE_FORCE.
...
@@ -460,7 +467,8 @@ static int i2cdev_open(struct inode *inode, struct file *file)
...
@@ -460,7 +467,8 @@ static int i2cdev_open(struct inode *inode, struct file *file)
client
=
kzalloc
(
sizeof
(
*
client
),
GFP_KERNEL
);
client
=
kzalloc
(
sizeof
(
*
client
),
GFP_KERNEL
);
if
(
!
client
)
{
if
(
!
client
)
{
i2c_put_adapter
(
adap
);
i2c_put_adapter
(
adap
);
return
-
ENOMEM
;
ret
=
-
ENOMEM
;
goto
out
;
}
}
snprintf
(
client
->
name
,
I2C_NAME_SIZE
,
"i2c-dev %d"
,
adap
->
nr
);
snprintf
(
client
->
name
,
I2C_NAME_SIZE
,
"i2c-dev %d"
,
adap
->
nr
);
client
->
driver
=
&
i2cdev_driver
;
client
->
driver
=
&
i2cdev_driver
;
...
@@ -468,7 +476,9 @@ static int i2cdev_open(struct inode *inode, struct file *file)
...
@@ -468,7 +476,9 @@ static int i2cdev_open(struct inode *inode, struct file *file)
client
->
adapter
=
adap
;
client
->
adapter
=
adap
;
file
->
private_data
=
client
;
file
->
private_data
=
client
;
return
0
;
out:
unlock_kernel
();
return
ret
;
}
}
static
int
i2cdev_release
(
struct
inode
*
inode
,
struct
file
*
file
)
static
int
i2cdev_release
(
struct
inode
*
inode
,
struct
file
*
file
)
...
...
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