[OpenBIOS] [PATCH 3/5] adb: Don't assume that pointers fit in 32 bits

Andreas Färber andreas.faerber at web.de
Wed Oct 27 01:08:42 CEST 2010


v2:
* Change field type to pointer to avoid casts.

Signed-off-by: Andreas Färber <andreas.faerber at web.de>
---
 drivers/adb_bus.h |    2 +-
 drivers/adb_kbd.c |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/adb_bus.h b/drivers/adb_bus.h
index e897fe4..205b375 100644
--- a/drivers/adb_bus.h
+++ b/drivers/adb_bus.h
@@ -32,7 +32,7 @@ struct adb_dev_t {
     adb_bus_t *bus;
     uint8_t addr;
     uint8_t type;
-    uint32_t state;
+    void *state;
 };
 
 #define ADB_BUF_SIZE 8
diff --git a/drivers/adb_kbd.c b/drivers/adb_kbd.c
index 0784ec8..e38798a 100644
--- a/drivers/adb_kbd.c
+++ b/drivers/adb_kbd.c
@@ -483,7 +483,7 @@ static int adb_kbd_read (void *private)
     int key;
     int ret;
 
-    kbd = (void *)dev->state;
+    kbd = dev->state;
 
     if (kbd->len > 0) {
         ret = kbd->sequence[kbd->len-- - 1];
@@ -531,7 +531,7 @@ void *adb_kbd_new (char *path, void *private)
 			ADB_kbd_us, ADB_sequences);
         kbd->next_key = -1;
         kbd->len = 0;
-	dev->state = (int32_t)kbd;
+	dev->state = kbd;
 	my_adb_dev = dev;
     }
 
-- 
1.7.3




More information about the OpenBIOS mailing list