Re: [RFC] lib: crc8: add new library module providing crc8 algorithm

From: George Spelvin
Date: Wed May 25 2011 - 01:46:40 EST


> On 05/25/2011 12:52 AM, George Spelvin wrote:
>> May I suggest that crc8_create is A Stupid Idea. Since the bit order
>> (and polynomial) will always be compile-time constants, just let the
>> call sites call crc8_create_[lm]sb_first() directly.

> Thanks for be subtle in your suggestion.

Since you are obviously being ironic in your phrasing, I hope I did not
give serious offense. What I wrote is a fairly accurate description of
my reflex reaction, but I could have phrased it more diplomatically.

> If callers use the specific function they can not specify a bit order so
> no compile-time error.

What I meant was, the bit order is specified by the function name.
An invalid bit order translates to an invalid function name, which the
linker will complain about.


If you feel ambitious, you can fold the crc7 code into yours. Its an
msbit-first CRC. The resultant table will be left-justified rather
than the current right-justified, but if you look at all the call sites,
you'll notice that they all shift the result left 1 bit!

I have a pending bug report about some of the calling code which I
noticed when trying to update it myself, but it doesn't actally
prevent updating the crc7() call sites:
http://marc.info/?l=linux-wireless&m=130616050311698
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/