sections: fix const sections for crc32 table

Fix the const sections for the code generated by crc32 table.  There's
no ro version of the cacheline aligned section, so we cannot put in
const data without a conflict Just don't make the crc tables const for
now.

[ak@linux.intel.com: some fixes and new description]
[akpm@linux-foundation.org: checkpatch fixes]
Signed-off-by: Joe Mario <jmario@redhat.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Joe Mario 2012-10-04 17:12:15 -07:00 committed by Linus Torvalds
parent c7fd5bc77e
commit 8f243af42a
2 changed files with 9 additions and 6 deletions

View File

@ -188,11 +188,13 @@ u32 __pure __crc32c_le(u32 crc, unsigned char const *p, size_t len)
#else #else
u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len) u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len)
{ {
return crc32_le_generic(crc, p, len, crc32table_le, CRCPOLY_LE); return crc32_le_generic(crc, p, len,
(const u32 (*)[256])crc32table_le, CRCPOLY_LE);
} }
u32 __pure __crc32c_le(u32 crc, unsigned char const *p, size_t len) u32 __pure __crc32c_le(u32 crc, unsigned char const *p, size_t len)
{ {
return crc32_le_generic(crc, p, len, crc32ctable_le, CRC32C_POLY_LE); return crc32_le_generic(crc, p, len,
(const u32 (*)[256])crc32ctable_le, CRC32C_POLY_LE);
} }
#endif #endif
EXPORT_SYMBOL(crc32_le); EXPORT_SYMBOL(crc32_le);
@ -253,7 +255,8 @@ u32 __pure crc32_be(u32 crc, unsigned char const *p, size_t len)
#else #else
u32 __pure crc32_be(u32 crc, unsigned char const *p, size_t len) u32 __pure crc32_be(u32 crc, unsigned char const *p, size_t len)
{ {
return crc32_be_generic(crc, p, len, crc32table_be, CRCPOLY_BE); return crc32_be_generic(crc, p, len,
(const u32 (*)[256])crc32table_be, CRCPOLY_BE);
} }
#endif #endif
EXPORT_SYMBOL(crc32_be); EXPORT_SYMBOL(crc32_be);

View File

@ -109,7 +109,7 @@ int main(int argc, char** argv)
if (CRC_LE_BITS > 1) { if (CRC_LE_BITS > 1) {
crc32init_le(); crc32init_le();
printf("static const u32 __cacheline_aligned " printf("static u32 __cacheline_aligned "
"crc32table_le[%d][%d] = {", "crc32table_le[%d][%d] = {",
LE_TABLE_ROWS, LE_TABLE_SIZE); LE_TABLE_ROWS, LE_TABLE_SIZE);
output_table(crc32table_le, LE_TABLE_ROWS, output_table(crc32table_le, LE_TABLE_ROWS,
@ -119,7 +119,7 @@ int main(int argc, char** argv)
if (CRC_BE_BITS > 1) { if (CRC_BE_BITS > 1) {
crc32init_be(); crc32init_be();
printf("static const u32 __cacheline_aligned " printf("static u32 __cacheline_aligned "
"crc32table_be[%d][%d] = {", "crc32table_be[%d][%d] = {",
BE_TABLE_ROWS, BE_TABLE_SIZE); BE_TABLE_ROWS, BE_TABLE_SIZE);
output_table(crc32table_be, LE_TABLE_ROWS, output_table(crc32table_be, LE_TABLE_ROWS,
@ -128,7 +128,7 @@ int main(int argc, char** argv)
} }
if (CRC_LE_BITS > 1) { if (CRC_LE_BITS > 1) {
crc32cinit_le(); crc32cinit_le();
printf("static const u32 __cacheline_aligned " printf("static u32 __cacheline_aligned "
"crc32ctable_le[%d][%d] = {", "crc32ctable_le[%d][%d] = {",
LE_TABLE_ROWS, LE_TABLE_SIZE); LE_TABLE_ROWS, LE_TABLE_SIZE);
output_table(crc32ctable_le, LE_TABLE_ROWS, output_table(crc32ctable_le, LE_TABLE_ROWS,