فهرست منبع

[PATCH] kernel-doc for lib/crc*.c

Make kernel-doc corrections & additions to lib/crc*.c.  Add crc functions to
kernel-api.tmpl in DocBook.

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Randy Dunlap 19 سال پیش
والد
کامیت
2f72100c01
4فایلهای تغییر یافته به همراه36 افزوده شده و 40 حذف شده
  1. 6 0
      Documentation/DocBook/kernel-api.tmpl
  2. 3 3
      lib/crc-ccitt.c
  3. 5 5
      lib/crc16.c
  4. 22 32
      lib/crc32.c

+ 6 - 0
Documentation/DocBook/kernel-api.tmpl

@@ -129,6 +129,12 @@ X!Ilib/string.c
      <sect1><title>Command-line Parsing</title>
      <sect1><title>Command-line Parsing</title>
 !Elib/cmdline.c
 !Elib/cmdline.c
      </sect1>
      </sect1>
+
+     <sect1><title>CRC Functions</title>
+!Elib/crc16.c
+!Elib/crc32.c
+!Elib/crc-ccitt.c
+     </sect1>
   </chapter>
   </chapter>
 
 
   <chapter id="mm">
   <chapter id="mm">

+ 3 - 3
lib/crc-ccitt.c

@@ -53,9 +53,9 @@ EXPORT_SYMBOL(crc_ccitt_table);
 
 
 /**
 /**
  *	crc_ccitt - recompute the CRC for the data buffer
  *	crc_ccitt - recompute the CRC for the data buffer
- *	@crc - previous CRC value
- *	@buffer - data pointer
- *	@len - number of bytes in the buffer
+ *	@crc: previous CRC value
+ *	@buffer: data pointer
+ *	@len: number of bytes in the buffer
  */
  */
 u16 crc_ccitt(u16 crc, u8 const *buffer, size_t len)
 u16 crc_ccitt(u16 crc, u8 const *buffer, size_t len)
 {
 {

+ 5 - 5
lib/crc16.c

@@ -47,12 +47,12 @@ u16 const crc16_table[256] = {
 EXPORT_SYMBOL(crc16_table);
 EXPORT_SYMBOL(crc16_table);
 
 
 /**
 /**
- * Compute the CRC-16 for the data buffer
+ * crc16 - compute the CRC-16 for the data buffer
+ * @crc:	previous CRC value
+ * @buffer:	data pointer
+ * @len:	number of bytes in the buffer
  *
  *
- * @param crc     previous CRC value
- * @param buffer  data pointer
- * @param len     number of bytes in the buffer
- * @return        the updated CRC value
+ * Returns the updated CRC value.
  */
  */
 u16 crc16(u16 crc, u8 const *buffer, size_t len)
 u16 crc16(u16 crc, u8 const *buffer, size_t len)
 {
 {

+ 22 - 32
lib/crc32.c

@@ -42,20 +42,21 @@ MODULE_AUTHOR("Matt Domsch <Matt_Domsch@dell.com>");
 MODULE_DESCRIPTION("Ethernet CRC32 calculations");
 MODULE_DESCRIPTION("Ethernet CRC32 calculations");
 MODULE_LICENSE("GPL");
 MODULE_LICENSE("GPL");
 
 
+/**
+ * crc32_le() - Calculate bitwise little-endian Ethernet AUTODIN II CRC32
+ * @crc: seed value for computation.  ~0 for Ethernet, sometimes 0 for
+ *	other uses, or the previous crc32 value if computing incrementally.
+ * @p: pointer to buffer over which CRC is run
+ * @len: length of buffer @p
+ */
+u32 __attribute_pure__ crc32_le(u32 crc, unsigned char const *p, size_t len);
+
 #if CRC_LE_BITS == 1
 #if CRC_LE_BITS == 1
 /*
 /*
  * In fact, the table-based code will work in this case, but it can be
  * In fact, the table-based code will work in this case, but it can be
  * simplified by inlining the table in ?: form.
  * simplified by inlining the table in ?: form.
  */
  */
 
 
-/**
- * crc32_le() - Calculate bitwise little-endian Ethernet AUTODIN II CRC32
- * @crc - seed value for computation.  ~0 for Ethernet, sometimes 0 for
- *        other uses, or the previous crc32 value if computing incrementally.
- * @p   - pointer to buffer over which CRC is run
- * @len - length of buffer @p
- * 
- */
 u32 __attribute_pure__ crc32_le(u32 crc, unsigned char const *p, size_t len)
 u32 __attribute_pure__ crc32_le(u32 crc, unsigned char const *p, size_t len)
 {
 {
 	int i;
 	int i;
@@ -68,14 +69,6 @@ u32 __attribute_pure__ crc32_le(u32 crc, unsigned char const *p, size_t len)
 }
 }
 #else				/* Table-based approach */
 #else				/* Table-based approach */
 
 
-/**
- * crc32_le() - Calculate bitwise little-endian Ethernet AUTODIN II CRC32
- * @crc - seed value for computation.  ~0 for Ethernet, sometimes 0 for
- *        other uses, or the previous crc32 value if computing incrementally.
- * @p   - pointer to buffer over which CRC is run
- * @len - length of buffer @p
- * 
- */
 u32 __attribute_pure__ crc32_le(u32 crc, unsigned char const *p, size_t len)
 u32 __attribute_pure__ crc32_le(u32 crc, unsigned char const *p, size_t len)
 {
 {
 # if CRC_LE_BITS == 8
 # if CRC_LE_BITS == 8
@@ -145,20 +138,21 @@ u32 __attribute_pure__ crc32_le(u32 crc, unsigned char const *p, size_t len)
 }
 }
 #endif
 #endif
 
 
+/**
+ * crc32_be() - Calculate bitwise big-endian Ethernet AUTODIN II CRC32
+ * @crc: seed value for computation.  ~0 for Ethernet, sometimes 0 for
+ *	other uses, or the previous crc32 value if computing incrementally.
+ * @p: pointer to buffer over which CRC is run
+ * @len: length of buffer @p
+ */
+u32 __attribute_pure__ crc32_be(u32 crc, unsigned char const *p, size_t len);
+
 #if CRC_BE_BITS == 1
 #if CRC_BE_BITS == 1
 /*
 /*
  * In fact, the table-based code will work in this case, but it can be
  * In fact, the table-based code will work in this case, but it can be
  * simplified by inlining the table in ?: form.
  * simplified by inlining the table in ?: form.
  */
  */
 
 
-/**
- * crc32_be() - Calculate bitwise big-endian Ethernet AUTODIN II CRC32
- * @crc - seed value for computation.  ~0 for Ethernet, sometimes 0 for
- *        other uses, or the previous crc32 value if computing incrementally.
- * @p   - pointer to buffer over which CRC is run
- * @len - length of buffer @p
- * 
- */
 u32 __attribute_pure__ crc32_be(u32 crc, unsigned char const *p, size_t len)
 u32 __attribute_pure__ crc32_be(u32 crc, unsigned char const *p, size_t len)
 {
 {
 	int i;
 	int i;
@@ -173,14 +167,6 @@ u32 __attribute_pure__ crc32_be(u32 crc, unsigned char const *p, size_t len)
 }
 }
 
 
 #else				/* Table-based approach */
 #else				/* Table-based approach */
-/**
- * crc32_be() - Calculate bitwise big-endian Ethernet AUTODIN II CRC32
- * @crc - seed value for computation.  ~0 for Ethernet, sometimes 0 for
- *        other uses, or the previous crc32 value if computing incrementally.
- * @p   - pointer to buffer over which CRC is run
- * @len - length of buffer @p
- * 
- */
 u32 __attribute_pure__ crc32_be(u32 crc, unsigned char const *p, size_t len)
 u32 __attribute_pure__ crc32_be(u32 crc, unsigned char const *p, size_t len)
 {
 {
 # if CRC_BE_BITS == 8
 # if CRC_BE_BITS == 8
@@ -249,6 +235,10 @@ u32 __attribute_pure__ crc32_be(u32 crc, unsigned char const *p, size_t len)
 }
 }
 #endif
 #endif
 
 
+/**
+ * bitreverse - reverse the order of bits in a u32 value
+ * @x: value to be bit-reversed
+ */
 u32 bitreverse(u32 x)
 u32 bitreverse(u32 x)
 {
 {
 	x = (x >> 16) | (x << 16);
 	x = (x >> 16) | (x << 16);