Skip to content

Commit 24b7ed4

Browse files
frederichgregkh
authored andcommitted
Staging: olpc_dcon: more big endian conformity
Using an int which is casted to unsigned char as inbuf is messy. The code won't work on big endian systems. The patch should fix this. Signed-off-by: Jens Frederich <jfrederich@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 98d4f93 commit 24b7ed4

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

‎drivers/staging/olpc_dcon/olpc_dcon.c‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,13 @@ static int dcon_hw_init(struct dcon_priv *dcon, int is_init)
122122
static int dcon_bus_stabilize(struct dcon_priv *dcon, int is_powered_down)
123123
{
124124
unsigned long timeout;
125+
u8 pm;
125126
int x;
126127

127128
power_up:
128129
if (is_powered_down) {
129-
x = 1;
130-
x = olpc_ec_cmd(EC_DCON_POWER_MODE, (u8 *)&x, 1, NULL, 0);
130+
pm = 1;
131+
x = olpc_ec_cmd(EC_DCON_POWER_MODE, &pm, 1, NULL, 0);
131132
if (x) {
132133
pr_warn("unable to force dcon to power up: %d!\n", x);
133134
return x;
@@ -144,8 +145,8 @@ static int dcon_bus_stabilize(struct dcon_priv *dcon, int is_powered_down)
144145
if (x < 0) {
145146
pr_err("unable to stabilize dcon's smbus, reasserting power and praying.\n");
146147
BUG_ON(olpc_board_at_least(olpc_board(0xc2)));
147-
x = 0;
148-
olpc_ec_cmd(EC_DCON_POWER_MODE, (u8 *)&x, 1, NULL, 0);
148+
pm = 0;
149+
olpc_ec_cmd(EC_DCON_POWER_MODE, &pm, 1, NULL, 0);
149150
msleep(100);
150151
is_powered_down = 1;
151152
goto power_up; /* argh, stupid hardware.. */
@@ -208,8 +209,8 @@ static void dcon_sleep(struct dcon_priv *dcon, bool sleep)
208209
return;
209210

210211
if (sleep) {
211-
x = 0;
212-
x = olpc_ec_cmd(EC_DCON_POWER_MODE, (u8 *)&x, 1, NULL, 0);
212+
u8 pm = 0;
213+
x = olpc_ec_cmd(EC_DCON_POWER_MODE, &pm, 1, NULL, 0);
213214
if (x)
214215
pr_warn("unable to force dcon to power down: %d!\n", x);
215216
else

0 commit comments

Comments
 (0)