mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
lib/crc32: Make core crc32() routines weak so they can be overridden
Allow architectures to drop in accelerated CRC32 routines by making the crc32_le/__crc32c_le entry points weak, and exposing non-weak aliases for them that may be used by the accelerated versions as fallbacks in case the instructions they rely upon are not available. Acked-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Forenche <prahul2003@gmail.com>
This commit is contained in:
parent
d8d7e9a9ae
commit
5cc1e12ba7
11
lib/crc32.c
11
lib/crc32.c
@ -182,21 +182,21 @@ static inline u32 __pure crc32_le_generic(u32 crc, unsigned char const *p,
|
||||
}
|
||||
|
||||
#if CRC_LE_BITS == 1
|
||||
u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len)
|
||||
u32 __pure __weak crc32_le(u32 crc, unsigned char const *p, size_t len)
|
||||
{
|
||||
return crc32_le_generic(crc, p, len, NULL, CRCPOLY_LE);
|
||||
}
|
||||
u32 __pure __crc32c_le(u32 crc, unsigned char const *p, size_t len)
|
||||
u32 __pure __weak __crc32c_le(u32 crc, unsigned char const *p, size_t len)
|
||||
{
|
||||
return crc32_le_generic(crc, p, len, NULL, CRC32C_POLY_LE);
|
||||
}
|
||||
#else
|
||||
u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len)
|
||||
u32 __pure __weak crc32_le(u32 crc, unsigned char const *p, size_t len)
|
||||
{
|
||||
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 __weak __crc32c_le(u32 crc, unsigned char const *p, size_t len)
|
||||
{
|
||||
return crc32_le_generic(crc, p, len,
|
||||
(const u32 (*)[256])crc32ctable_le, CRC32C_POLY_LE);
|
||||
@ -205,6 +205,9 @@ u32 __pure __crc32c_le(u32 crc, unsigned char const *p, size_t len)
|
||||
EXPORT_SYMBOL(crc32_le);
|
||||
EXPORT_SYMBOL(__crc32c_le);
|
||||
|
||||
u32 crc32_le_base(u32, unsigned char const *, size_t) __alias(crc32_le);
|
||||
u32 __crc32c_le_base(u32, unsigned char const *, size_t) __alias(__crc32c_le);
|
||||
|
||||
/*
|
||||
* This multiplies the polynomials x and y modulo the given modulus.
|
||||
* This follows the "little-endian" CRC convention that the lsbit
|
||||
|
Loading…
x
Reference in New Issue
Block a user