提交 24b7ed47 编写于 作者: J Jens Frederich 提交者: Greg Kroah-Hartman

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: NJens Frederich <jfrederich@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 98d4f93c
...@@ -122,12 +122,13 @@ static int dcon_hw_init(struct dcon_priv *dcon, int is_init) ...@@ -122,12 +122,13 @@ static int dcon_hw_init(struct dcon_priv *dcon, int is_init)
static int dcon_bus_stabilize(struct dcon_priv *dcon, int is_powered_down) static int dcon_bus_stabilize(struct dcon_priv *dcon, int is_powered_down)
{ {
unsigned long timeout; unsigned long timeout;
u8 pm;
int x; int x;
power_up: power_up:
if (is_powered_down) { if (is_powered_down) {
x = 1; pm = 1;
x = olpc_ec_cmd(EC_DCON_POWER_MODE, (u8 *)&x, 1, NULL, 0); x = olpc_ec_cmd(EC_DCON_POWER_MODE, &pm, 1, NULL, 0);
if (x) { if (x) {
pr_warn("unable to force dcon to power up: %d!\n", x); pr_warn("unable to force dcon to power up: %d!\n", x);
return x; return x;
...@@ -144,8 +145,8 @@ static int dcon_bus_stabilize(struct dcon_priv *dcon, int is_powered_down) ...@@ -144,8 +145,8 @@ static int dcon_bus_stabilize(struct dcon_priv *dcon, int is_powered_down)
if (x < 0) { if (x < 0) {
pr_err("unable to stabilize dcon's smbus, reasserting power and praying.\n"); pr_err("unable to stabilize dcon's smbus, reasserting power and praying.\n");
BUG_ON(olpc_board_at_least(olpc_board(0xc2))); BUG_ON(olpc_board_at_least(olpc_board(0xc2)));
x = 0; pm = 0;
olpc_ec_cmd(EC_DCON_POWER_MODE, (u8 *)&x, 1, NULL, 0); olpc_ec_cmd(EC_DCON_POWER_MODE, &pm, 1, NULL, 0);
msleep(100); msleep(100);
is_powered_down = 1; is_powered_down = 1;
goto power_up; /* argh, stupid hardware.. */ goto power_up; /* argh, stupid hardware.. */
...@@ -208,8 +209,8 @@ static void dcon_sleep(struct dcon_priv *dcon, bool sleep) ...@@ -208,8 +209,8 @@ static void dcon_sleep(struct dcon_priv *dcon, bool sleep)
return; return;
if (sleep) { if (sleep) {
x = 0; u8 pm = 0;
x = olpc_ec_cmd(EC_DCON_POWER_MODE, (u8 *)&x, 1, NULL, 0); x = olpc_ec_cmd(EC_DCON_POWER_MODE, &pm, 1, NULL, 0);
if (x) if (x)
pr_warn("unable to force dcon to power down: %d!\n", x); pr_warn("unable to force dcon to power down: %d!\n", x);
else else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册