--- include/net/irda/parameters.h.orig	Sat Oct 27 16:58:15 2001
+++ include/net/irda/parameters.h	Tue Oct 30 00:41:41 2001
@@ -25,6 +25,9 @@
  *     along with this program; if not, write to the Free Software 
  *     Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
  *     MA 02111-1307 USA
+ *
+ *     Michel Dänzer <daenzer@debian.org>, 10/2001
+ *     - simplify irda_pv_t to avoid endianness issues
  *     
  ********************************************************************/
 
@@ -55,11 +58,7 @@
 
 typedef union {
 	char   *c;
-	__u8    b;
-	__u16   s;
 	__u32   i;
-	__u8  *bp;
-	__u16 *sp;
 	__u32 *ip;
 } irda_pv_t;
 
--- net/irda/ircomm/ircomm_param.c.orig	Sat Oct 27 16:58:15 2001
+++ net/irda/ircomm/ircomm_param.c	Mon Oct 29 23:27:11 2001
@@ -182,13 +182,13 @@
 				     int get)
 {
 	struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
-	__u8 service_type = param->pv.b; /* We know it's a one byte integer */
+	__u8 service_type = (__u8) param->pv.i;
 
 	ASSERT(self != NULL, return -1;);
 	ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
 
 	if (get) {
-		param->pv.b = self->settings.service_type;
+		param->pv.i = self->settings.service_type;
 		return 0;
 	}
 
@@ -246,9 +246,9 @@
 	ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
 	
 	if (get)
-		param->pv.b = IRCOMM_SERIAL;
+		param->pv.i = IRCOMM_SERIAL;
 	else {
-		self->settings.port_type = param->pv.b;
+		self->settings.port_type = (__u8) param->pv.i;
 
 		IRDA_DEBUG(0, __FUNCTION__ "(), port type=%d\n", 
 			   self->settings.port_type);
@@ -317,9 +317,9 @@
 	ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
 
 	if (get)
-		param->pv.b = self->settings.data_format;
+		param->pv.i = self->settings.data_format;
 	else
-		self->settings.data_format = param->pv.b;
+		self->settings.data_format = (__u8) param->pv.i;
 	
 	return 0;
 }
@@ -339,11 +339,11 @@
 	ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
 	
 	if (get)
-		param->pv.b = self->settings.flow_control;
+		param->pv.i = self->settings.flow_control;
 	else
-		self->settings.flow_control = param->pv.b;
+		self->settings.flow_control = (__u8) param->pv.i;
 
-	IRDA_DEBUG(1, __FUNCTION__ "(), flow control = 0x%02x\n", param->pv.b);
+	IRDA_DEBUG(1, __FUNCTION__ "(), flow control = 0x%02x\n", (__u8) param->pv.i);
 
 	return 0;
 }
@@ -362,15 +362,15 @@
 	ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
 	
 	if (get) {
-		param->pv.s = self->settings.xonxoff[0];
-		param->pv.s |= self->settings.xonxoff[1] << 8;
+		param->pv.i = self->settings.xonxoff[0];
+		param->pv.i |= self->settings.xonxoff[1] << 8;
 	} else {
-		self->settings.xonxoff[0] = param->pv.s & 0xff;
-		self->settings.xonxoff[1] = param->pv.s >> 8;
+		self->settings.xonxoff[0] = (__u16) param->pv.i & 0xff;
+		self->settings.xonxoff[1] = (__u16) param->pv.i >> 8;
 	}
 
 	IRDA_DEBUG(0, __FUNCTION__ "(), XON/XOFF = 0x%02x,0x%02x\n", 
-		   param->pv.s & 0xff, param->pv.s >> 8);
+		   param->pv.i & 0xff, param->pv.i >> 8);
 
 	return 0;
 }
@@ -389,15 +389,15 @@
 	ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
 	
 	if (get) {
-		param->pv.s = self->settings.enqack[0];
-		param->pv.s |= self->settings.enqack[1] << 8;
+		param->pv.i = self->settings.enqack[0];
+		param->pv.i |= self->settings.enqack[1] << 8;
 	} else {
-		self->settings.enqack[0] = param->pv.s & 0xff;
-		self->settings.enqack[1] = param->pv.s >> 8;
+		self->settings.enqack[0] = (__u16) param->pv.i & 0xff;
+		self->settings.enqack[1] = (__u16) param->pv.i >> 8;
 	}
 
 	IRDA_DEBUG(0, __FUNCTION__ "(), ENQ/ACK = 0x%02x,0x%02x\n",
-		   param->pv.s & 0xff, param->pv.s >> 8);
+		   param->pv.i & 0xff, param->pv.i >> 8);
 
 	return 0;
 }
