__u8 byte[2];
} __u16_host_order;
-/* Same purpose, different application */
-#define u16ho(array) (* ((__u16 *) array))
-
/* Types of discovery */
typedef enum {
DISCOVERY_LOG, /* What's in our discovery log */
#include <net/irda/discovery.h>
+#include <asm/unaligned.h>
+
/*
* Function irlmp_add_discovery (cachelog, discovery)
*
*/
hashbin_remove_this(cachelog, (irda_queue_t *) node);
/* Check if hints bits are unchanged */
- if(u16ho(node->data.hints) == u16ho(new->data.hints))
+ if (get_unaligned((__u16 *)node->data.hints) == get_unaligned((__u16 *)new->data.hints))
/* Set time of first discovery for this node */
new->firststamp = node->firststamp;
kfree(node);
/* Mask out the ones we don't want :
* We want to match the discovery mask, and to get only
* the most recent one (unless we want old ones) */
- if ((u16ho(discovery->data.hints) & mask) &&
+ if ((get_unaligned((__u16 *)discovery->data.hints) & mask) &&
((old_entries) ||
- ((jiffies - discovery->firststamp) < j_timeout)) ) {
+ ((jiffies - discovery->firststamp) < j_timeout))) {
/* Create buffer as needed.
* As this function get called a lot and most time
* we don't have anything to put in the log (we are
for(i = 0; i < number; i++) {
/* Check if we should notify client */
if ((client->expir_callback) &&
- (client->hint_mask.word & u16ho(expiries[i].hints)
+ (client->hint_mask.word &
+ get_unaligned((__u16 *)expiries[i].hints)
& 0x7f7f) )
client->expir_callback(&(expiries[i]),
EXPIRY_TIMEOUT,
IRDA_ASSERT(irlmp != NULL, return NULL;);
- u16ho(irlmp->discovery_rsp.data.hints) = irlmp->hints.word;
+ put_unaligned(irlmp->hints.word, (__u16 *)irlmp->discovery_rsp.data.hints);
/*
* Set character set for device name (we use ASCII), and
/* Notify the control channel */
irnet_post_event(NULL, IRNET_DISCOVER,
discovery->saddr, discovery->daddr, discovery->info,
- u16ho(discovery->hints));
+ get_unaligned((__u16 *)discovery->hints));
DEXIT(IRDA_OCB_TRACE, "\n");
}
/* Notify the control channel */
irnet_post_event(NULL, IRNET_EXPIRE,
expiry->saddr, expiry->daddr, expiry->info,
- u16ho(expiry->hints));
+ get_unaligned((__u16 *)expiry->hints));
DEXIT(IRDA_OCB_TRACE, "\n");
}