2 * Copyright (c) 2013 Google, Inc
4 * SPDX-License-Identifier: GPL-2.0+
7 #include "linux/crc8.h"
9 #define POLY (0x1070U << 3)
11 static unsigned char _crc8(unsigned short data)
15 for (i = 0; i < 8; i++) {
21 return (unsigned char)(data >> 8);
24 unsigned int crc8(unsigned int crc, const unsigned char *vptr, int len)
28 for (i = 0; i < len; i++)
29 crc = _crc8((crc ^ vptr[i]) << 8);