Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-elphel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
linux-elphel
Commits
8b238de5
Commit
8b238de5
authored
May 06, 2016
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mutex for gpio_10389_control
parent
5b0dfc76
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
elphel393-pwr.c
src/drivers/elphel/elphel393-pwr.c
+5
-3
No files found.
src/drivers/elphel/elphel393-pwr.c
View file @
8b238de5
...
@@ -63,6 +63,7 @@
...
@@ -63,6 +63,7 @@
#define REF_VAR_STEP_TENTH_MV 125
#define REF_VAR_STEP_TENTH_MV 125
#define DEAFULT_TIMEOUT 300
/* number of retries testing pgood before giving up */
#define DEAFULT_TIMEOUT 300
/* number of retries testing pgood before giving up */
static
DEFINE_MUTEX
(
gpio_10389_lock
);
struct
pwr_gpio_t
{
struct
pwr_gpio_t
{
const
char
*
label
;
const
char
*
label
;
...
@@ -653,7 +654,7 @@ int gpio_10389_ctrl(struct device *dev, int value){
...
@@ -653,7 +654,7 @@ int gpio_10389_ctrl(struct device *dev, int value){
int
val
=
0
;
int
val
=
0
;
//lock here
//lock here
//doesn't work
//doesn't work
//mutex_lock(&dev->mutex
);
mutex_lock
(
&
gpio_10389_lock
);
for
(
i
=
16
;
i
<
20
;
i
++
){
for
(
i
=
16
;
i
<
20
;
i
++
){
if
((
value
>>
(
i
-
8
))
&
0x1
){
if
((
value
>>
(
i
-
8
))
&
0x1
){
val
=
(
value
>>
(
i
-
16
))
&
0x1
;
val
=
(
value
>>
(
i
-
16
))
&
0x1
;
...
@@ -665,12 +666,13 @@ int gpio_10389_ctrl(struct device *dev, int value){
...
@@ -665,12 +666,13 @@ int gpio_10389_ctrl(struct device *dev, int value){
}
}
//unlock somewhere here
//unlock somewhere here
//doesn't work
//doesn't work
//mutex_unlock(&dev->mutex
);
mutex_unlock
(
&
gpio_10389_lock
);
return
0
;
return
0
;
}
}
int
gpio_10389_control
(
int
value
){
int
gpio_10389_control
(
int
value
){
return
gpio_10389_ctrl
(
shutdown_dev
,
value
);
gpio_10389_ctrl
(
shutdown_dev
,
value
);
return
0
;
}
}
EXPORT_SYMBOL_GPL
(
gpio_10389_control
);
EXPORT_SYMBOL_GPL
(
gpio_10389_control
);
...
...
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