@@ -431,9 +431,9 @@
 	ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
 
 	if (get)
-		param->pv.b = self->settings.dte;
+		param->pv.i = self->settings.dte;
 	else {
-		dte = param->pv.b;
+		dte = (__u8) param->pv.i;
 		
 		if (dte & IRCOMM_DELTA_DTR)
 			self->settings.dce |= (IRCOMM_DELTA_DSR|
@@ -470,9 +470,9 @@
 	struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
 	__u8 dce;
 
-	IRDA_DEBUG(1, __FUNCTION__ "(), dce = 0x%02x\n", param->pv.b);
+	IRDA_DEBUG(1, __FUNCTION__ "(), dce = 0x%02x\n", (__u8) param->pv.i);
 
-	dce = param->pv.b;
+	dce = (__u8) param->pv.i;
 
 	ASSERT(self != NULL, return -1;);
 	ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
--- net/irda/parameters.c.orig	Sat Oct 27 16:58:15 2001
+++ net/irda/parameters.c	Tue Oct 30 00:18:12 2001
@@ -167,14 +167,14 @@
 	IRDA_DEBUG(2, __FUNCTION__ "(), pi=%#x, pl=%d, pi=%d\n", p.pi, p.pl, p.pv.i);
 	switch (p.pl) {
 	case 1:
-		n += irda_param_pack(buf, "bbb", p.pi, p.pl, p.pv.b);
+		n += irda_param_pack(buf, "bbb", p.pi, p.pl, (__u8) p.pv.i);
 		break;
 	case 2:
 		if (type & PV_BIG_ENDIAN)
-			cpu_to_be16s(&p.pv.s);
+			p.pv.i = cpu_to_be16((__u16) p.pv.i);
 		else
-			cpu_to_le16s(&p.pv.s);
-		n += irda_param_pack(buf, "bbs", p.pi, p.pl, p.pv.s);
+			p.pv.i = cpu_to_le16((__u16) p.pv.i);
+		n += irda_param_pack(buf, "bbs", p.pi, p.pl, (__u16) p.pv.i);
 		break;
 	case 4:
 		if (type & PV_BIG_ENDIAN)
@@ -230,16 +230,17 @@
 		return p.pl+2;
 	}
 
+
 	switch (p.pl) {
 	case 1:
-		n += irda_param_unpack(buf+2, "b", &p.pv.b);
+		n += irda_param_unpack(buf+2, "b", &p.pv.i);
 		break;
 	case 2:
-		n += irda_param_unpack(buf+2, "s", &p.pv.s);
+		n += irda_param_unpack(buf+2, "s", &p.pv.i);
 		if (type & PV_BIG_ENDIAN)
-			be16_to_cpus(&p.pv.s);
+			p.pv.i = be16_to_cpu((__u16) p.pv.i);
 		else
-			le16_to_cpus(&p.pv.s);
+			p.pv.i = le16_to_cpu((__u16) p.pv.i);
 		break;
 	case 4:
 		n += irda_param_unpack(buf+2, "i", &p.pv.i);
@@ -255,6 +256,7 @@
 		return p.pl+2;
 	}
 
+	IRDA_DEBUG(2, __FUNCTION__ "(), pi=%#x, pl=%d, pi=%d\n", p.pi, p.pl, p.pv.i);
 	/* Call handler for this parameter */
 	err = (*func)(self, &p, PV_PUT);
 	if (err < 0)
@@ -359,8 +361,8 @@
 			buf[n++] = (__u8)va_arg(args, int);
 			break;
 		case 's':  /* 16 bits unsigned short */
-			arg.s = (__u16)va_arg(args, int);
-			put_unaligned(arg.s, (__u16 *)(buf+n)); n+=2;
+			arg.i = (__u16)va_arg(args, int);
+			put_unaligned((__u16)arg.i, (__u16 *)(buf+n)); n+=2;
 			break;
 		case 'i':  /* 32 bits unsigned integer */
 			arg.i = va_arg(args, __u32);
@@ -402,12 +404,12 @@
 	for (p = fmt; *p != '\0'; p++) {
 		switch (*p) {
 		case 'b':  /* 8 bits byte */
-			arg.bp = va_arg(args, __u8 *);
-			*arg.bp = buf[n++];
+			arg.ip = va_arg(args, __u32 *);
+			*arg.ip = buf[n++];
 			break;
 		case 's':  /* 16 bits short */
-			arg.sp = va_arg(args, __u16 *);
-			*arg.sp = get_unaligned((__u16 *)(buf+n)); n+=2;
+			arg.ip = va_arg(args, __u32 *);
+			*arg.ip = get_unaligned((__u16 *)(buf+n)); n+=2;
 			break;
 		case 'i':  /* 32 bits unsigned integer */
 			arg.ip = va_arg(args, __u32 *);
--- net/irda/qos.c.orig	Sat Oct 27 16:58:15 2001
+++ net/irda/qos.c	Mon Oct 29 23:49:53 2001
@@ -455,8 +455,8 @@
 		 *  Stations must agree on baud rate, so calculate
 		 *  intersection 
 		 */
-		IRDA_DEBUG(2, "Requested BAUD_RATE: 0x%04x\n", param->pv.s);
-		final = param->pv.s & self->qos_rx.baud_rate.bits;
+		IRDA_DEBUG(2, "Requested BAUD_RATE: 0x%04x\n", (__u16) param->pv.i);
+		final = (__u16) param->pv.i & self->qos_rx.baud_rate.bits;
 
 		IRDA_DEBUG(2, "Final BAUD_RATE: 0x%04x\n", final);
 		self->qos_tx.baud_rate.bits = final;
@@ -483,14 +483,14 @@
 	ASSERT(self->magic == LAP_MAGIC, return -1;);
 	
 	if (get)
-		param->pv.b = self->qos_rx.link_disc_time.bits;
+		param->pv.i = self->qos_rx.link_disc_time.bits;
 	else {
 		/*  
 		 *  Stations must agree on link disconnect/threshold 
 		 *  time.
 		 */
-		IRDA_DEBUG(2, "LINK_DISC: %02x\n", param->pv.b);
-		final = param->pv.b & self->qos_rx.link_disc_time.bits;
+		IRDA_DEBUG(2, "LINK_DISC: %02x\n", (__u8) param->pv.i);
+		final = (__u8) param->pv.i & self->qos_rx.link_disc_time.bits;
 
 		IRDA_DEBUG(2, "Final LINK_DISC: %02x\n", final);
 		self->qos_tx.link_disc_time.bits = final;
@@ -515,9 +515,9 @@
 	ASSERT(self->magic == LAP_MAGIC, return -1;);
 	
 	if (get)
-		param->pv.b = self->qos_rx.max_turn_time.bits;
+		param->pv.i = self->qos_rx.max_turn_time.bits;
 	else
-		self->qos_tx.max_turn_time.bits = param->pv.b;
+		self->qos_tx.max_turn_time.bits = (__u8) param->pv.i;
 
 	return 0;
 }
@@ -537,9 +537,9 @@
 	ASSERT(self->magic == LAP_MAGIC, return -1;);
 	
 	if (get)
-		param->pv.b = self->qos_rx.data_size.bits;
+		param->pv.i = self->qos_rx.data_size.bits;
 	else
-		self->qos_tx.data_size.bits = param->pv.b;
+		self->qos_tx.data_size.bits = (__u8) param->pv.i;
 
 	return 0;
 }
@@ -560,9 +560,9 @@
 	ASSERT(self->magic == LAP_MAGIC, return -1;);
 	
 	if (get)
-		param->pv.b = self->qos_rx.window_size.bits;
+		param->pv.i = self->qos_rx.window_size.bits;
 	else
-		self->qos_tx.window_size.bits = param->pv.b;
+		self->qos_tx.window_size.bits = (__u8) param->pv.i;
 
 	return 0;
 }
@@ -581,9 +581,9 @@
 	ASSERT(self->magic == LAP_MAGIC, return -1;);
 	
 	if (get)
-		param->pv.b = self->qos_rx.additional_bofs.bits;
+		param->pv.i = self->qos_rx.additional_bofs.bits;
 	else
-		self->qos_tx.additional_bofs.bits = param->pv.b;
+		self->qos_tx.additional_bofs.bits = (__u8) param->pv.i;
 
 	return 0;
 }
@@ -603,9 +603,9 @@
 	ASSERT(self->magic == LAP_MAGIC, return -1;);
 	
 	if (get)
-		param->pv.b = self->qos_rx.min_turn_time.bits;
+		param->pv.i = self->qos_rx.min_turn_time.bits;
 	else
-		self->qos_tx.min_turn_time.bits = param->pv.b;
+		self->qos_tx.min_turn_time.bits = (__u8) param->pv.i;
 
 	return 0;
 }
