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
e24e7257
Commit
e24e7257
authored
Sep 01, 2014
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
greybus: greybus_string()
parent
21ee4116
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
3 deletions
+19
-3
drivers/staging/greybus/core.c
drivers/staging/greybus/core.c
+18
-2
drivers/staging/greybus/greybus.h
drivers/staging/greybus/greybus.h
+1
-1
No files found.
drivers/staging/greybus/core.c
View file @
e24e7257
...
@@ -169,6 +169,22 @@ static void greybus_module_release(struct device *dev)
...
@@ -169,6 +169,22 @@ static void greybus_module_release(struct device *dev)
}
}
const
u8
*
greybus_string
(
struct
greybus_device
*
gdev
,
int
id
)
{
int
i
;
struct
gdev_string
*
string
;
if
(
!
gdev
)
return
NULL
;
for
(
i
=
0
;
i
<
gdev
->
num_strings
;
++
i
)
{
string
=
gdev
->
string
[
i
];
if
(
string
->
id
==
id
)
return
&
string
->
string
[
0
];
}
return
NULL
;
}
static
struct
device_type
greybus_module_type
=
{
static
struct
device_type
greybus_module_type
=
{
.
name
=
"greybus_module"
,
.
name
=
"greybus_module"
,
.
release
=
greybus_module_release
,
.
release
=
greybus_module_release
,
...
@@ -242,7 +258,7 @@ static ssize_t module_vendor_string_show(struct device *dev,
...
@@ -242,7 +258,7 @@ static ssize_t module_vendor_string_show(struct device *dev,
{
{
struct
greybus_device
*
gdev
=
to_greybus_device
(
dev
);
struct
greybus_device
*
gdev
=
to_greybus_device
(
dev
);
return
sprintf
(
buf
,
"%s"
,
return
sprintf
(
buf
,
"%s"
,
greybus_string
(
gdev
->
module_id
.
vendor_stringid
));
greybus_string
(
gdev
,
gdev
->
module_id
.
vendor_stringid
));
}
}
static
DEVICE_ATTR_RO
(
module_vendor_string
);
static
DEVICE_ATTR_RO
(
module_vendor_string
);
...
@@ -252,7 +268,7 @@ static ssize_t module_product_string_show(struct device *dev,
...
@@ -252,7 +268,7 @@ static ssize_t module_product_string_show(struct device *dev,
{
{
struct
greybus_device
*
gdev
=
to_greybus_device
(
dev
);
struct
greybus_device
*
gdev
=
to_greybus_device
(
dev
);
return
sprintf
(
buf
,
"%s"
,
return
sprintf
(
buf
,
"%s"
,
greybus_string
(
gdev
->
module_id
.
product_stringid
));
greybus_string
(
gdev
,
gdev
->
module_id
.
product_stringid
));
}
}
static
DEVICE_ATTR_RO
(
module_product_string
);
static
DEVICE_ATTR_RO
(
module_product_string
);
...
...
drivers/staging/greybus/greybus.h
View file @
e24e7257
...
@@ -178,7 +178,7 @@ struct greybus_device *greybus_new_device(struct device *parent,
...
@@ -178,7 +178,7 @@ struct greybus_device *greybus_new_device(struct device *parent,
int
size
);
int
size
);
void
greybus_remove_device
(
struct
greybus_device
*
gdev
);
void
greybus_remove_device
(
struct
greybus_device
*
gdev
);
const
u8
*
greybus_string
(
int
id
);
const
u8
*
greybus_string
(
struct
greybus_device
*
gdev
,
int
id
);
/* Internal functions to gb module, move to internal .h file eventually. */
/* Internal functions to gb module, move to internal .h file eventually. */
...
...
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