Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Linux-Kernel
Linux AT91
Commits
0f04b761
Commit
0f04b761
authored
Feb 23, 2015
by
Michael Welling
Browse files
ARRAY_SIZE no workie on pointers.
Signed-off-by:
Michael Welling
<
mwelling@emacinc.com
>
parent
342a8c08
Changes
2
Hide whitespace changes
Inline
Side-by-side
drivers/ioex/boardspec.c
View file @
0f04b761
...
...
@@ -49,7 +49,7 @@ static gpio_data gpio_data_read(struct gpio_s *gpio)
int
i
;
value
=
0
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
gpio
->
gpio_
set
)
;
i
++
)
for
(
i
=
0
;
i
<
gpio
->
gpio_
cnt
;
i
++
)
value
|=
(
gpio_get_value
(
gpio
->
gpio_set
[
i
])
<<
i
);
return
value
;
...
...
@@ -59,7 +59,7 @@ static int gpio_data_write(struct gpio_s *gpio, gpio_data data)
{
int
i
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
gpio
->
gpio_
set
)
;
i
++
)
for
(
i
=
0
;
i
<
gpio
->
gpio_
cnt
;
i
++
)
gpio_set_value
(
gpio
->
gpio_set
[
i
],
(
data
>>
i
)
&
1
);
return
0
;
...
...
@@ -76,7 +76,7 @@ static int gpio_ddr_write(struct gpio_s *gpio, gpio_data data)
gpio
->
ddr_shadow
=
data
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
gpio
->
gpio_
set
)
;
i
++
)
for
(
i
=
0
;
i
<
gpio
->
gpio_
cnt
;
i
++
)
{
if
(
data
&
(
1
<<
i
))
gpio_direction_output
(
gpio
->
gpio_set
[
i
],
0
);
...
...
@@ -86,8 +86,8 @@ static int gpio_ddr_write(struct gpio_s *gpio, gpio_data data)
return
0
;
}
struct
device
*
gpio_class_create
(
char
*
name
,
int
*
gpio_array
,
int
direction
,
int
value
)
struct
device
*
gpio_class_create
(
char
*
name
,
int
*
gpio_array
,
int
gpio_count
,
int
direction
,
int
value
)
{
gpio_t
*
gpio
=
kzalloc
(
sizeof
(
gpio_t
),
GFP_KERNEL
);
...
...
@@ -100,6 +100,7 @@ struct device * gpio_class_create(char * name, int * gpio_array, int direction,
gpio
->
ddr_write
=
gpio_ddr_write
;
gpio
->
ddr_read
=
gpio_ddr_read
;
gpio
->
gpio_set
=
gpio_array
;
gpio
->
gpio_cnt
=
gpio_count
;
gpio_ddr_write
(
gpio
,
direction
);
gpio_data_write
(
gpio
,
value
);
...
...
@@ -150,8 +151,8 @@ int boardspec_generic_init_of(struct device_node * np)
if
(
tprop
)
value
=
of_read_ulong
(
tprop
,
1
);
if
(
gpio_class_create
(
prop
->
name
,
curr_gpio
,
direction
,
value
)
==
NULL
)
if
(
gpio_class_create
(
prop
->
name
,
curr_gpio
,
curr_count
,
direction
,
value
)
==
NULL
)
return
-
ENOMEM
;
}
...
...
include/linux/class/gpio.h
View file @
0f04b761
...
...
@@ -62,6 +62,7 @@ typedef struct gpio_s {
struct
mutex
lock
;
struct
gpio_irq_data
irq_data
;
int
*
gpio_set
;
int
gpio_cnt
;
#ifdef CONFIG_GPIOCLASS_CHAR
struct
cdev
*
cdev
;
#endif
...
...
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