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
64007dd6
Commit
64007dd6
authored
Mar 19, 2003
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
i2c: add initial driver model support for i2c drivers.
parent
89563a9e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
0 deletions
+25
-0
drivers/i2c/i2c-core.c
drivers/i2c/i2c-core.c
+22
-0
include/linux/i2c.h
include/linux/i2c.h
+3
-0
No files found.
drivers/i2c/i2c-core.c
View file @
64007dd6
...
...
@@ -53,6 +53,16 @@ static void i2cproc_remove(int bus);
#endif
/* CONFIG_PROC_FS */
int
i2c_device_probe
(
struct
device
*
dev
)
{
return
-
ENODEV
;
}
int
i2c_device_remove
(
struct
device
*
dev
)
{
return
0
;
}
/* ---------------------------------------------------
* registering functions
* ---------------------------------------------------
...
...
@@ -205,6 +215,16 @@ int i2c_add_driver(struct i2c_driver *driver)
DEB
(
printk
(
KERN_DEBUG
"i2c-core.o: driver %s registered.
\n
"
,
driver
->
name
));
/* add the driver to the list of i2c drivers in the driver core */
driver
->
driver
.
name
=
driver
->
name
;
driver
->
driver
.
bus
=
&
i2c_bus_type
;
driver
->
driver
.
probe
=
i2c_device_probe
;
driver
->
driver
.
remove
=
i2c_device_remove
;
res
=
driver_register
(
&
driver
->
driver
);
if
(
res
)
goto
out_unlock
;
/* now look for instances of driver on our adapters
*/
if
(
driver
->
flags
&
(
I2C_DF_NOTIFY
|
I2C_DF_DUMMY
))
{
...
...
@@ -236,6 +256,8 @@ int i2c_del_driver(struct i2c_driver *driver)
goto
out_unlock
;
}
driver_unregister
(
&
driver
->
driver
);
/* Have a look at each adapter, if clients of this driver are still
* attached. If so, detach them to be able to kill the driver
* afterwards.
...
...
include/linux/i2c.h
View file @
64007dd6
...
...
@@ -143,7 +143,10 @@ struct i2c_driver {
* with the device.
*/
int
(
*
command
)(
struct
i2c_client
*
client
,
unsigned
int
cmd
,
void
*
arg
);
struct
device_driver
driver
;
};
#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver)
extern
struct
bus_type
i2c_bus_type
;
...
...
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