sim: cast away hw/device differences
authorMike Frysinger <vapier@gentoo.org>
Tue, 23 Nov 2010 02:45:29 +0000 (02:45 +0000)
committerMike Frysinger <vapier@gentoo.org>
Tue, 23 Nov 2010 02:45:29 +0000 (02:45 +0000)
When building with device and hw support, the sim-core code generates a
lot of build time warnings such as:

./../common/sim-core.c: In function 'sim_core_map_attach':
./../common/sim-core.c:198:7: warning: passing argument 1 of 'device_error' from incompatible pointer type
../common/sim-core.h:347:6: note: expected 'struct device *' but argument is of type 'struct hw *'
./../common/sim-core.c:235:7: warning: passing argument 1 of 'device_error' from incompatible pointer type
../common/sim-core.h:347:6: note: expected 'struct device *' but argument is of type 'struct hw *'

In reality, these two structures get cast back and forth in the core
code already and so are "compatible".  So tweak the three functions
that generate all of these warnings to include the casts automatically.
I know this isn't exactly clean, but the current device/hw ifdef
approach is full of landmines itself and I'm not entirely sure how
to unscrew it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
sim/common/ChangeLog
sim/common/sim-core.c

index d6dc0224d1d66e18eef4b3e041289fdc53c8a538..3a6cea4d642102dbb5a46bccc204b305ce3bdbe0 100644 (file)
@@ -1,3 +1,8 @@
+2010-11-22  Mike Frysinger  <vapier@gentoo.org>
+
+       * sim-core.c (WITH_HW): Add device casts to device_error,
+       device_io_read_buffer, and device_io_write_buffer.
+
 2010-11-16  Mike Frysinger  <vapier@gentoo.org>
 
        * dv-sockser.c (dv_sockser_write_buffer): New function.
index 5476ead71ffc0204799df8018356ecd090e563d9..31cb06b479afb189aeb7c132070fe4ca10277327 100644 (file)
@@ -28,6 +28,9 @@
 
 #if (WITH_HW)
 #include "sim-hw.h"
+#define device_error(client, ...) device_error ((device *)(client), __VA_ARGS__)
+#define device_io_read_buffer(client, ...) device_io_read_buffer ((device *)(client), __VA_ARGS__)
+#define device_io_write_buffer(client, ...) device_io_write_buffer ((device *)(client), __VA_ARGS__)
 #endif
 
 /* "core" module install handler.
This page took 0.029907 seconds and 4 git commands to generate.