From: "Pali Rohár" <pali@kernel.org>
To: "Simon Glass" <sjg@chromium.org>, "Bin Meng" <bmeng.cn@gmail.com>,
"Adrian Fiergolski" <adrian.fiergolski@fastree3d.com>,
"Marek Behún" <marek.behun@nic.cz>, "Stefan Roese" <sr@denx.de>
Cc: u-boot@lists.denx.de
Subject: [PATCH 3/5] crc16: Move standard CRC-16 implementation from ubifs to lib
Date: Tue, 12 Apr 2022 11:20:42 +0200 [thread overview]
Message-ID: <20220412092044.25133-4-pali@kernel.org> (raw)
In-Reply-To: <20220412092044.25133-1-pali@kernel.org>
This implementation provides standard CRC-16 algorithm with polynomial
x^16 + x^15 + x^2 + 1.
Signed-off-by: Pali Rohár <pali@kernel.org>
---
fs/ubifs/Makefile | 2 +-
include/u-boot/crc.h | 3 +++
lib/Makefile | 1 +
{fs/ubifs => lib}/crc16.c | 0
4 files changed, 5 insertions(+), 1 deletion(-)
rename {fs/ubifs => lib}/crc16.c (100%)
diff --git a/fs/ubifs/Makefile b/fs/ubifs/Makefile
index 64d64472945e..631ba5f438cf 100644
--- a/fs/ubifs/Makefile
+++ b/fs/ubifs/Makefile
@@ -9,5 +9,5 @@
obj-y := ubifs.o io.o super.o sb.o master.o lpt.o
obj-y += lpt_commit.o scan.o lprops.o
-obj-y += tnc.o tnc_misc.o debug.o crc16.o budget.o
+obj-y += tnc.o tnc_misc.o debug.o budget.o
obj-y += log.o orphan.o recovery.o replay.o gc.o
diff --git a/include/u-boot/crc.h b/include/u-boot/crc.h
index eba8edfb4f31..5174bd7ac413 100644
--- a/include/u-boot/crc.h
+++ b/include/u-boot/crc.h
@@ -25,6 +25,9 @@
*/
unsigned int crc8(unsigned int crc_start, const unsigned char *vptr, int len);
+/* lib/crc16.c - 16 bit CRC with polynomial x^16 + x^15 + x^2 + 1 */
+uint16_t crc16(uint16_t crc, const unsigned char *buffer, size_t len);
+
/* lib/crc16-ccitt.c - 16 bit CRC with polynomial x^16+x^12+x^5+1 (CRC-CCITT) */
uint16_t crc16_ccitt(uint16_t crc_start, const unsigned char *s, int len);
/**
diff --git a/lib/Makefile b/lib/Makefile
index b4f03cc149d3..0d0261b8986f 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -37,6 +37,7 @@ obj-$(CONFIG_CIRCBUF) += circbuf.o
endif
obj-y += crc8.o
+obj-y += crc16.o
obj-y += crc16-ccitt.o
obj-$(CONFIG_ERRNO_STR) += errno_str.o
obj-$(CONFIG_FIT) += fdtdec_common.o
diff --git a/fs/ubifs/crc16.c b/lib/crc16.c
similarity index 100%
rename from fs/ubifs/crc16.c
rename to lib/crc16.c
--
2.20.1
next prev parent reply other threads:[~2022-04-12 9:22 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-12 9:20 [PATCH 0/5] crc16: Remove duplicate implementations Pali Rohár
2022-04-12 9:20 ` [PATCH 1/5] crc16-ccitt: Rename file with CRC-16-CCITT implementation to crc16-ccitt.c Pali Rohár
2022-04-21 14:34 ` Stefan Roese
2022-04-21 23:56 ` Tom Rini
2022-04-12 9:20 ` [PATCH 2/5] crc16: Rename fs/ubifs/crc16.h to include/linux/crc16.h Pali Rohár
2022-04-21 14:34 ` Stefan Roese
2022-04-21 23:56 ` Tom Rini
2022-04-12 9:20 ` Pali Rohár [this message]
2022-04-21 14:35 ` [PATCH 3/5] crc16: Move standard CRC-16 implementation from ubifs to lib Stefan Roese
2022-04-21 23:57 ` Tom Rini
2022-04-12 9:20 ` [PATCH 4/5] fs: ext4: Use CRC-16 implementation from linux/crc16.h Pali Rohár
2022-04-21 14:35 ` Stefan Roese
2022-04-21 23:57 ` Tom Rini
2022-04-12 9:20 ` [PATCH 5/5] misc: atsha204a: Remove duplicate CRC-16 implementation Pali Rohár
2022-04-21 14:35 ` Stefan Roese
2022-04-21 23:57 ` Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220412092044.25133-4-pali@kernel.org \
--to=pali@kernel.org \
--cc=adrian.fiergolski@fastree3d.com \
--cc=bmeng.cn@gmail.com \
--cc=marek.behun@nic.cz \
--cc=sjg@chromium.org \
--cc=sr@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox