docs: clean up and add rest of CRC functions to kernel-api.rst
Add the rest of the CRC library functions to kernel-api. - try to clarify crc32() by adding '@' to a function parameter - reorder kernel-api CRC functions to be less random - add more CRC functions to kernel-api - correct the function parameter names in several places Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
This commit is contained in:
parent
44e9f09936
commit
8a29896a6e
|
@ -71,20 +71,26 @@ Command-line Parsing
|
||||||
CRC Functions
|
CRC Functions
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
.. kernel-doc:: lib/crc4.c
|
||||||
|
:export:
|
||||||
|
|
||||||
.. kernel-doc:: lib/crc7.c
|
.. kernel-doc:: lib/crc7.c
|
||||||
:export:
|
:export:
|
||||||
|
|
||||||
|
.. kernel-doc:: lib/crc8.c
|
||||||
|
:export:
|
||||||
|
|
||||||
.. kernel-doc:: lib/crc16.c
|
.. kernel-doc:: lib/crc16.c
|
||||||
:export:
|
:export:
|
||||||
|
|
||||||
.. kernel-doc:: lib/crc-itu-t.c
|
|
||||||
:export:
|
|
||||||
|
|
||||||
.. kernel-doc:: lib/crc32.c
|
.. kernel-doc:: lib/crc32.c
|
||||||
|
|
||||||
.. kernel-doc:: lib/crc-ccitt.c
|
.. kernel-doc:: lib/crc-ccitt.c
|
||||||
:export:
|
:export:
|
||||||
|
|
||||||
|
.. kernel-doc:: lib/crc-itu-t.c
|
||||||
|
:export:
|
||||||
|
|
||||||
idr/ida Functions
|
idr/ida Functions
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
|
|
@ -225,7 +225,7 @@ static u32 __attribute_const__ gf2_multiply(u32 x, u32 y, u32 modulus)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* crc32_generic_shift - Append len 0 bytes to crc, in logarithmic time
|
* crc32_generic_shift - Append @len 0 bytes to crc, in logarithmic time
|
||||||
* @crc: The original little-endian CRC (i.e. lsbit is x^31 coefficient)
|
* @crc: The original little-endian CRC (i.e. lsbit is x^31 coefficient)
|
||||||
* @len: The number of bytes. @crc is multiplied by x^(8*@len)
|
* @len: The number of bytes. @crc is multiplied by x^(8*@len)
|
||||||
* @polynomial: The modulus used to reduce the result to 32 bits.
|
* @polynomial: The modulus used to reduce the result to 32 bits.
|
||||||
|
|
|
@ -15,7 +15,7 @@ static const uint8_t crc4_tab[] = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* crc4 - calculate the 4-bit crc of a value.
|
* crc4 - calculate the 4-bit crc of a value.
|
||||||
* @crc: starting crc4
|
* @c: starting crc4
|
||||||
* @x: value to checksum
|
* @x: value to checksum
|
||||||
* @bits: number of bits in @x to checksum
|
* @bits: number of bits in @x to checksum
|
||||||
*
|
*
|
||||||
|
|
22
lib/crc8.c
22
lib/crc8.c
|
@ -20,11 +20,11 @@
|
||||||
#include <linux/crc8.h>
|
#include <linux/crc8.h>
|
||||||
#include <linux/printk.h>
|
#include <linux/printk.h>
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* crc8_populate_msb - fill crc table for given polynomial in reverse bit order.
|
* crc8_populate_msb - fill crc table for given polynomial in reverse bit order.
|
||||||
*
|
*
|
||||||
* table: table to be filled.
|
* @table: table to be filled.
|
||||||
* polynomial: polynomial for which table is to be filled.
|
* @polynomial: polynomial for which table is to be filled.
|
||||||
*/
|
*/
|
||||||
void crc8_populate_msb(u8 table[CRC8_TABLE_SIZE], u8 polynomial)
|
void crc8_populate_msb(u8 table[CRC8_TABLE_SIZE], u8 polynomial)
|
||||||
{
|
{
|
||||||
|
@ -42,11 +42,11 @@ void crc8_populate_msb(u8 table[CRC8_TABLE_SIZE], u8 polynomial)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(crc8_populate_msb);
|
EXPORT_SYMBOL(crc8_populate_msb);
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* crc8_populate_lsb - fill crc table for given polynomial in regular bit order.
|
* crc8_populate_lsb - fill crc table for given polynomial in regular bit order.
|
||||||
*
|
*
|
||||||
* table: table to be filled.
|
* @table: table to be filled.
|
||||||
* polynomial: polynomial for which table is to be filled.
|
* @polynomial: polynomial for which table is to be filled.
|
||||||
*/
|
*/
|
||||||
void crc8_populate_lsb(u8 table[CRC8_TABLE_SIZE], u8 polynomial)
|
void crc8_populate_lsb(u8 table[CRC8_TABLE_SIZE], u8 polynomial)
|
||||||
{
|
{
|
||||||
|
@ -63,13 +63,13 @@ void crc8_populate_lsb(u8 table[CRC8_TABLE_SIZE], u8 polynomial)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(crc8_populate_lsb);
|
EXPORT_SYMBOL(crc8_populate_lsb);
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* crc8 - calculate a crc8 over the given input data.
|
* crc8 - calculate a crc8 over the given input data.
|
||||||
*
|
*
|
||||||
* table: crc table used for calculation.
|
* @table: crc table used for calculation.
|
||||||
* pdata: pointer to data buffer.
|
* @pdata: pointer to data buffer.
|
||||||
* nbytes: number of bytes in data buffer.
|
* @nbytes: number of bytes in data buffer.
|
||||||
* crc: previous returned crc8 value.
|
* @crc: previous returned crc8 value.
|
||||||
*/
|
*/
|
||||||
u8 crc8(const u8 table[CRC8_TABLE_SIZE], u8 *pdata, size_t nbytes, u8 crc)
|
u8 crc8(const u8 table[CRC8_TABLE_SIZE], u8 *pdata, size_t nbytes, u8 crc)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue