Bug 12077

Summary: dv1394: missing byteswap on big-endian CPUs?
Product: Drivers Reporter: Stefan Richter (stefanr)
Component: IEEE1394Assignee: drivers_ieee1394
Status: REJECTED WILL_NOT_FIX    
Severity: normal    
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: all Subsystem:
Regression: --- Bisected commit-id:
Bug Depends on:    
Bug Blocks: 10046    

Description Stefan Richter 2008-11-22 03:21:59 UTC
From Harvey Harrison:
I've been working through annotating the endianness problems in
drivers/ieee1394/ and think I may have come across a missing
swap in dv1394.c.  This would only effect big-endian boxes.

Starting at line 2113:
			next->u.in.il.q[0] |= 3 << 20; /* enable interrupt */
			next->u.in.il.q[2] = 0; /* disable branch */

			/* link previous to next */
			prev_i = (next_i == 0) ? (MAX_PACKETS * video->n_frames - 1) : (next_i - 1);
			f = video->frames[prev_i / MAX_PACKETS];
			prev = &(f->descriptor_pool[prev_i % MAX_PACKETS]);
			if (prev_i % (MAX_PACKETS/2)) {
				prev->u.in.il.q[0] &= ~(3 << 20); /* no interrupt */
			} else {
				prev->u.in.il.q[0] |= 3 << 20; /* enable interrupt */
			}

I think all three accesses of .q[0] should be cpu_to_le32(3 << 20) or ~cpu_to_le32(3 << 20)
as appropriate.  It's treated as a little-endian register averywhere else in code.