[PATCH 1/2] nvme: remove spurious use of *_to_cpup helpers

Christoph Hellwig hch at lst.de
Mon Aug 17 22:51:38 PDT 2015


On Mon, Aug 17, 2015 at 04:12:37PM -0400, Matthew Wilcox wrote:
> On Mon, Aug 17, 2015 at 09:09:39PM +0200, Christoph Hellwig wrote:
> > Switch to the normal endianess helpers that take an integer instead of
> > the pointer to it.
> 
> Why?  Some CPUs have a 'load-reversed-endian' instruction, which can be
> used in the _to_cpup() cases, but not in the _to_cpu() cases.

They can and will be used in both cases.

Powerpc examples listings below, as you can see they produce identical code.

------------------ le32_to_cpu ------------------
test.o:     file format elf32-powerpc


Disassembly of section .text:

00000000 <foor>:
};

int foor(struct foo *foo)
{
	return le32_to_cpu(foo->foo);
}
   0:	7c 60 1c 2c 	lwbrx   r3,0,r3
   4:	4e 80 00 20 	blr

------------------ le32_to_cpup ------------------
test.o:     file format elf32-powerpc


Disassembly of section .text:

00000000 <foor>:
};

int foor(struct foo *foo)
{
	return le32_to_cpup(&foo->foo);
}
   0:	7c 60 1c 2c 	lwbrx   r3,0,r3
   4:	4e 80 00 20 	blr



More information about the Linux-nvme mailing list