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
2c942813
Commit
2c942813
authored
Mar 02, 2004
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] I2C: show adapter name in i2c-dev class directory to make it easier for userspace tools.
parent
404596e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
drivers/i2c/i2c-dev.c
drivers/i2c/i2c-dev.c
+8
-0
No files found.
drivers/i2c/i2c-dev.c
View file @
2c942813
...
@@ -124,6 +124,13 @@ static ssize_t show_dev(struct class_device *class_dev, char *buf)
...
@@ -124,6 +124,13 @@ static ssize_t show_dev(struct class_device *class_dev, char *buf)
}
}
static
CLASS_DEVICE_ATTR
(
dev
,
S_IRUGO
,
show_dev
,
NULL
);
static
CLASS_DEVICE_ATTR
(
dev
,
S_IRUGO
,
show_dev
,
NULL
);
static
ssize_t
show_adapter_name
(
struct
class_device
*
class_dev
,
char
*
buf
)
{
struct
i2c_dev
*
i2c_dev
=
to_i2c_dev
(
class_dev
);
return
sprintf
(
buf
,
"%s
\n
"
,
i2c_dev
->
adap
->
name
);
}
static
CLASS_DEVICE_ATTR
(
name
,
S_IRUGO
,
show_adapter_name
,
NULL
);
static
ssize_t
i2cdev_read
(
struct
file
*
file
,
char
__user
*
buf
,
size_t
count
,
static
ssize_t
i2cdev_read
(
struct
file
*
file
,
char
__user
*
buf
,
size_t
count
,
loff_t
*
offset
)
loff_t
*
offset
)
{
{
...
@@ -459,6 +466,7 @@ static int i2cdev_attach_adapter(struct i2c_adapter *adap)
...
@@ -459,6 +466,7 @@ static int i2cdev_attach_adapter(struct i2c_adapter *adap)
if
(
retval
)
if
(
retval
)
goto
error
;
goto
error
;
class_device_create_file
(
&
i2c_dev
->
class_dev
,
&
class_device_attr_dev
);
class_device_create_file
(
&
i2c_dev
->
class_dev
,
&
class_device_attr_dev
);
class_device_create_file
(
&
i2c_dev
->
class_dev
,
&
class_device_attr_name
);
return
0
;
return
0
;
error:
error:
return_i2c_dev
(
i2c_dev
);
return_i2c_dev
(
i2c_dev
);
...
...
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