$OpenBSD: patch-lib_obsd-device_c,v 1.4 2012/07/11 18:17:52 gonzalo Exp $
--- lib/obsd-device.c.orig	Fri Jan  7 18:04:28 2011
+++ lib/obsd-device.c	Fri Jun 29 10:19:48 2012
@@ -56,11 +56,6 @@ static int
 obsd_read(struct pci_dev *d, int pos, byte *buf, int len)
 {
   struct pci_io pi;
-  union {
-	  u_int32_t u32;
-	  u_int16_t u16[2];
-	  u_int8_t u8[4];
-  } u;
 
   if (!(len == 1 || len == 2 || len == 4))
     return pci_generic_block_read(d, pos, buf, len);
@@ -81,18 +76,16 @@ obsd_read(struct pci_dev *d, int pos, byte *buf, int l
 	  else
 		  d->access->error("obsd_read: ioctl(PCIOCREAD) failed");
   }
-  u.u32 = pi.pi_data;
-
   switch (len)
     {
     case 1:
-      buf[0] = (u8) u.u8[pos % 4];
+      buf[0] = (u8) (pi.pi_data >> ((pos % 4) * 8));
       break;
     case 2:
-      ((u16 *) buf)[0] = letoh16(u.u16[(pos % 4) / 2]);
+      ((u16 *) buf)[0] = (u16) htole16(pi.pi_data >> ((pos % 4) * 8));
       break;
     case 4:
-      ((u32 *) buf)[0] = (u32) letoh32(pi.pi_data);
+      ((u32 *) buf)[0] = (u32) htole32(pi.pi_data);
       break;
     }
   return 1;
