Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers/mmc/host/mmc_spi.c: Use get/put_unaligned_be32

Very minor source and binary size reduction.

Signed-off-by: George Spelvin <linux@horizon.com>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

George Spelvin and committed by
John W. Linville
9b60fa4a 1836eea2

+6 -12
+6 -12
drivers/mmc/host/mmc_spi.c
··· 448 448 { 449 449 struct scratch *data = host->data; 450 450 u8 *cp = data->status; 451 - u32 arg = cmd->arg; 452 451 int status; 453 452 struct spi_transfer *t; 454 453 ··· 464 465 * We init the whole buffer to all-ones, which is what we need 465 466 * to write while we're reading (later) response data. 466 467 */ 467 - memset(cp++, 0xff, sizeof(data->status)); 468 + memset(cp, 0xff, sizeof(data->status)); 468 469 469 - *cp++ = 0x40 | cmd->opcode; 470 - *cp++ = (u8)(arg >> 24); 471 - *cp++ = (u8)(arg >> 16); 472 - *cp++ = (u8)(arg >> 8); 473 - *cp++ = (u8)arg; 474 - *cp++ = crc7_be(0, &data->status[1], 5) | 0x01; 470 + cp[1] = 0x40 | cmd->opcode; 471 + put_unaligned_be32(cmd->arg, cp+2); 472 + cp[6] = crc7_be(0, cp+1, 5) | 0x01; 473 + cp += 7; 475 474 476 475 /* Then, read up to 13 bytes (while writing all-ones): 477 476 * - N(CR) (== 1..8) bytes of all-ones ··· 708 711 * so we have to cope with this situation and check the response 709 712 * bit-by-bit. Arggh!!! 710 713 */ 711 - pattern = scratch->status[0] << 24; 712 - pattern |= scratch->status[1] << 16; 713 - pattern |= scratch->status[2] << 8; 714 - pattern |= scratch->status[3]; 714 + pattern = get_unaligned_be32(scratch->status); 715 715 716 716 /* First 3 bit of pattern are undefined */ 717 717 pattern |= 0xE0000000;