Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1836eea2 authored by George Spelvin's avatar George Spelvin Committed by John W. Linville
Browse files

lib/crc7: Shift crc7() output left 1 bit



This eliminates a 1-bit left shift in every single caller,
and makes the inner loop of the CRC computation more efficient.

Renamed crc7 to crc7_be (big-endian) since the interface changed.

Also purged #include <linux/crc7.h> from files that don't use it at all.

Signed-off-by: default avatarGeorge Spelvin <linux@horizon.com>
Reviewed-by: default avatarPavel Machek <pavel@ucw.cz>
Acked-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent d91a48cb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -472,7 +472,7 @@ mmc_spi_command_send(struct mmc_spi_host *host,
	*cp++ = (u8)(arg >> 16);
	*cp++ = (u8)(arg >> 8);
	*cp++ = (u8)arg;
	*cp++ = (crc7(0, &data->status[1], 5) << 1) | 0x01;
	*cp++ = crc7_be(0, &data->status[1], 5) | 0x01;

	/* Then, read up to 13 bytes (while writing all-ones):
	 *  - N(CR) (== 1..8) bytes of all-ones
+0 −1
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@

#include <linux/module.h>
#include <linux/slab.h>
#include <linux/crc7.h>

#include "wl1251.h"
#include "reg.h"
+0 −1
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@

#include <linux/module.h>
#include <linux/slab.h>
#include <linux/crc7.h>
#include <linux/etherdevice.h>

#include "wl1251.h"
+1 −2
Original line number Diff line number Diff line
@@ -122,8 +122,7 @@ static void wl1251_spi_wake(struct wl1251 *wl)
	crc[3] = cmd[6];
	crc[4] = cmd[5];

	cmd[4] |= crc7(0, crc, WSPI_INIT_CMD_CRC_LEN) << 1;
	cmd[4] |= WSPI_INIT_CMD_END;
	cmd[4] = crc7_be(0, crc, WSPI_INIT_CMD_CRC_LEN) | WSPI_INIT_CMD_END;

	t.tx_buf = cmd;
	t.len = WSPI_INIT_CMD_LEN;
+1 −2
Original line number Diff line number Diff line
@@ -151,8 +151,7 @@ static void wl12xx_spi_init(struct device *child)
	crc[3] = cmd[6];
	crc[4] = cmd[5];

	cmd[4] |= crc7(0, crc, WSPI_INIT_CMD_CRC_LEN) << 1;
	cmd[4] |= WSPI_INIT_CMD_END;
	cmd[4] = crc7_be(0, crc, WSPI_INIT_CMD_CRC_LEN) | WSPI_INIT_CMD_END;

	t.tx_buf = cmd;
	t.len = WSPI_INIT_CMD_LEN;
Loading